home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pine / ccmd / cmkeyval.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-19  |  711 b   |  34 lines

  1. /*
  2.  * generate the cmkeyval.h file.
  3.  *
  4.  * figure out what is the largest native type on the system,
  5.  * and typedef keyval to that type.
  6.  */
  7.  
  8. typedef struct {
  9.     int size;
  10.     char *name;
  11. } type;
  12.  
  13. typedef int (* cmprocptr)();
  14. type typetab[] = {
  15.     { sizeof(int), "int" },
  16.     { sizeof(char *), "char *" },
  17.     { sizeof(int *), "int *" },
  18.     { sizeof(cmprocptr), "cmprocptr" },
  19.     { sizeof(void *), "void *" },
  20. };
  21.  
  22. int typetablen = sizeof(typetab)/sizeof(type);
  23.  
  24. main() {
  25.     int i;
  26.     int max = 0;
  27.     for(i = 0; i < typetablen; i++)
  28.     if (typetab[max].size < typetab[i].size)
  29.         max = i;
  30.     printf("typedef int (* cmprocptr)();\n");
  31.     printf("typedef %s keyval;\n",typetab[max].name);
  32.     return(0);
  33. }
  34.