campo-sirio/gfm/funname.c

63 lines
976 B
C
Raw Normal View History

/* char *FunctionName(dst, num);
*
* ARGUMENT
* char *pDst;
* int num;
*
* DESCRIPTION
* This function copies the string name corresponding to a given
* function number into dst. dst must be character array allocated to have
* at least 32 characters.
*
* SIDE EFFECTS
* None.
*
* RETURNS
* dst if successful, otherwise NULL.
*
* POSSIBLE Function CODES
*
* GM_NULLSTRING
* GM_ARGVAL
*
* AUTHOR
* Jared Levy
* Copyright (C) 1988-1990 Greenleaf Software Inc. All rights reserved.
*
* MODIFICATIONS
*
*
*/
#include <stdio.h>
#include <string.h>
#include "gmsystem.h"
#include "gmfname.h"
char *FunctionName(dst, num)
char *dst;
int num;
{
int err;
_MacStart(GM_FUNNAME);
if (!dst) {
_MacErr(GM_NULLSTRING);
_MacRet(NULL);
}
if (num==0) {
_MacDCopy(dst, "None");
_MacRet(dst);
}
err = num - GM_FN_BASE;
if (err<0 || err>GM_FN_NUM) {
_MacErr(GM_ARGVAL);
_MacRet(NULL);
}
strcpy(dst, fnames[err]);
_MacRet(dst);
}