home *** CD-ROM | disk | FTP | other *** search
/ ftp.ncftp.com / ftp.ncftp.com.zip / ftp.ncftp.com / ncftp / ncftp-1.9.5.tar.gz / ncftp-1.9.5.tar / ncftp-1.9.5 / util.h < prev   
C/C++ Source or Header  |  1995-10-01  |  2KB  |  105 lines

  1. /* Util.h */
  2.  
  3. #ifndef _util_h_
  4. #define _util_h_
  5.  
  6. /*  $RCSfile: util.h,v $
  7.  *  $Revision: 14020.12 $
  8.  *  $Date: 93/07/09 11:32:49 $
  9.  */
  10.  
  11. typedef char string[128], str32[32], longstring[512];
  12. typedef char Hostname[64];
  13.  
  14. /* For Perror. */
  15. #ifdef DB_ERRS
  16. #    ifdef __LINE__
  17. #        define PERROR(p,e) Perror(p, __LINE__, e)
  18.         void Perror(char *, int, char *);
  19. #    else
  20. #        define PERROR(p,e) Perror(p, e)
  21.         void Perror(char *, char *);
  22. #    endif
  23. #else
  24. #    define PERROR(p,e) Perror(e)
  25.     void Perror(char *);
  26. #endif
  27.  
  28. #ifdef NO_VARARGS
  29.     extern int debug;
  30. #    define dbprintf if (debug) (void) printf
  31. #else
  32. #    ifndef DB_STREAM
  33. #        define DB_STREAM stdout
  34. #    endif
  35. #ifndef NO_STDARGH
  36. void dbprintf(char *fmt0, ...);
  37. #else
  38. void dbprintf(int va_alist);
  39. #endif
  40. #endif
  41.  
  42. /* For 'Getopt.' */
  43. #define BADCH   ((int)'?')
  44. #define EMSG    ""
  45.  
  46. /* Handy macros. */
  47. #define Strncpy(d,s) _Strncpy((char *) (d), (char *) (s), (size_t) sizeof(d))
  48. #define Strncat(d,s) _Strncat((char *) (d), (char *) (s), (size_t) sizeof(d))
  49. #define FGets(a,b) fgets((a), (int) (sizeof(a) - 2), (b))
  50.  
  51. #ifndef NO_CONST
  52. typedef int (*cmp_t)(const void *, const void *);
  53. #else
  54. typedef int (*cmp_t)(void *, void *);
  55. #endif
  56.  
  57. #define QSort(base,n,sz,cmp) \
  58.     qsort(base, (size_t)(n), (size_t)(sz), (cmp_t)(cmp))
  59.  
  60. #ifndef SIG_PARAMS
  61. #define SIG_PARAMS (int sig)
  62. #endif
  63. typedef void (*Sig_t) SIG_PARAMS;
  64.  
  65. #define Signal(a,proc) signal((a), (Sig_t)(proc))
  66.  
  67. /* Quiets warnings */
  68. #if defined(sun)    /* ...actually, any UNIX system */
  69. # if defined(__GNUC__)
  70. #  undef  SIG_DFL
  71. #  undef  SIG_IGN
  72. #  define SIG_DFL    (Sig_t)0
  73. #  define SIG_IGN    (Sig_t)1
  74. # endif
  75. #endif
  76.  
  77. /* Protos. */
  78. char *_Strncat(char *dst, char *src, register size_t n);
  79. char *_Strncpy(char *dst, char *src, register size_t n);
  80. void StrLCase(char *dst);
  81. char *NewString(char *oldstr);
  82. char **re_makeargv(char *promptstr, int *argc);
  83. char *onoff(int);
  84. int StrToBool(char *s);
  85. int confirm(char *cmd, char *file);
  86. void fatal(char *msg);
  87. char *get_cwd(char *buf, int size);
  88. int tmp_name(char *str);
  89. int Getopt(int argc, char **argv, char *opstring);
  90. void Getopt_Reset(void);
  91. char *Gets(char *promptstr, char *sline, size_t size);
  92. size_t RemoveTrailingNewline(char *cp, int *stripped);
  93. unsigned long UnLSDate(char *dstr);
  94. unsigned long UnMDTMDate(char *dstr);
  95. char *Strpcpy(char *dst, char *src);
  96. int UserLoggedIn(void);
  97. char *LocalPath(char *path);
  98. char *LocalDotPath(char *path);
  99.  
  100. #ifdef NO_STRSTR
  101. char *strstr(char *s1, char *s2);
  102. #endif
  103.  
  104. #endif    /* _util_h_ */
  105.