home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
xbase
/
library
/
clipper
/
rettig
/
source
/
cmonthn.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-21
|
1KB
|
32 lines
/*********
* cmonthn.c by Leonard Zerman
* Placed in the public domain by Tom Rettig Associates, 10/22/1990.
*
* Syntax: CMONTHN(<expN>)
* Return: character month from <expN>
* NULL if invalid month.
* Minimum month is 1, maximum month is 12.
********/
#include "trlib.h"
TRTYPE cmonthn() /* declare the cmonthn function */
{
static char funcname[] = {"cmonthn"}; /* program name for errors */
int month;
static char *lookup[13]= /* declare static look-up array */
{ MONTH0, MONTH1, MONTH2, MONTH3, MONTH4, MONTH5, MONTH6,
MONTH7, MONTH8, MONTH9, MONTH10, MONTH11, MONTH12
}; /* months are #defined in trlib.h */
if (PCOUNT == 1 && ISNUM(1)) /* check passed parms */
{
month = _parni(1); /* assign vars */
_retc( (month>=1 && month<=12) ? lookup[month] : lookup[0] );
}
else
_retc(_tr_errmsgs(funcname, E_SYNTAX)); /* syntax error */
return; /* return from program */
}
/* eof */