home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mmdf / mmdf-IIb.43 / h / util.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-28  |  2.5 KB  |  115 lines

  1. #ifndef DIDUTIL
  2. #define DIDUTIL
  3. #include <stdio.h>                /* minus the ctype stuff */
  4. #include <ctype.h>
  5. #include <setjmp.h>
  6. #include <sys/types.h>    /* ONLY include this file from here, any other file
  7.              * which needs sys/types.h should #include "util.h".
  8.              * Not all Unix systems have tricks so that you
  9.              * can include sys/types.h arbitrary numbers of
  10.              * of times. -- DSH
  11.              */
  12. #include <errno.h>
  13.  
  14. /* declarations that should have been in the system files */
  15.  
  16. extern char *strcat ();
  17. extern char *strcpy ();
  18. #if defined(SYS5) || defined(ULTRIX) || defined(__STDC__)
  19. extern int sprintf ();
  20. #else
  21. extern char *sprintf ();
  22. #endif
  23. extern struct passwd *getpwnam(), *getpwuid();
  24.  
  25. #if defined(SYS5) || defined(__STDC__)
  26. #define sigtype void
  27. #else
  28. #define sigtype int
  29. #endif
  30.  
  31. /* */
  32.  
  33. extern jmp_buf timerest;
  34.  
  35. /* some common logical values */
  36.  
  37. #ifndef TRUE
  38. #define TRUE    1
  39. #endif
  40. #ifndef FALSE
  41. #define FALSE   0
  42. #endif
  43. #ifndef YES
  44. #define YES     1
  45. #endif
  46. #ifndef NO
  47. #define NO      0
  48. #endif
  49. #ifndef OK
  50. #define OK      0
  51. #endif
  52. #ifndef DONE
  53. #define DONE    1
  54. #endif
  55. #ifndef NOTOK
  56. #define NOTOK   -1
  57. #endif
  58. #ifndef    MAYBE
  59. #define    MAYBE    -2
  60. #endif
  61.  
  62. # define ML_FRESH  0
  63. # define ML_MSG    1
  64. # define ML_HEADER 2
  65. # define ML_TEXT   3
  66.  
  67. /* some C compilers do not support 'global' statics properly */
  68.  
  69. #ifndef LOCFUN
  70. #define LOCFUN static             /* function local to module           */
  71. #endif
  72. #ifndef LOCVAR
  73. #define LOCVAR static             /* variable local to module           */
  74. #endif
  75.  
  76. /* stdio extensions */
  77.  
  78. #define lowtoup(chr) (islower(chr)?toupper(chr):chr)
  79. #define uptolow(chr) (isupper(chr)?tolower(chr):chr)
  80. #define min(a,b) ((b<a)?b:a)
  81. #define isstr(ptr) ((ptr) != 0 && (ptr)[0] != '\0')
  82. #define isnull(chr) ((chr) == '\0')
  83.  
  84. /* fix for systems that can't accept null pointers passed to printf */
  85. #define seenull(ptr)    (((ptr)!=(char *)0)?(ptr):"(null)")
  86.  
  87. #define FOREVER   for (;;)
  88.  
  89. union pipunion
  90. {
  91.     int     pipcall[2];
  92.     struct pipstruct
  93.     {
  94.     int     prd;
  95.     int     pwrt;
  96.     } pip;
  97. };
  98.  
  99. typedef union pipunion Pip;
  100.  
  101. #ifdef v6
  102. long    siz2lon();
  103. #define st_gsize(ino_ptr) ((long)(siz2lon((struct stat *)ino_ptr)))
  104. #else
  105. #define st_gsize(inode) ((long)((struct stat *)inode)->st_size)
  106. #endif
  107.  
  108. #define gwaitval(val)   ((val) >> 8)
  109.                   /* get exit() value from child        */
  110.                   /* val is the argument to wait()      */
  111.                   /* this macro expects to extract the  */
  112.                   /* high byte from the "returned"      */
  113.                   /* value                              */
  114. #endif /* DIDUTIL */
  115.