home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / database / cdbms / ellist.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-06-01  |  875 b   |  39 lines

  1. /* ----------------------- ellist.c ---------------------- */
  2.  
  3. /*
  4.  *    Construct list of data element tokens from list of names
  5.  *  such as might be entered on a command line.
  6.  *  Return OK, or ERROR if one of the names is not in the
  7.  *  dictionary.
  8.  */
  9.  
  10. #include <stdio.h>
  11. #include "cdata.h"
  12.  
  13. int ellist(count, names, list)
  14. int count;                    /* number of names in the list */
  15. char *names[];                /* the names */
  16. int *list;                    /* the resulting list */
  17. {
  18.     char elname [31];
  19.     int el, el1;
  20.     extern void name_cvt();
  21.  
  22.     for (el = 0; el < count; el++)    {
  23.         for (el1 = 0; ; el1++)    {
  24.             if (denames [el1] == (char *) 0)    {
  25.                 fprintf(stderr,
  26.                     "\nNo such data element as %s", elname);
  27.                 return ERROR;
  28.             }
  29.             name_cvt(elname, names[el]);
  30.             if (strcmp(elname, denames [el1]) == 0)
  31.                 break;
  32.         }
  33.         *list++ = el1 + 1;
  34.     }
  35.     *list = 0;
  36.     return OK;
  37. }
  38.  
  39.