home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / linux / 10738 < prev    next >
Encoding:
Text File  |  1992-09-15  |  5.6 KB  |  190 lines

  1. Path: sparky!uunet!sun-barr!olivea!spool.mu.edu!caen!hellgate.utah.edu!fcom.cc.utah.edu!park.uvcc.edu!ns.novell.com!novdpd!bboerner
  2. From: bboerner@novdpd.uucp (Brendan B. Boerner)
  3. Newsgroups: comp.os.linux
  4. Subject: patch to Pax v1.2
  5. Message-ID: <1992Sep15.135231.29487@novell.com>
  6. Date: 15 Sep 92 13:52:31 GMT
  7. Sender: bboerner@novell.com (Brendan B. Boerner)
  8. Organization: Novell, Inc. --Austin
  9. Lines: 179
  10.  
  11. Hello,
  12.  
  13. Has anyone used pax to write multiple floppy archives?  I'm using 0.97
  14. Pl 5 kernel with a system built using Jim Winstead's boot/root disk set
  15. and am trying this:
  16.  
  17. $ pax -w -v -f /dev/fd0 <some stuff>
  18.  
  19. (also tried /dev/fd0h1200 and /dev/fd0d360 on a 360K disk).  The floppy
  20. runs for a while and then stops and nothing happens.  Data is getting
  21. written because I can do a pax -v -f /dev/fd0 and read the archive - it
  22. gets to the end and asks for the next volume.
  23.  
  24. I got the source from ftp.uu.net and poked around and found that in the
  25. function outflush(), something like this is written:
  26.  
  27. for (...) {
  28.     if ((got = write(...)) > 0) {
  29.         ...
  30.     } else if (got < 0) {
  31.         next archive
  32.     }
  33. }
  34.  
  35. The problem is that the last write to the floppy returns 0 so this just
  36. loops forever.  I checked out write(2) and it did say that write/read
  37. will return 0 on EOF sooooo.... what's different?  Did the defined
  38. return value for write() change since pax was written?
  39.  
  40. I've enclosed a patch which will take Pax v1.2 and modify config.h,
  41. buffer.c and pax.h so that it will compile under Linux with GCC
  42. v2.2.2d.
  43.  
  44. Later,
  45. Brendan
  46. -- 
  47. Brendan B. Boerner        Phone: 512/346-8380
  48. Internet: bboerner@novell.com    MHS: bboerner@novell
  49. Please use ^^^^^^^^^^^^^^^^^ if replying by mail.
  50.  
  51.  
  52. This is a patch for Pax v1.2 for Linux and fixes one bug.  To get
  53. Pax source, get it from
  54. ftp.uu.net:archive/usenet/comp.sources.unix/volume17/pax.  Apply the
  55. three patchs that are in that directory before applying this patch.
  56.  
  57. Brendan
  58. bboerner@novell.com
  59. 92/09/15
  60.  
  61. diff +unified pax/buffer.c pax.lin/buffer.c
  62. --- pax/buffer.c    Mon Sep 14 22:27:28 1992
  63. +++ pax.lin/buffer.c    Mon Sep 14 22:00:15 1992
  64. @@ -115,7 +115,11 @@
  65.      Link           *linkp;
  66.      int             ifd;
  67.      int             ofd;
  68. +#ifdef LINUX
  69. +    struct utimbuf  tstamp;
  70. +#else
  71.      time_t          tstamp[2];
  72. +#endif
  73.  
  74.      if ((ofd = openout(name, asb, linkp = linkfrom(name, asb), 0)) > 0) {
  75.      if (asb->sb_size || linkp == (Link *)NULL || linkp->l_size == 0) {
  76. @@ -130,9 +134,15 @@
  77.      } else {
  78.      return(buf_skip((OFFSET) asb->sb_size) >= 0);
  79.      }
  80. +#ifdef LINUX
  81. +    tstamp.actime = (!f_pass && f_access_time) ? asb->sb_atime : time((time_t *) 0);
  82. +    tstamp.modtime = f_mtime ? asb->sb_mtime : time((time_t *) 0);
  83. +    utime(name, &tstamp);
  84. +#else
  85.      tstamp[0] = (!f_pass && f_access_time) ? asb->sb_atime : time((time_t *) 0);
  86.      tstamp[1] = f_mtime ? asb->sb_mtime : time((time_t *) 0);
  87.      utime(name, tstamp);
  88. +#endif
  89.      return (0);
  90.  }
  91.  
  92. @@ -583,7 +593,7 @@
  93.      for (buf = bufstart; len = bufidx - buf;) {
  94.          if ((got = write(archivefd, buf, MIN(len, blocksize))) > 0) {
  95.          buf += got;
  96. -        } else if (got < 0) {
  97. +        } else if (got <= 0) {
  98.          next(AR_WRITE);
  99.          }
  100.      }
  101. diff +unified pax/config.h pax.lin/config.h
  102. --- pax/config.h    Mon Sep 14 22:27:28 1992
  103. +++ pax.lin/config.h    Mon Sep 14 22:18:08 1992
  104. @@ -45,7 +45,7 @@
  105.   * Defining XENIX_286 will automatically define USG.
  106.   *
  107.   */
  108. -#define XENIX_286    /* Running on a XENIX 286 system */
  109. +/* #define XENIX_286    /* Running on a XENIX 286 system */
  110.  
  111.  /*
  112.   * USG - USG (Unix System V) specific modifications
  113. @@ -52,9 +52,16 @@
  114.   *
  115.   * Define USG if you are running Unix System V or some similar variant
  116.   */
  117. -#define USG     /* Running on a USG System */
  118. +/* #define USG     /* Running on a USG System */
  119.  
  120.  /*
  121. + * LINUX - Linux v0.97
  122. + *
  123. + * Also define BSD.
  124. + */
  125. +#define LINUX    /* Running on a Linux system */
  126. +
  127. +/*
  128.   * BSD - BSD (Berkely) specific modifications
  129.   *
  130.   * Define BSD if you are running some version of BSD Unix
  131. @@ -128,8 +135,8 @@
  132.   * Some systems have signal defines to return an int *, other return a
  133.   * void *.  Please choose the correct value for your system.
  134.   */
  135. -/* #define SIG_T    void    /* signal defined as "void (*signal)()" */
  136. -#define SIG_T    int    /* signal defined as "int (*signal)()" */
  137. +#define SIG_T    void    /* signal defined as "void (*signal)()" */
  138. +/* #define SIG_T    int    /* signal defined as "int (*signal)()" */
  139.  
  140.  /*
  141.   * STRCSPN - use the strcspn function included with pax
  142. @@ -147,7 +154,7 @@
  143.   * For those system define STRERROR and the one provided in misc.c will 
  144.   * be used instead.
  145.   */
  146. -#define STRERROR    /* implementation does not have strerror() */
  147. +/* #define STRERROR    /* implementation does not have strerror() */
  148.  
  149.  /*
  150.  
  151. @@ -176,3 +183,4 @@
  152.  #endif /* XENIX_286 */
  153.  
  154.  #endif /* _PAX_CONFIG_H */
  155. +
  156. diff +unified pax/pax.h pax.lin/pax.h
  157. --- pax/pax.h    Mon Sep 14 22:27:30 1992
  158. +++ pax.lin/pax.h    Mon Sep 14 18:19:50 1992
  159. @@ -41,6 +41,9 @@
  160.  #include <errno.h>
  161.  #include <signal.h>
  162.  #include <ctype.h>
  163. +#ifdef LINUX
  164. +#include <utime.h>
  165. +#endif
  166.  #include <sys/types.h>
  167.  #include <sys/ioctl.h>
  168.  #include <sys/stat.h>
  169. @@ -361,7 +364,7 @@
  170.  extern char    *optarg;
  171.  extern int      optind;
  172.  extern int      sys_nerr;
  173. -extern char    *sys_errlist[];
  174. +/* extern char    *sys_errlist[]; */
  175.  extern int      errno;
  176.  
  177.  #endif /* _PAX_H */
  178. diff +unified pax/port.h pax.lin/port.h
  179. --- pax/port.h    Mon Sep 14 22:27:32 1992
  180. +++ pax.lin/port.h    Mon Sep 14 17:52:27 1992
  181. @@ -70,7 +70,7 @@
  182.  extern char *bcopy(char *, char *, unsigned int);
  183.  extern char *bzero(char *, unsigned int);
  184.  extern char *strcat(char *, char *);
  185. -extern char *strcpy(char *, char *);
  186. +/* extern char *strcpy(char *, char *); */
  187.  #  else /* !__STDC__ */
  188.  extern char *rindex();
  189.  extern char *index();
  190.