home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / compress / zoosrc20.zoo / generic.c < prev    next >
C/C++ Source or Header  |  1989-07-25  |  3KB  |  139 lines

  1. #ifndef LINT
  2. static char genericid[]="@(#) generic.c 2.2 88/01/24 12:44:03";
  3. #endif /* LINT */
  4.  
  5. /* 
  6. Generic template for machine-dependent functions.
  7.  
  8. The contents of this file are hereby released to the public domain
  9.  
  10.                                             -- Rahul Dhesi 1988/01/24
  11.  
  12. Functions in this file have not yet been revised to work with zoo 
  13. version 2.0.  To port zoo to a new system, look in files sysv.c and bsd.c 
  14. to see which system-dependent functions may be needed.
  15. */
  16.  
  17. /****************
  18. function trunc() truncates a file.
  19. */
  20.  
  21. int trunc (handle)
  22. int handle;
  23. {
  24.    /* code to truncate file goes here -- may be left empty */
  25. }
  26.  
  27. /*****************
  28. Function gettime() or getutime() gets the date and time of the file handle 
  29. or filename supplied.  Date and time is in MSDOS format.
  30. */
  31. #ifdef GETUTIME
  32. getutime (fname, date, time)
  33. char *fname;
  34. #else
  35. gettime (handle,date,time)
  36. int handle;
  37. #endif
  38. unsigned *date, *time;
  39. {
  40.    *date = *time = 0; /* not yet implemented */
  41. }
  42.  
  43. /*****************
  44. Function settime() or setutime() sets the date and time of the file handle
  45. or filename supplied.  Date and time is in MSDOS format.
  46. */
  47. #ifdef NIXTIME
  48. int setutime(path,date,time)
  49. char *path;
  50. #else
  51. int settime(handle, date, time)
  52. int handle;
  53. #endif
  54. unsigned int date, time;
  55. {
  56.    /* not yet implemented */
  57. }
  58.  
  59. /*****************
  60. Function mktemp() accepts a template of the form `baseXXXXXX' where
  61. base is an arbitrary string, and returns a unique temporary filename.
  62. If template is not correct, it is returned unchanged.
  63. */
  64. char *mktemp(template)
  65. char *template;
  66. {
  67. #ifndef NDEBUG
  68.    if (instr(template, "XXXXXX") == -1)
  69.       prterror ('w', "Incorrect template [%s] supplied to mktemp().\n",
  70.          template);
  71. #endif
  72.  
  73.    strcpy(&template[instr(template, "XXXXXX")],"z.@@@");
  74.    return (template);
  75. }
  76.  
  77. /*****************
  78. Function isadir() or isuadir() returns 1 if supplied handle or 
  79. filename is a directory or other special file that should not be 
  80. archived, else it returns 0.
  81. */
  82.  
  83. #ifdef CHEKDIR
  84. int isadir(han)
  85. int han;
  86. {
  87.    return (0); /* by default assume never a directory */
  88. }
  89. #endif
  90.  
  91. #ifdef CHEKUDIR
  92. int isuadir(path)
  93. char *path;
  94. {
  95.    return (0); /* by default assume never a directory */
  96. }
  97. #endif
  98.  
  99. /****************
  100. Function fixfname() converts the supplied filename to a syntax
  101. legal for the host system.  It is used during extraction to make sure
  102. that a file can be extracted even if a badly-implemented archiver
  103. stored it with an illegal filename.
  104. */
  105.  
  106. char *fixfname(fname)
  107. char *fname;
  108. {
  109.    return (fname); /* default is no-op */
  110. }
  111.  
  112. /*****************
  113. Function nextfile() is effectively a no-op.  Any wildcard expansion 
  114. must have been done before Zoo receives the arguments.
  115. */
  116.  
  117. #define FMAX 1
  118. char *nextfile (what, filespec, fileset)
  119. int what;                        /* whether to initialize or match      */
  120. register char *filespec;         /* filespec to match if initializing   */
  121. register int fileset;            /* which set of files                  */
  122. {
  123.    static int first_time [FMAX+1];
  124.    static char saved_fspec [FMAX+1][PATHSIZE];  /* our own copy of filespec */
  125.  
  126.    if (what == 0) {
  127.       strcpy (saved_fspec[fileset], filespec);  /* save the filespec */
  128.       first_time[fileset] = 1;
  129.       return (NULL);
  130.    }
  131.  
  132.    if (first_time[fileset]) {
  133.       first_time[fileset] = 0;
  134.       return (saved_fspec[fileset]);
  135.    } else {
  136.       return (NULL);
  137.    }
  138. }
  139.