home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / FREEZE-2.ZIP / patches.os2 < prev    next >
Text File  |  1992-07-18  |  13KB  |  493 lines

  1. diff -c orig/encode.c new/encode.c
  2. *** orig/encode.c    Tue Jun 02 11:35:58 1992
  3. --- new/encode.c    Tue Jun 02 13:35:44 1992
  4. ***************
  5. *** 175,181 ****
  6.       fprintf( stderr, "\tSymbols: %ld; references: %ld.\n",
  7.           symbols_out, refers_out);
  8.   #else /* !DEBUG */
  9. !     fprintf( stderr, "Freezing: " );
  10.       prratio( stderr, in_count-bytes_out, in_count );
  11.       prbits( stderr, in_count, bytes_out);
  12.   #endif /* DEBUG */
  13. --- 175,181 ----
  14.       fprintf( stderr, "\tSymbols: %ld; references: %ld.\n",
  15.           symbols_out, refers_out);
  16.   #else /* !DEBUG */
  17. !     fprintf( stderr, " Freezing: " );
  18.       prratio( stderr, in_count-bytes_out, in_count );
  19.       prbits( stderr, in_count, bytes_out);
  20.   #endif /* DEBUG */
  21. diff -c orig/freeze.c new/freeze.c
  22. *** orig/freeze.c    Tue Jun 02 11:36:14 1992
  23. --- new/freeze.c    Tue Jun 02 13:44:08 1992
  24. ***************
  25. *** 45,63 ****
  26.   #ifdef DEBUG
  27.   
  28.   # ifdef DOS
  29. !     fprintf(stderr,"Usage: freeze [-cdDfitvVg] [file | +type ...]\n");
  30.   # else
  31. !     fprintf(stderr,"Usage: freeze [-cdDfvVg] [file | +type ...]\n");
  32.   # endif /* DOS */
  33.   
  34.   #else
  35.   
  36.   # ifdef DOS
  37. !     fprintf(stderr,"Usage: freeze [-cdfitvVg] [file | +type ...]\n");
  38.   # else
  39. !     fprintf(stderr,"Usage: freeze [-cdfvVg] [file | +type ...]\n");
  40.   # endif /* DOS */
  41.   
  42.   #endif /* DEBUG */
  43.   }
  44.   
  45. --- 45,76 ----
  46.   #ifdef DEBUG
  47.   
  48.   # ifdef DOS
  49. !     fprintf(stderr,"\nUsage: freeze [-cdDfitvVg] [file | +type ...]\n");
  50.   # else
  51. !     fprintf(stderr,"\nUsage: freeze [-cdDfvVg] [file | +type ...]\n");
  52.   # endif /* DOS */
  53.   
  54.   #else
  55.   
  56.   # ifdef DOS
  57. !     fprintf(stderr,"\nUsage: freeze [-cdfitvVg] [file | +type ...]\n");
  58.   # else
  59. !     fprintf(stderr,"\nUsage: freeze [-cdfvVg] [file | +type ...]\n");
  60.   # endif /* DOS */
  61.   
  62. +     fprintf(stderr, "\n\
  63. +       -c         Write output on stdout, don't remove original.\n\
  64. +       -d         If given, melting is done instead.\n\
  65. +       -g         Use \"greedy\" parsing (1.5% worse, 40% faster).\n\
  66. +       -f         Forces output file to be generated, even if one already\n\
  67. +                  exists, and even if no space is saved by freezeing.\n\
  68. +       -i         Image mode.\n\
  69. +       -t         Text mode.\n\
  70. +       -v         Write freezing statistics. -vv means \"draw progress\n\
  71. +                  indicator\".\n\
  72. +       -V         Write version and compilation options.\n\
  73. + ");
  74.   #endif /* DEBUG */
  75.   }
  76.   
  77. ***************
  78. *** 99,104 ****
  79. --- 112,120 ----
  80.   long indc_count, indc_threshold;
  81.   long file_length = 0;   /* initial length of file */
  82.   
  83. + char IOoutbuf[32768];
  84. + char IOinbuf[32768];
  85.   SIGTYPE (*bgnd_flag)();
  86.   
  87.   void writeerr(), copystat(), version(), tune_table();
  88. ***************
  89. *** 158,164 ****
  90.   /* From compress.c. Replace .Z --> .F etc */
  91.   
  92.   void main( argc, argv )
  93. ! register int argc; char **argv;
  94.   {
  95.       short overwrite = 0;  /* Do not overwrite unless given -f flag */
  96.       char tempname[100];
  97. --- 174,180 ----
  98.   /* From compress.c. Replace .Z --> .F etc */
  99.   
  100.   void main( argc, argv )
  101. ! int argc; char **argv;
  102.   {
  103.       short overwrite = 0;  /* Do not overwrite unless given -f flag */
  104.       char tempname[100];
  105. ***************
  106. *** 183,188 ****
  107. --- 199,208 ----
  108.       extern SIGTYPE oops();
  109.   #endif
  110.   
  111. + #ifdef __EMX__
  112. +     _wildcard(&argc, &argv);
  113. + #endif
  114.   #ifndef DOS
  115.       if ( (bgnd_flag = signal ( SIGINT, SIG_IGN )) != SIG_IGN )
  116.   #endif
  117. ***************
  118. *** 217,222 ****
  119. --- 237,247 ----
  120.   #endif
  121.       }
  122.   
  123. +     if (argc == 1 && isatty(0)) {
  124. +       Usage();
  125. +       exit(0);
  126. +     }
  127.   #ifdef DOS
  128.   /* use case-insensitive match: parent may not be command.com */
  129.   #ifdef MSDOS
  130. ***************
  131. *** 249,263 ****
  132.   #ifndef DOS
  133.       (void) defopen(deffile);
  134.   #else
  135.       cp = strrchr(cp, '.');
  136.       *++cp = 'C';
  137.       *++cp = 'N';
  138.       *++cp = 'F';
  139.       *++cp = '\0';
  140. - #ifdef TOS
  141.       (void) defopen(argv0);
  142.   #else
  143.       (void) defopen(argv[0]);
  144.   #endif  /* TOS */
  145.   #endif  /* DOS */
  146. --- 274,291 ----
  147.   #ifndef DOS
  148.       (void) defopen(deffile);
  149.   #else
  150. + #ifdef TOS
  151.       cp = strrchr(cp, '.');
  152.       *++cp = 'C';
  153.       *++cp = 'N';
  154.       *++cp = 'F';
  155.       *++cp = '\0';
  156.       (void) defopen(argv0);
  157.   #else
  158. +     char config[MAXNAMLEN];
  159. +     _searchenv("freeze.cnf", "INIT", config);
  160. +     if (config[0] == 0)
  161. +       _searchenv("freeze.cnf", "PATH", config);
  162.       (void) defopen(argv[0]);
  163.   #endif  /* TOS */
  164.   #endif  /* DOS */
  165. ***************
  166. *** 367,377 ****
  167. --- 395,415 ----
  168.               /* pseudo-extension: FOOBAR. */
  169.               (void) strcat(tempname, "F");
  170.               else {
  171. + #ifdef OS2
  172. +                         (void) strcat(tempname, ".F");
  173. +                         if (!IsFileNameValid(tempname)) {
  174. +                 tail[0] = cp[1];
  175. +                 tail[1] = cp[2];
  176. +                 *(++cp) = '\0';
  177. +                 (void) strcat(tempname, "XF");
  178. +                         }
  179. + #else
  180.               /* cp now points to file extension */
  181.               tail[0] = cp[1];        /* save two chars */
  182.               tail[1] = cp[2];
  183.               *(++cp) = '\0';
  184.               (void) strcat(tempname, "XF");
  185. + #endif
  186.               }
  187.               *fileptr = tempname;
  188.           }
  189. ***************
  190. *** 399,404 ****
  191. --- 437,444 ----
  192.               perror(*fileptr); continue;
  193.           }
  194.   
  195. +                 setvbuf(stdin, IOinbuf, _IOFBF, sizeof(IOinbuf));
  196. +                 
  197.           /* Check the magic number */
  198.           if (getchar() != MAGIC1)
  199.               goto reject;
  200. ***************
  201. *** 456,464 ****
  202. --- 496,507 ----
  203.               perror(*fileptr); continue;
  204.           }
  205.   
  206. +                 setvbuf(stdin, IOinbuf, _IOFBF, sizeof(IOinbuf));
  207. +                 
  208.           /* Generate output filename */
  209.           (void) strcpy(ofname, *fileptr);
  210.   #ifndef BSD     /* Short filenames */
  211. + #ifndef OS2
  212.           if ((cp = last_sep(ofname)) != NULL) cp++;
  213.           else cp = ofname;
  214.   # ifdef DOS
  215. ***************
  216. *** 472,478 ****
  217.               continue;
  218.           }
  219.   # endif /* DOS */
  220. ! #endif  /* BSD               Long filenames allowed */
  221.   
  222.   #ifdef DOS
  223.           /* There is no difference between FOOBAR and FOOBAR. names */
  224. --- 515,522 ----
  225.               continue;
  226.           }
  227.   # endif /* DOS */
  228. ! #endif /* OS2 */
  229. ! #endif /* BSD               Long filenames allowed */
  230.   
  231.   #ifdef DOS
  232.           /* There is no difference between FOOBAR and FOOBAR. names */
  233. ***************
  234. *** 482,489 ****
  235. --- 526,541 ----
  236.               /* FOOBAR. case */
  237.               (void) strcat(ofname, "F");
  238.           else {
  239. + #ifdef OS2
  240. +             (void) strcat(ofname, ".F");
  241. +             if (!IsFileNameValid(ofname)) {
  242. +                   cp[2] = '\0';
  243. +                 (void) strcat(ofname, "XF");
  244. +             }
  245. + #else
  246.               cp[2] = '\0';
  247.               (void) strcat(ofname, "XF");
  248. + #endif
  249.           }
  250.   #else
  251.           (void) strcat(ofname, ".F");
  252. ***************
  253. *** 549,554 ****
  254. --- 601,608 ----
  255.               setmode(fileno(stdout), O_BINARY);
  256.   #endif
  257.           }
  258. +             setvbuf(stdout, IOoutbuf, _IOFBF, sizeof(IOoutbuf));
  259. +             
  260.           /* Actually do the freezing/melting */
  261.           if (do_melt == 0)
  262.           freeze();
  263. ***************
  264. *** 709,714 ****
  265. --- 763,769 ----
  266.       if (_osmajor < 3) freopen("CON","at",stdout); else      /* MS-DOS 2.xx bug */
  267.   #endif
  268.   
  269. +     (void) fclose(stdin);
  270.       (void) fclose(stdout);
  271.   
  272.       if (exit_stat == 2 && (!force)) { /* No freezing: remove file.F */
  273. Only in new: freeze.exe
  274. diff -c orig/freeze.h new/freeze.h
  275. *** orig/freeze.h    Tue Jun 02 11:36:14 1992
  276. --- new/freeze.h    Tue Jun 02 13:14:14 1992
  277. ***************
  278. *** 3,13 ****
  279.   #ifdef SUN4
  280.   #include <sys/stdtypes.h>
  281.   #else   /* SUN4 */
  282. ! # ifndef getc
  283.   #   define getc(p)         (--(p)->_cnt < 0 ? _filbuf(p) : (int) *(p)->_ptr++)
  284. ! # endif
  285. ! # ifndef putc
  286.   #   define putc(x, p)      (--(p)->_cnt < 0 ? _flsbuf((unsigned char) (x), (p)) : (int) (*(p)->_ptr++ = (unsigned char) (x)))
  287.   # endif
  288.   #endif  /* SUN4 */
  289.   
  290. --- 3,15 ----
  291.   #ifdef SUN4
  292.   #include <sys/stdtypes.h>
  293.   #else   /* SUN4 */
  294. ! # ifndef __EMX__
  295. ! #  ifndef getc
  296.   #   define getc(p)         (--(p)->_cnt < 0 ? _filbuf(p) : (int) *(p)->_ptr++)
  297. ! #  endif
  298. ! #  ifndef putc
  299.   #   define putc(x, p)      (--(p)->_cnt < 0 ? _flsbuf((unsigned char) (x), (p)) : (int) (*(p)->_ptr++ = (unsigned char) (x)))
  300. + #  endif
  301.   # endif
  302.   #endif  /* SUN4 */
  303.   
  304. ***************
  305. *** 41,47 ****
  306.   #ifdef UTIMES
  307.   #include <sys/time.h>
  308.   #else
  309. ! #include <utime.h>      /* Some systems have sys/utime.h instead of this */
  310.   #endif /* UTIMES */
  311.   #else
  312.   #ifdef M_XENIX
  313. --- 43,49 ----
  314.   #ifdef UTIMES
  315.   #include <sys/time.h>
  316.   #else
  317. ! #include <sys/utime.h>      /* Some systems have sys/utime.h instead of utime.h */
  318.   #endif /* UTIMES */
  319.   #else
  320.   #ifdef M_XENIX
  321. Only in new: isvalid.c
  322. diff -c orig/makefile new/makefile
  323. *** orig/makefile    Tue Jun 02 11:36:14 1992
  324. --- new/makefile    Tue Jun 02 13:30:08 1992
  325. ***************
  326. *** 1,4 ****
  327. ! SHELL         = /bin/sh
  328.   
  329.   default:
  330.       @echo ''
  331. --- 1,5 ----
  332. ! # SHELL         = /bin/sh
  333. ! # MAKEFILE      = makefile
  334.   
  335.   default:
  336.       @echo ''
  337. ***************
  338. *** 18,24 ****
  339.           lz.h\
  340.           patchlevel.h
  341.   
  342. ! CC            = gcc -fstrength-reduce
  343.   # or proprietary compiler, if it's better than that
  344.   
  345.   OPTIONS       = -DCOMPAT
  346. --- 19,25 ----
  347.           lz.h\
  348.           patchlevel.h
  349.   
  350. ! CC            = gcc
  351.   # or proprietary compiler, if it's better than that
  352.   
  353.   OPTIONS       = -DCOMPAT
  354. ***************
  355. *** 26,33 ****
  356.   LINTFLAGS     = -DBITS=15 -DSIGTYPE=void -DCOMPAT -DDEBUG\
  357.           -DGATHER_STAT -x -DFAST
  358.   
  359. - MAKEFILE      = makefile
  360.   OBJS          = bitio.o\
  361.           debug.o\
  362.           decode.o\
  363. --- 27,32 ----
  364. ***************
  365. *** 60,66 ****
  366.   .c.o:
  367.           $(CC) -c $(CFLAGS) $(OPTIONS) $<
  368.   
  369. ! prog:            $(PROGRAM) statist
  370.   
  371.   man:            $(CATMAN)
  372.   
  373. --- 59,65 ----
  374.   .c.o:
  375.           $(CC) -c $(CFLAGS) $(OPTIONS) $<
  376.   
  377. ! prog:            $(PROGRAM)$(EXE) statist$(EXE)
  378.   
  379.   man:            $(CATMAN)
  380.   
  381. ***************
  382. *** 67,77 ****
  383.   lint:           $(SRCS)
  384.           lint $(LINTFLAGS) $(SRCS) > lint.out
  385.   
  386. ! $(PROGRAM):     $(OBJS)
  387. !         $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM)
  388.   
  389. ! statist: statist.o lz.o
  390. !         $(CC) $(CFLAGS) $(LDFLAGS) -o statist statist.o lz.o $(LIBS)
  391.   
  392.   clobber:        clean
  393.           rm -f $(PROGRAM) statist *.man
  394. --- 66,76 ----
  395.   lint:           $(SRCS)
  396.           lint $(LINTFLAGS) $(SRCS) > lint.out
  397.   
  398. ! $(PROGRAM)$(EXE): $(OBJS)
  399. !         $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM)$(EXE)
  400.   
  401. ! statist$(EXE): statist.o lz.o
  402. !         $(CC) $(CFLAGS) $(LDFLAGS) -o statist$(EXE) statist.o lz.o $(LIBS)
  403.   
  404.   clobber:        clean
  405.           rm -f $(PROGRAM) statist *.man
  406. ***************
  407. *** 110,136 ****
  408.           chmod +r $@
  409.   
  410.   bsd:
  411. !         make prog CFLAGS="-O -DBSD -DUTIMES -DBITS=16\
  412.           -DFAST -DSIGTYPE=void"
  413.   
  414.   sysv:
  415. !         make prog CFLAGS="-O -DBITS=16 -DFAST -DSIGTYPE=void"\
  416.           LIBS="-lc_s"
  417.   
  418.   x286:
  419. !         make prog CC=cc CFLAGS="-Ox -Mc2 -DBITS=16 -DFAST\
  420.           -DSIGTYPE=int"
  421.   
  422.   x286install:
  423. !         make install MANDEST=/usr/man/man.C SEC=C
  424.   
  425.   generic:
  426. !         make prog CFLAGS="-O -DBITS=16 -DFAST -DSIGTYPE=int"
  427.   
  428.   sun4:
  429. !         make prog CC=cc CFLAGS="-O4 -DBSD -DSUN4 -DSIGTYPE=void\
  430.           -DUTIMES -DBITS=16 -DFAST"
  431.   
  432.   ###
  433.   bitio.o: freeze.h compat.h bitio.h
  434.   debug.o: freeze.h compat.h huf.h bitio.h
  435. --- 109,140 ----
  436.           chmod +r $@
  437.   
  438.   bsd:
  439. !         $(MAKE) prog CFLAGS="-O -DBSD -DUTIMES -DBITS=16\
  440.           -DFAST -DSIGTYPE=void"
  441.   
  442.   sysv:
  443. !         $(MAKE) prog CFLAGS="-O -DBITS=16 -DFAST -DSIGTYPE=void"\
  444.           LIBS="-lc_s"
  445.   
  446.   x286:
  447. !         $(MAKE) prog CC=cc CFLAGS="-Ox -Mc2 -DBITS=16 -DFAST\
  448.           -DSIGTYPE=int"
  449.   
  450.   x286install:
  451. !         $(MAKE) install MANDEST=/usr/man/man.C SEC=C
  452.   
  453.   generic:
  454. !         $(MAKE) prog CFLAGS="-O -DBITS=16 -DFAST -DSIGTYPE=int"
  455.   
  456.   sun4:
  457. !         $(MAKE) prog CC=cc CFLAGS="-O4 -DBSD -DSUN4 -DSIGTYPE=void\
  458.           -DUTIMES -DBITS=16 -DFAST"
  459.   
  460. + os2:
  461. +         $(MAKE) prog CFLAGS="-O2 -s -DOS2 -DMSDOS -DBITS=16\
  462. +         -DFAST -DSIGTYPE=void" EXE=".exe" OBJS="$(OBJS) isvalid.o"\
  463. +         LIBS="-los2"
  464.   ###
  465.   bitio.o: freeze.h compat.h bitio.h
  466.   debug.o: freeze.h compat.h huf.h bitio.h
  467. ***************
  468. *** 137,143 ****
  469.   decode.o: freeze.h compat.h huf.h bitio.h
  470.   default.o: freeze.h compat.h
  471.   encode.o: freeze.h compat.h lz.h huf.h bitio.h
  472. ! freeze.o: freeze.h compat.h lz.h huf.h patchlevel.h
  473.   huf.o: freeze.h compat.h huf.h bitio.h
  474.   lz.o: freeze.h compat.h lz.h
  475.   statist.o: freeze.h compat.h lz.h
  476. --- 141,147 ----
  477.   decode.o: freeze.h compat.h huf.h bitio.h
  478.   default.o: freeze.h compat.h
  479.   encode.o: freeze.h compat.h lz.h huf.h bitio.h
  480. ! freeze.o: freeze.h compat.h lz.h huf.h
  481.   huf.o: freeze.h compat.h huf.h bitio.h
  482.   lz.o: freeze.h compat.h lz.h
  483.   statist.o: freeze.h compat.h lz.h
  484. Only in new: patches.os2
  485. Only in new: statist.exe
  486.