home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / apple2 / 26763 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  10.5 KB

  1. Xref: sparky comp.sys.apple2:26763 comp.binaries.apple2:1975
  2. Path: sparky!uunet!wupost!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsm!cbnewsl!att-out!pacbell.com!charon.amdahl.com!amdahl!fadden
  3. From: fadden@uts.amdahl.com (Andy McFadden)
  4. Newsgroups: comp.sys.apple2,comp.binaries.apple2
  5. Subject: NuLib v3.24
  6. Message-ID: <66Fd03Ovc8uE00@amdahl.uts.amdahl.com>
  7. Date: 12 Jan 93 01:09:17 GMT
  8. Reply-To: fadden@amdahl.uts.amdahl.com (Andy McFadden)
  9. Followup-To: comp.sys.apple2
  10. Organization: Amdahl Corporation, Sunnyvale CA
  11. Lines: 319
  12.  
  13. Here's a quick little patch to bring NuLib v3.23 up to v3.24.  Only major
  14. change is better handling of MS-DOS filenames (converts them to xxxxxxxx.yyy
  15. format; NuLib was choking on x.y.z stuff).
  16.  
  17. Well, actually there was a fix to the LZW decoder, but nobody's complained
  18. about it yet, so it's not a major problem. :-)
  19.  
  20.  
  21. --- nublu.c
  22. *** nublu.c    Tue Sep  8 16:10:45 1992
  23. --- ../nublu.c    Mon Jan 11 14:40:35 1993
  24. ***************
  25. *** 92,103 ****
  26.       while ((fname[i] = buf[4+i]) != '\0')
  27.           i++;
  28.       offset = 5+i;  /* how far into file is end of filename? */
  29.       if (verbose) { printf("(as %s)...", fname);  fflush(stdout); }
  30.       }
  31.   
  32. !     len = strlen(fname);
  33.       for (j = 0; j < len; j++)
  34.       fname[j] &= 0x7f;    /* clear hi bits */
  35.   
  36.       if (Exists(fname)) {
  37.       if (interact) {
  38. --- 92,108 ----
  39.       while ((fname[i] = buf[4+i]) != '\0')
  40.           i++;
  41.       offset = 5+i;  /* how far into file is end of filename? */
  42. +     ConvFileName(fname);
  43.       if (verbose) { printf("(as %s)...", fname);  fflush(stdout); }
  44.       }
  45.   
  46. !     ConvFileName(fname);    /* strip hi bits, adjust special chars, etc */
  47. !     len = strlen(fname);    /* (no longer used?) */
  48. ! #ifdef FUBAR
  49.       for (j = 0; j < len; j++)
  50.       fname[j] &= 0x7f;    /* clear hi bits */
  51. + #endif
  52.   
  53.       if (Exists(fname)) {
  54.       if (interact) {
  55.  
  56. --- nucomp.c
  57. *** nucomp.c    Tue Sep  8 16:10:52 1992
  58. --- ../nucomp.c    Mon Dec 21 21:58:37 1992
  59. ***************
  60. *** 333,341 ****
  61.       long srcposn, dstposn;
  62.       static char *procName = "u_compress";
  63.   
  64. !     if ((srcposn = lseek(srcfd, (off_t) 0, S_REL)) < 0)
  65.       Fatal("Bad posn lseek(1)", procName);
  66. !     if ((dstposn = lseek(dstfd, (off_t) 0, S_REL)) < 0)
  67.       Fatal("Bad posn lseek(2)", procName);
  68.   
  69.       src2 = dup(srcfd);
  70. --- 333,341 ----
  71.       long srcposn, dstposn;
  72.       static char *procName = "u_compress";
  73.   
  74. !     if ((srcposn = (long) lseek(srcfd, (off_t) 0, S_REL)) < 0)
  75.       Fatal("Bad posn lseek(1)", procName);
  76. !     if ((dstposn = (long) lseek(dstfd, (off_t) 0, S_REL)) < 0)
  77.       Fatal("Bad posn lseek(2)", procName);
  78.   
  79.       src2 = dup(srcfd);
  80. ***************
  81. *** 348,356 ****
  82.           Fatal("can't fdopen() nustdout", procName);
  83.       setvbuf(nustdin,xbuf,_IOFBF,XBUFSIZE);  /* make the buffers larger */
  84.       setvbuf(nustdout,zbuf,_IOFBF,ZBUFSIZE);    /* (note setvbuf is a macro) */
  85. !     if (fseek(nustdin, srcposn, S_ABS) < 0)    /* seek may not be needed */
  86.       Fatal("Bad stream posn lseek(1)", procName);
  87. !     if (fseek(nustdout, dstposn, S_ABS) < 0)
  88.       Fatal("Bad stream posn lseek(2)", procName);
  89.   
  90.       oldbits = 0;    /* init for putcode() */
  91. --- 348,356 ----
  92.           Fatal("can't fdopen() nustdout", procName);
  93.       setvbuf(nustdin,xbuf,_IOFBF,XBUFSIZE);  /* make the buffers larger */
  94.       setvbuf(nustdout,zbuf,_IOFBF,ZBUFSIZE);    /* (note setvbuf is a macro) */
  95. !     if (fseek(nustdin, (off_t)srcposn, S_ABS) < 0)    /* seek may not be needed */
  96.       Fatal("Bad stream posn lseek(1)", procName);
  97. !     if (fseek(nustdout, (off_t)dstposn, S_ABS) < 0)
  98.       Fatal("Bad stream posn lseek(2)", procName);
  99.   
  100.       oldbits = 0;    /* init for putcode() */
  101. ***************
  102. *** 687,695 ****
  103.       long srcposn, dstposn;
  104.       static char *procName = "u_decompress";
  105.   
  106. !     if ((srcposn = lseek(srcfd, (off_t) 0, S_REL)) < 0)
  107.       Fatal("Bad posn lseek(1)", procName);
  108. !     if ((dstposn = lseek(dstfd, (off_t) 0, S_REL)) < 0)
  109.       Fatal("Bad posn lseek(2)", procName);
  110.   
  111.       src2 = dup(srcfd);
  112. --- 687,695 ----
  113.       long srcposn, dstposn;
  114.       static char *procName = "u_decompress";
  115.   
  116. !     if ((srcposn = (long)lseek(srcfd, (off_t) 0, S_REL)) < 0)
  117.       Fatal("Bad posn lseek(1)", procName);
  118. !     if ((dstposn = (long)lseek(dstfd, (off_t) 0, S_REL)) < 0)
  119.       Fatal("Bad posn lseek(2)", procName);
  120.   
  121.       src2 = dup(srcfd);
  122. ***************
  123. *** 702,710 ****
  124.           Fatal("can't fdopen() nustdout", procName);
  125.       setvbuf(nustdin,zbuf,_IOFBF,ZBUFSIZE);  /* make the buffers larger */
  126.       setvbuf(nustdout,xbuf,_IOFBF,XBUFSIZE); /* (note order diff from comp) */
  127. !     if (fseek(nustdin, srcposn, S_ABS) < 0)    /* seek may not be needed */
  128.       Fatal("Bad stream posn lseek(1)", procName);
  129. !     if (fseek(nustdout, dstposn, S_ABS) < 0)
  130.       Fatal("Bad stream posn lseek(2)", procName);
  131.   
  132.       /* Check the magic number */
  133. --- 702,710 ----
  134.           Fatal("can't fdopen() nustdout", procName);
  135.       setvbuf(nustdin,zbuf,_IOFBF,ZBUFSIZE);  /* make the buffers larger */
  136.       setvbuf(nustdout,xbuf,_IOFBF,XBUFSIZE); /* (note order diff from comp) */
  137. !     if (fseek(nustdin, (off_t)srcposn, S_ABS) < 0)    /* seek may not be needed */
  138.       Fatal("Bad stream posn lseek(1)", procName);
  139. !     if (fseek(nustdout, (off_t)dstposn, S_ABS) < 0)
  140.       Fatal("Bad stream posn lseek(2)", procName);
  141.   
  142.       /* Check the magic number */
  143.  
  144.  
  145. --- nuext.c
  146. *** nuext.c    Tue Sep  8 16:11:15 1992
  147. --- ../nuext.c    Mon Jan 11 14:38:19 1993
  148. ***************
  149. *** 87,93 ****
  150.   #ifdef UNIX
  151.   
  152.       while (*str != '\0') {
  153. !     if ((*str > 127) || (*str < 0)) *str &= 0x7f;  /* clear hi bit */
  154.       if (*str == '/') *str = '.';
  155.       if (++idx > 255) { *str = '\0'; break; }    /* MAXNAMELEN? */
  156.       str++;
  157. --- 87,93 ----
  158.   #ifdef UNIX
  159.   
  160.       while (*str != '\0') {
  161. !     *str &= 0x7f;  /* clear hi bit */
  162.       if (*str == '/') *str = '.';
  163.       if (++idx > 255) { *str = '\0'; break; }    /* MAXNAMELEN? */
  164.       str++;
  165. ***************
  166. *** 98,103 ****
  167. --- 98,104 ----
  168.       "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.";
  169.   
  170.       /* assumes ProDOS limits, not GS/OS */
  171. +     *str &= 0x7f;
  172.       if ( ((*str < 'A') && (*str > 'Z'))  ||  ((*str < 'a') && (*str > 'z')) )
  173.       *str = 'X';  /* must start with alpha char */
  174.       while (*str != '\0') {
  175. ***************
  176. *** 107,120 ****
  177.       }
  178.   # endif /* APW */
  179.   # ifdef MSDOS
  180.       while (*str != '\0') {
  181. !        if ((*str > 127) || (*str < 0)) *str &= 0x7f;  /* clear hi bit */
  182.          if (*str == '/') *str = '_';
  183.          if (*str == '\\') *str = '_';
  184.          if (*str == '!') *str = '_';
  185.          if (*str == ':') *str = '_';
  186.          if (++idx > 255) { *str = '\0'; break; }
  187.          str++;
  188.       }
  189.   # endif /* MSDOS */
  190.   
  191. --- 108,142 ----
  192.       }
  193.   # endif /* APW */
  194.   # ifdef MSDOS
  195. +     char *ostr = str, *prev_dot = NULL;
  196.       while (*str != '\0') {
  197. !        *str &= 0x7f;  /* clear hi bit */
  198.          if (*str == '/') *str = '_';
  199.          if (*str == '\\') *str = '_';
  200.          if (*str == '!') *str = '_';
  201.          if (*str == ':') *str = '_';
  202. +        if (*str == '.') {
  203. +        if (prev_dot != NULL) *prev_dot = '_';
  204. +        prev_dot = str;
  205. +     }
  206.          if (++idx > 255) { *str = '\0'; break; }
  207.          str++;
  208. +     }
  209. +     /* now limit the chars before the '.' to 8, and after to 3 */
  210. +     /* (if no dot, cut it at 8) */
  211. +     if (prev_dot == NULL) {
  212. +     if (strlen(str) > 8) str[8] = '\0';
  213. +     } else {
  214. +     *prev_dot = '\0';
  215. +     if (strlen(prev_dot+1) > 3) *(prev_dot+4) = '\0';
  216. +     if (strlen(ostr) > 8) {
  217. +         *prev_dot = '.';
  218. +         while (*prev_dot)
  219. +         *((ostr++) + 8) = *(prev_dot++);
  220. +         *((ostr++) + 8) = *(prev_dot++);
  221. +     } else
  222. +         *prev_dot = '.';
  223.       }
  224.   # endif /* MSDOS */
  225.   
  226.  
  227. --- numain.c
  228. *** numain.c    Mon Dec  7 15:45:01 1992
  229. --- ../numain.c    Mon Dec 21 21:52:50 1992
  230. ***************
  231. *** 9,15 ****
  232.   #endif
  233.   
  234.   static char *header =
  235. !  "NuLib v3.23  December 1992  Freeware   Copyright 1989-92 By Andy McFadden";
  236.   
  237.   #include "nudefs.h"    /* system-dependent defines */
  238.   #include <stdio.h>    /* standard I/O library */
  239. --- 9,15 ----
  240.   #endif
  241.   
  242.   static char *header =
  243. !  "NuLib v3.24  Januray 1993  Freeware   Copyright 1989-93 By Andy McFadden";
  244.   
  245.   #include "nudefs.h"    /* system-dependent defines */
  246.   #include <stdio.h>    /* standard I/O library */
  247.  
  248. --- nupak.c
  249. *** nupak.c    Tue Sep  8 16:11:25 1992
  250. --- ../nupak.c    Mon Dec 21 21:52:15 1992
  251. ***************
  252. *** 349,356 ****
  253.       maxbits = 16;    /* global compress parameter */
  254.       if (verbose) { printf("compressing...");  fflush(stdout); }
  255.       /* packedSize set by compress() */
  256. !     srcposn = lseek(srcfd, (off_t) 0, S_REL);    /* save posn */
  257. !     dstposn = lseek(dstfd, (off_t) 0, S_REL);
  258.       if (u_compress(srcfd, dstfd, length) == OK) {
  259.           /* compress succeeded */
  260.           retval = 0x0005;
  261. --- 349,356 ----
  262.       maxbits = 16;    /* global compress parameter */
  263.       if (verbose) { printf("compressing...");  fflush(stdout); }
  264.       /* packedSize set by compress() */
  265. !     srcposn = (long) lseek(srcfd, (off_t) 0, S_REL);    /* save posn */
  266. !     dstposn = (long) lseek(dstfd, (off_t) 0, S_REL);
  267.       if (u_compress(srcfd, dstfd, length) == OK) {
  268.           /* compress succeeded */
  269.           retval = 0x0005;
  270.  
  271.  
  272. --- nushk.c
  273. *** nushk.c    Mon Dec  7 15:47:49 1992
  274. --- ../nushk.c    Mon Jan 11 14:33:04 1993
  275. ***************
  276. *** 594,600 ****
  277.   /*    0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,4 };*/
  278.       8,9,10,10,11,11,11,11,12,12,12,12,12,12,12,12,12 };
  279.   
  280. ! static onebyt Stack[100];  /* simulated stack; should be <= 64 */
  281.   static int out_bytes, stack_ptr, entry, at_bit, at_byte;
  282.   static onebyt last_byte;  /* used in get_code */
  283.   static int reset_fix;    /* fix problem unpacking certain LZW-II archives */
  284. --- 594,600 ----
  285.   /*    0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,4 };*/
  286.       8,9,10,10,11,11,11,11,12,12,12,12,12,12,12,12,12 };
  287.   
  288. ! static onebyt *Stack;    /* simulated stack <= 64 for LZW-I, <= 4096 for II */
  289.   static int out_bytes, stack_ptr, entry, at_bit, at_byte;
  290.   static onebyt last_byte;  /* used in get_code */
  291.   static int reset_fix;    /* fix problem unpacking certain LZW-II archives */
  292. ***************
  293. *** 610,617 ****
  294.   #ifdef DEBUG
  295.   # define push(a_byte) \
  296.       { \
  297. !     if (stack_ptr - Stack > 100) { \
  298. !         printf("\n*** stack_ptr exceeded 100 in push() [%d]\n", \
  299.           (int) (stack_ptr - Stack));\
  300.           exit (-1); \
  301.       } \
  302. --- 610,617 ----
  303.   #ifdef DEBUG
  304.   # define push(a_byte) \
  305.       { \
  306. !     if (stack_ptr - Stack > 4096) { \
  307. !         printf("\n*** stack_ptr exceeded 4096 in push() [%d]\n", \
  308.           (int) (stack_ptr - Stack));\
  309.           exit (-1); \
  310.       } \
  311. ***************
  312. *** 891,896 ****
  313. --- 891,899 ----
  314.       fourbyt tmp4;  /* temporary 4-byte variable */
  315.       int cc;
  316.       static char *procName = "unpak_SHK";
  317. +     if (Stack == NULL)
  318. +     Stack = (onebyt *) Malloc(4096);
  319.   
  320.       type2 = use_type2;
  321.   
  322.  
  323. --- END ---
  324.  
  325.  
  326. -- 
  327. fadden@uts.amdahl.com (Andy McFadden)
  328. [ Above opinions are mine, Amdahl has nothing to do with them, etc, etc. ]
  329.