home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume39 / ncftp / part05 / util.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-25  |  2.0 KB  |  85 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. #    define dbprintf if (debug) (void) printf
  30. #else
  31. #    ifndef DB_STREAM
  32. #        define DB_STREAM stdout
  33. #    endif
  34.     void dbprintf(char *fmt, ...);
  35. #endif
  36.  
  37. /* For 'Getopt.' */
  38. #define BADCH   ((int)'?')
  39. #define EMSG    ""
  40.  
  41. /* Handy macros. */
  42. #define Strncpy(d,s) _Strncpy((char *) (d), (char *) (s), (size_t) sizeof(d))
  43. #define Strncat(d,s) _Strncat((char *) (d), (char *) (s), (size_t) sizeof(d))
  44. #define FGets(a,b) fgets((a), (int) (sizeof(a) - 2), (b))
  45.  
  46. #ifndef NO_CONST
  47. typedef int (*cmp_t)(const void *, const void *);
  48. #else
  49. typedef int (*cmp_t)(void *, void *);
  50. #endif
  51.  
  52. #define QSort(base,n,sz,cmp) \
  53.     qsort(base, (size_t)(n), (size_t)(sz), (cmp_t)(cmp))
  54.  
  55. #ifndef SIG_PARAMS
  56. #define SIG_PARAMS (int sig)
  57. #endif
  58. typedef void (*sig_t) SIG_PARAMS;
  59.  
  60. #define Signal(a,proc) signal((a), (sig_t)(proc))
  61.  
  62. /* Protos. */
  63. char *_Strncat(char *dst, char *src, register size_t n);
  64. char *_Strncpy(char *dst, char *src, register size_t n);
  65. char *NewString(char *oldstr);
  66. char **re_makeargv(char *promptstr, int *argc);
  67. char *onoff(int);
  68. int StrToBool(char *s);
  69. int confirm(char *cmd, char *file);
  70. void fatal(char *msg);
  71. char *get_cwd(char *buf, int size);
  72. int tmp_name(char *str);
  73. int Getopt(int argc, char **argv, char *opstring);
  74. void Getopt_Reset(void);
  75. char *Gets(char *promptstr, char *sline, size_t size);
  76. size_t RemoveTrailingNewline(char *cp, int *stripped);
  77. unsigned long UnLSDate(char *dstr);
  78. char *Strpcpy(char *dst, char *src);
  79. int UserLoggedIn(void);
  80. char *LocalPath(char *path);
  81. char *LocalDotPath(char *path);
  82. char *GetHomeDir(char *home);
  83.  
  84. #endif    /* _util_h_ */
  85.