home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / d / dshar116.zip / COMMON.H next >
C/C++ Source or Header  |  1993-03-11  |  2KB  |  68 lines

  1.  /* common.h    dshar Ver1.16 nide@nara-wu.ac.jp */
  2.  
  3. #ifndef TOSJIS_def /* for UNIX only */
  4. #  define TOSJIS_def "nkf -s"
  5. #endif
  6.  
  7.  /* please include ctype.h before this file */
  8. #define is_upper(c) (isascii(c) && isupper(c))
  9. #define is_alpha(c) (isascii(c) && isalpha(c))
  10. #define is_space(c) (isascii(c) && isspace(c))
  11. #define is_digit(c) (isascii(c) && isdigit(c))
  12. #ifndef iskanji
  13. #  define iskanji(c) \
  14.     (0x81 <= (unsigned)(c) && (unsigned)(c) <= 0x9f || \
  15.      0xe0 <= (unsigned)(c) && (unsigned)(c) <= 0xfc)
  16. #endif
  17.  
  18. #ifdef UNIX
  19. #  define isdelim(c) ((c) == '/')
  20. #  define isdrvmk(c) 0
  21. #  define DELIM    "/"
  22. #else
  23. #  define isdelim(c) ((c) == '\\' || (c) == '/')
  24. #  define isdrvmk(c) ((c) == ':')
  25. #  define DELIM    "\\"
  26. #endif
  27. #define isDelim(c) (isdelim(c) || isdrvmk(c))
  28.  
  29. #ifndef max
  30. #  define max(a, b) ((a) < (b) ? (b) : (a))
  31. #endif
  32.  
  33. #define dosname(s) nameconv((s), 1)
  34. #define unixname(s) nameconv((s), 0)
  35.  
  36. extern    char    *malloc(), *calloc(), *realloc();
  37. extern    char    *getenv();
  38. extern    char    *strcpy(), *strncpy();
  39. extern    int    errno;
  40.  
  41. #ifdef UNIX
  42. #  define dstatic
  43. #else
  44. #  define dstatic static
  45. #endif
  46. #ifndef SETARGS_MAIN
  47. #  define public extern
  48. #else
  49. #  define public
  50. #endif
  51. public    char    *nameconv(), *emalloc();
  52. public    void    setargs();
  53. #ifdef UNIX
  54. public    FILE    *piperdopen();
  55. #endif
  56.  
  57. #if defined(MSC4) || defined(__TURBOC__)
  58. struct    find_t {
  59.     char    reserved[21], attrib;
  60.     short    wr_time, wr_date;
  61.     long    size;
  62.     char    name[13]; /* total 43bytes */
  63. };
  64. #endif
  65. #define DTASIZE    128
  66.  
  67. #define execrdopen(cmd, av) piperdopen((cmd), (av), NULL)
  68.