


#include <stdio.h>
#include <time.h>
#include <nlinfo.h>

void nlfmtlongcal(date, outstr, langid, err)
unsigned short	date, err[];
unsigned char	*outstr;
short	langid;
{
	unsigned short	nlcrtm();
	unsigned char	fmt_str[LENLONGCALFORM];
	struct tm xtime;

	err[0] = err[1] = 0;

	xtime.tm_year = (unsigned int)(date >> 9);
	xtime.tm_yday = (unsigned int)(date & 0x1ff);

	if ( (err[0] = nlcrtm(&xtime)) == 0){
		nlinfo(L_LONGCALFORM, (int *) fmt_str, &langid, err);
		if (err[0] == 0)
			format_nldt(langid, fmt_str, LENLONGCALFORM, outstr,
				LENLONGCALFORM, NULL, &xtime);
	        else return;
        }
	if (err[0])
		err[0] = E_INVALIDDATEFORMAT;
}

