home *** CD-ROM | disk | FTP | other *** search
- /*-------------------------------------------------------
-
- Utility functions to be used by database backend program.
- Jason Ng NCSA, Dec 1993 likkai@ncsa.uiuc.edu
-
- ------------------------------------------------------- */
- #include <stdio.h>
- #include <string.h>
-
- #define PRIVATE static
- #define PUBLIC
-
- PRIVATE int ndef = 0;
- PRIVATE char *defsym[100];
- PRIVATE char *defval[100];
-
- PUBLIC void app_parseargs (ac,av) int ac; char**av;
- {
- int i;
- char *sp;
-
- for(i=2;i<ac;i++, ndef++) {
- sp = strchr(av[i],' ');
- if(sp==NULL) continue;
- *sp ='\0';
- defsym[ndef] = strdup(av[i]);
- defval[ndef] = strdup(&sp[1]);
- }
-
- /**
- printf("sqlstr [%s] \n", sqlstring);
- for(i=0;i<ndef;i++) {
- printf(" <P>DEFINE %d [%s]\t[%s]\n", i, defsym[i], defval[i]);
- }
- **/
- }
-
- /* returns the value for a given define ss */
- PUBLIC char * app_getdefine(char *ss)
- {
- int i;
- for(i=0;i<ndef;i++) {
- if(!strcmp(ss,defsym[i])) return(defval[i]);
- }
- return(NULL);
- }
-
-