home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume20 / delete / patch14 next >
Encoding:
Text File  |  1991-06-05  |  22.0 KB  |  826 lines

  1. Newsgroups: comp.sources.misc
  2. From: Jonathan I. Kamens <jik@Athena.MIT.EDU>
  3. Subject:  v20i042:  MIT Athena delete/undelete programs, Patch14
  4. Message-ID: <1991Jun5.183821.15121@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: bb5910928d42ed87c9dab77e32c3325a
  6. Date: Wed, 5 Jun 1991 18:38:21 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Jonathan I. Kamens <jik@Athena.MIT.EDU>
  10. Posting-number: Volume 20, Issue 42
  11. Archive-name: delete/patch14
  12. Patch-To: delete: Volume 17, Issue 23-26,37
  13.  
  14. This patch brings the "delete" package from patchlevel 13 to
  15. patchlevel 14.  Use "patch -p0" in your delete source directory to
  16. apply it.  Several files will change, and one new file (malloc-test.c)
  17. will be created.
  18.  
  19.   This patch accomplishes the following:
  20.  
  21. 1. Lsdel now checks if stdout is a tty; if it is, then output is in
  22.    multi-column format, and if it is not, then output is in
  23.    single-column format.
  24.  
  25. 2. The "-1" and "-C" options have been added to lsdel to allow the
  26.    user to force single-column or multi-colun output, regardless of
  27.    whether or not stdout is a tty.
  28.  
  29. 3. Lsdel now sorts its output.
  30.  
  31. 4. There is better support for machines on which malloc(0) returns
  32.    NULL, and a Makefile rule to test if your machine falls in that
  33.    category.  See the Makefile for more information.
  34.  
  35. 5. There is some fledgling support for dirent instead of direct,
  36.    toggled by the POSIX preprocessor symbol.
  37.  
  38. 6. The Makefile now makes sure to run block-test.sh in the current
  39.    working directory, so "make block-test" will work even if you don't
  40.    have "." in your search path.
  41.  
  42. 7. A missing newline in a message printed by block-test.sh has been
  43.    inserted.
  44.  
  45. 8. Block-test will now do the right thing on machines that have
  46.    fundamental block sizes larger than 512 bytes but still record
  47.    st_blocks in 512 byte increments, as long as the fundamental block
  48.    size is smaller than 4096 bytes (if you work on machine with a
  49.    larger one, please let me know).
  50.  
  51. Jonathan Kamens                          USnail:
  52. MIT Project Athena                11 Ashford Terrace
  53. jik@Athena.MIT.EDU                Allston, MA  02134
  54. Office: 617-253-8085                  Home: 617-782-0710
  55.  
  56. *** /tmp/,RCSt1021382    Tue Jun  4 22:31:27 1991
  57. --- Makefile    Tue Jun  4 22:17:43 1991
  58. ***************
  59. *** 5,11 ****
  60.   #
  61.   #     $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/Makefile,v $
  62.   #     $Author: jik $
  63. ! #     $Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/Makefile,v 1.30 91/03/11 18:40:59 jik Exp $
  64.   #
  65.   
  66.   # If you are compiling on a system that has an st_blocks field in
  67. --- 5,11 ----
  68.   #
  69.   #     $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/Makefile,v $
  70.   #     $Author: jik $
  71. ! #     $Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/Makefile,v 1.32 91/06/04 22:17:28 jik Exp $
  72.   #
  73.   
  74.   # If you are compiling on a system that has an st_blocks field in
  75. ***************
  76. *** 13,18 ****
  77. --- 13,22 ----
  78.   # blocks taken up by the file, add -DUSE_BLOCKS to the DEFINES
  79.   # variable below.  If you don't know whether or not to define it, run
  80.   # "make block-test".
  81. + # 
  82. + # If you are using a system where malloc(0) returns 0 even when it
  83. + # succeeds, then set MALLOC below to -DMALLOC_0_RETURNS_NULL.  If you
  84. + # don't know whether or not to define it, run "make malloc-test".
  85.   
  86.   DESTDIR=
  87.   TARGETS=     delete undelete expunge purge lsdel
  88. ***************
  89. *** 24,30 ****
  90.   DEPEND=        /usr/bin/X11/makedepend
  91.   COMPILE_ET=     compile_et
  92.   LINT=         lint
  93. ! DEFINES=    
  94.   
  95.   
  96.   # These variables apply only if you want this program to recognize
  97. --- 28,35 ----
  98.   DEPEND=        /usr/bin/X11/makedepend
  99.   COMPILE_ET=     compile_et
  100.   LINT=         lint
  101. ! MALLOC=
  102. ! DEFINES=    $(MALLOC)
  103.   
  104.   
  105.   # These variables apply only if you want this program to recognize
  106. ***************
  107. *** 79,85 ****
  108.           man1/undelete.1
  109.   
  110.   ARCHIVE=    README Makefile PATCHLEVEL $(SRCS) $(INCS) $(MANS)\
  111. !         $(ETSRCS) block-test.sh
  112.   ARCHIVEDIRS=     man1
  113.   
  114.   DELETEOBJS=     delete.o util.o delete_errs.o errors.o
  115. --- 84,90 ----
  116.           man1/undelete.1
  117.   
  118.   ARCHIVE=    README Makefile PATCHLEVEL $(SRCS) $(INCS) $(MANS)\
  119. !         $(ETSRCS) block-test.sh malloc-test.c
  120.   ARCHIVEDIRS=     man1
  121.   
  122.   DELETEOBJS=     delete.o util.o delete_errs.o errors.o
  123. ***************
  124. *** 191,197 ****
  125.       $(DEPEND) -v $(CFLAGS) -s'# DO NOT DELETE' $(SRCS)
  126.   
  127.   block-test: block-test.sh
  128. !     CC=$(CC); TMPDIR=$(TMPDIR); export CC TMPDIR; . block-test.sh
  129.   
  130.   $(DELETEOBJS): delete_errs.h
  131.   $(EXPUNGEOBJS): delete_errs.h
  132. --- 196,207 ----
  133.       $(DEPEND) -v $(CFLAGS) -s'# DO NOT DELETE' $(SRCS)
  134.   
  135.   block-test: block-test.sh
  136. !     CC=$(CC); TMPDIR=$(TMPDIR); export CC TMPDIR; . ./block-test.sh
  137. ! malloc-test: malloc-test.c
  138. !     @$(CC) -o malloc-test malloc-test.c
  139. !     @./malloc-test
  140. !     @rm malloc-test
  141.   
  142.   $(DELETEOBJS): delete_errs.h
  143.   $(EXPUNGEOBJS): delete_errs.h
  144. *** /tmp/,RCSt1021382    Tue Jun  4 22:31:29 1991
  145. --- PATCHLEVEL    Tue Jun  4 22:29:44 1991
  146. ***************
  147. *** 1 ****
  148. ! 13
  149. --- 1 ----
  150. ! 14
  151. *** /tmp/,RCSt1021382    Tue Jun  4 22:31:31 1991
  152. --- delete.c    Tue Jun  4 22:07:01 1991
  153. ***************
  154. *** 11,22 ****
  155.    */
  156.   
  157.   #if (!defined(lint) && !defined(SABER))
  158. !      static char rcsid_delete_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/delete.c,v 1.25 91/02/28 18:42:16 jik Exp $";
  159.   #endif
  160.   
  161.   #include <sys/types.h>
  162.   #include <stdio.h>
  163.   #include <sys/dir.h>
  164.   #ifdef SYSV
  165.   #include <string.h>
  166.   #define index strchr
  167. --- 11,27 ----
  168.    */
  169.   
  170.   #if (!defined(lint) && !defined(SABER))
  171. !      static char rcsid_delete_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/delete.c,v 1.26 91/06/04 22:06:55 jik Exp $";
  172.   #endif
  173.   
  174.   #include <sys/types.h>
  175.   #include <stdio.h>
  176. + #ifdef POSIX
  177. + #include <dirent.h>
  178. + #define direct dirent
  179. + #else
  180.   #include <sys/dir.h>
  181. + #endif
  182.   #ifdef SYSV
  183.   #include <string.h>
  184.   #define index strchr
  185. *** /tmp/,RCSt1021382    Tue Jun  4 22:31:33 1991
  186. --- undelete.c    Tue Jun  4 22:07:34 1991
  187. ***************
  188. *** 11,22 ****
  189.    */
  190.   
  191.   #if (!defined(lint) && !defined(SABER))
  192. !      static char rcsid_undelete_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/undelete.c,v 1.23 91/02/28 18:44:00 jik Exp $";
  193.   #endif
  194.   
  195.   #include <stdio.h>
  196.   #include <sys/types.h>
  197.   #include <sys/dir.h>
  198.   #include <sys/param.h>
  199.   #ifdef SYSV
  200.   #include <string.h>
  201. --- 11,27 ----
  202.    */
  203.   
  204.   #if (!defined(lint) && !defined(SABER))
  205. !      static char rcsid_undelete_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/undelete.c,v 1.24 91/06/04 22:07:21 jik Exp $";
  206.   #endif
  207.   
  208.   #include <stdio.h>
  209.   #include <sys/types.h>
  210. + #ifdef POSIX
  211. + #include <dirent.h>
  212. + #define direct dirent
  213. + #else
  214.   #include <sys/dir.h>
  215. + #endif
  216.   #include <sys/param.h>
  217.   #ifdef SYSV
  218.   #include <string.h>
  219. ***************
  220. *** 267,273 ****
  221.        int retval;
  222.        
  223.        filelist = (listrec *) Malloc((unsigned) (sizeof(listrec) * num));
  224. !      if (! filelist) {
  225.         set_error(errno);
  226.         error("process_files");
  227.         return error_code;
  228. --- 272,283 ----
  229.        int retval;
  230.        
  231.        filelist = (listrec *) Malloc((unsigned) (sizeof(listrec) * num));
  232. ! #ifdef MALLOC_0_RETURNS_NULL
  233. !      if ((! filelist) && num)
  234. ! #else
  235. !      if (! filelist)
  236. ! #endif
  237. !      {
  238.         set_error(errno);
  239.         error("process_files");
  240.         return error_code;
  241. ***************
  242. *** 486,492 ****
  243.        *number -= offset;
  244.        files = (listrec *) realloc((char *) files,
  245.                    (unsigned) (sizeof(listrec) * *number));
  246. !      if (! files) {
  247.         set_error(errno);
  248.         error("realloc");
  249.         return errno;
  250. --- 496,507 ----
  251.        *number -= offset;
  252.        files = (listrec *) realloc((char *) files,
  253.                    (unsigned) (sizeof(listrec) * *number));
  254. ! #ifdef MALLOC_0_RETURNS_NULL
  255. !      if ((! files) && *number)
  256. ! #else
  257. !      if (! files)
  258. ! #endif
  259. !      {
  260.         set_error(errno);
  261.         error("realloc");
  262.         return errno;
  263. *** /tmp/,RCSt1021382    Tue Jun  4 22:31:35 1991
  264. --- directories.c    Tue Jun  4 22:08:21 1991
  265. ***************
  266. *** 11,23 ****
  267.    */
  268.   
  269.   #if !defined(lint) && !defined(SABER)
  270. !      static char rcsid_directories_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/directories.c,v 1.20 91/03/11 18:42:56 jik Exp $";
  271.   #endif
  272.   
  273.   #include <stdio.h>
  274.   #include <sys/types.h>
  275.   #include <sys/param.h>
  276.   #include <sys/dir.h>
  277.   #ifdef SYSV
  278.   #include <string.h>
  279.   #define index strchr
  280. --- 11,28 ----
  281.    */
  282.   
  283.   #if !defined(lint) && !defined(SABER)
  284. !      static char rcsid_directories_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/directories.c,v 1.21 91/06/04 22:08:14 jik Exp $";
  285.   #endif
  286.   
  287.   #include <stdio.h>
  288.   #include <sys/types.h>
  289.   #include <sys/param.h>
  290. + #ifdef POSIX
  291. + #include <dirent.h>
  292. + #define direct dirent
  293. + #else
  294.   #include <sys/dir.h>
  295. + #endif
  296.   #ifdef SYSV
  297.   #include <string.h>
  298.   #define index strchr
  299. *** /tmp/,RCSt1021382    Tue Jun  4 22:31:38 1991
  300. --- pattern.c    Tue Jun  4 22:06:23 1991
  301. ***************
  302. *** 11,22 ****
  303.    */
  304.   
  305.   #if (!defined(lint) && !defined(SABER))
  306. !      static char rcsid_pattern_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/pattern.c,v 1.22 91/02/28 18:43:11 jik Exp $";
  307.   #endif
  308.   
  309.   #include <stdio.h>
  310.   #include <sys/types.h>
  311.   #include <sys/dir.h>
  312.   #include <sys/param.h>
  313.   #ifdef SYSV
  314.   #include <string.h>
  315. --- 11,27 ----
  316.    */
  317.   
  318.   #if (!defined(lint) && !defined(SABER))
  319. !      static char rcsid_pattern_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/pattern.c,v 1.23 91/06/04 22:06:14 jik Exp $";
  320.   #endif
  321.   
  322.   #include <stdio.h>
  323.   #include <sys/types.h>
  324. + #ifdef POSIX
  325. + #include <dirent.h>
  326. + #define direct dirent
  327. + #else
  328.   #include <sys/dir.h>
  329. + #endif
  330.   #include <sys/param.h>
  331.   #ifdef SYSV
  332.   #include <string.h>
  333. ***************
  334. *** 57,63 ****
  335.        
  336.        *array1 = (char **) realloc((char *) *array1, (unsigned)
  337.                    (sizeof(char *) * (*num1 + *num2)));
  338. !      if (! *array1) {
  339.         set_error(errno);
  340.         error("realloc");
  341.         return error_code;
  342. --- 62,73 ----
  343.        
  344.        *array1 = (char **) realloc((char *) *array1, (unsigned)
  345.                    (sizeof(char *) * (*num1 + *num2)));
  346. ! #ifdef MALLOC_0_RETURNS_NULL
  347. !      if ((! *array1) && (*num1 + *num2))
  348. ! #else
  349. !      if (! *array1)
  350. ! #endif
  351. !      {
  352.         set_error(errno);
  353.         error("realloc");
  354.         return error_code;
  355. ***************
  356. *** 227,237 ****
  357. --- 237,249 ----
  358.        
  359.        if (options & RECURS) {
  360.         return_files = (char **) Malloc(0);
  361. + #ifndef MALLOC_0_RETURNS_NULL
  362.         if (! return_files) {
  363.              set_error(errno);
  364.              error("Malloc");
  365.              return error_code;
  366.         }
  367. + #endif
  368.         num_return_files = 0;
  369.   
  370.         for (i = 0; i < num_matched_files; i++) {
  371. ***************
  372. *** 435,440 ****
  373. --- 447,453 ----
  374.         *base = '\0';
  375.   
  376.        *found = (char **) Malloc(0);
  377. + #ifndef MALLOC_0_RETURNS_NULL
  378.        if (! *found) {
  379.         set_error(errno);
  380.         error("Malloc");
  381. ***************
  382. *** 443,448 ****
  383. --- 456,462 ----
  384.   #endif
  385.         return error_code;
  386.        }
  387. + #endif
  388.        *num_found = 0;
  389.        
  390.        dirp = Opendir(base);
  391. ***************
  392. *** 743,753 ****
  393. --- 757,769 ----
  394.        /* start: */
  395.        
  396.        *found = (char **) Malloc(0);
  397. + #ifndef MALLOC_0_RETURNS_NULL
  398.        if (! *found) {
  399.         set_error(errno);
  400.         error("Malloc");
  401.         return error_code;
  402.        }
  403. + #endif
  404.        *num_found = 0;
  405.        strcpy(base, name);
  406.   
  407. *** /tmp/,RCSt1021382    Tue Jun  4 22:31:41 1991
  408. --- util.c    Tue Jun  4 22:06:43 1991
  409. ***************
  410. *** 11,17 ****
  411.    */
  412.   
  413.   #if (!defined(lint) && !defined(SABER))
  414. !      static char rcsid_util_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/util.c,v 1.22 91/02/28 18:44:11 jik Exp $";
  415.   #endif
  416.   
  417.   #include <stdio.h>
  418. --- 11,17 ----
  419.    */
  420.   
  421.   #if (!defined(lint) && !defined(SABER))
  422. !      static char rcsid_util_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/util.c,v 1.23 91/06/04 22:06:34 jik Exp $";
  423.   #endif
  424.   
  425.   #include <stdio.h>
  426. ***************
  427. *** 20,26 ****
  428. --- 20,31 ----
  429.   #ifdef SYSV /* SYSV doesn't define uid_t */
  430.   typedef unsigned short uid_t;
  431.   #endif
  432. + #ifdef POSIX
  433. + #include <dirent.h>
  434. + #define direct dirent
  435. + #else
  436.   #include <sys/dir.h>
  437. + #endif
  438.   #ifdef SYSV
  439.   #include <string.h>
  440.   #define index strchr
  441. *** /tmp/,RCSt1021382    Tue Jun  4 22:31:43 1991
  442. --- expunge.c    Tue Jun  4 22:07:51 1991
  443. ***************
  444. *** 11,23 ****
  445.    */
  446.   
  447.   #if (!defined(lint) && !defined(SABER))
  448. !      static char rcsid_expunge_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/expunge.c,v 1.19 91/03/11 18:43:51 jik Exp $";
  449.   #endif
  450.   
  451.   #include <stdio.h>
  452.   #include <sys/types.h>
  453.   #include <sys/time.h>
  454.   #include <sys/dir.h>
  455.   #include <sys/param.h>
  456.   #ifdef SYSV
  457.   #include <string.h>
  458. --- 11,28 ----
  459.    */
  460.   
  461.   #if (!defined(lint) && !defined(SABER))
  462. !      static char rcsid_expunge_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/expunge.c,v 1.20 91/06/04 22:07:43 jik Exp $";
  463.   #endif
  464.   
  465.   #include <stdio.h>
  466.   #include <sys/types.h>
  467.   #include <sys/time.h>
  468. + #ifdef POSIX
  469. + #include <dirent.h>
  470. + #define direct dirent
  471. + #else
  472.   #include <sys/dir.h>
  473. + #endif
  474.   #include <sys/param.h>
  475.   #ifdef SYSV
  476.   #include <string.h>
  477. *** /tmp/,RCSt1021382    Tue Jun  4 22:31:45 1991
  478. --- lsdel.c    Tue Jun  4 22:08:42 1991
  479. ***************
  480. *** 11,22 ****
  481.    */
  482.   
  483.   #if (!defined(lint) && !defined(SABER))
  484. !      static char rcsid_lsdel_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/lsdel.c,v 1.16 91/03/11 18:43:29 jik Exp $";
  485.   #endif
  486.   
  487.   #include <stdio.h>
  488.   #include <sys/types.h>
  489.   #include <sys/dir.h>
  490.   #include <sys/param.h>
  491.   #ifdef SYSV
  492.   #include <string.h>
  493. --- 11,27 ----
  494.    */
  495.   
  496.   #if (!defined(lint) && !defined(SABER))
  497. !      static char rcsid_lsdel_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/lsdel.c,v 1.19 91/06/04 22:08:30 jik Exp $";
  498.   #endif
  499.   
  500.   #include <stdio.h>
  501.   #include <sys/types.h>
  502. + #ifdef POSIX
  503. + #include <dirent.h>
  504. + #define direct dirent
  505. + #else
  506.   #include <sys/dir.h>
  507. + #endif
  508.   #include <sys/param.h>
  509.   #ifdef SYSV
  510.   #include <string.h>
  511. ***************
  512. *** 45,51 ****
  513.   extern int errno;
  514.   
  515.   int space_total = 0;
  516. ! int dirsonly, recursive, yield, f_links, f_mounts;
  517.   time_t timev;
  518.   
  519.   main(argc, argv)
  520. --- 50,56 ----
  521.   extern int errno;
  522.   
  523.   int space_total = 0;
  524. ! int dirsonly, recursive, yield, f_links, f_mounts, singlecolumn;
  525.   time_t timev;
  526.   
  527.   main(argc, argv)
  528. ***************
  529. *** 59,66 ****
  530.        whoami = lastpart(argv[0]);
  531.   
  532.        dirsonly = recursive = timev = yield = f_links = f_mounts = 0;
  533. !      while ((arg = getopt(argc, argv, "drt:ysm")) != -1) {
  534.         switch (arg) {
  535.         case 'd':
  536.              dirsonly++;
  537.              break;
  538. --- 64,92 ----
  539.        whoami = lastpart(argv[0]);
  540.   
  541.        dirsonly = recursive = timev = yield = f_links = f_mounts = 0;
  542. !      singlecolumn = -1;
  543. !      while ((arg = getopt(argc, argv, "1Cdrt:ysm")) != -1) {
  544.         switch (arg) {
  545. +       case '1':
  546. +            if ((singlecolumn != -1) && (! singlecolumn)) {
  547. +             fprintf(stderr,
  548. +                 "%s: -1 and -C options are mutually exclusive\n",
  549. +                 whoami);
  550. +             usage();
  551. +             exit(1);
  552. +            }
  553. +            singlecolumn = 1;
  554. +            break;
  555. +       case 'C':
  556. +            if ((singlecolumn != -1) && singlecolumn) {
  557. +             fprintf(stderr,
  558. +                 "%s: -1 and -C options are mutually exclusive\n",
  559. +                 whoami);
  560. +             usage();
  561. +             exit(1);
  562. +            }
  563. +            singlecolumn = 0;
  564. +            break;
  565.         case 'd':
  566.              dirsonly++;
  567.              break;
  568. ***************
  569. *** 84,89 ****
  570. --- 110,118 ----
  571.              exit(1);
  572.         }
  573.        }
  574. +      if (singlecolumn == -1)
  575. +       singlecolumn = ! isatty(1);
  576.        if (optind == argc) {
  577.         char *cwd;
  578.   
  579. ***************
  580. *** 113,118 ****
  581. --- 142,150 ----
  582.        fprintf(stderr, "     -y     report total space taken up by files\n");
  583.        fprintf(stderr, "     -s     follow symbolic links to directories\n");
  584.        fprintf(stderr, "     -m     follow mount points\n");
  585. +      fprintf(stderr, "     -1     force single-column output\n");
  586. +      fprintf(stderr, "     -C     force multi-column output (default when output is to a terminal)\n");
  587. +      fprintf(stderr, "-1 and -C are mutually exclusive\n");
  588.   }
  589.   
  590.   
  591. ***************
  592. *** 255,260 ****
  593. --- 287,297 ----
  594.   
  595.   
  596.   
  597. + static int alphacmp(str1, str2)
  598. + char **str1, **str2;
  599. + {
  600. +      return(strcmp(*str1, *str2));
  601. + }
  602.   
  603.   list_files()
  604.   {
  605. ***************
  606. *** 290,298 ****
  607.         error("unique");
  608.         return retval;
  609.        }
  610. !      
  611. !      if (retval = column_array(strings, num, DEF_SCR_WIDTH, 0, 0, 2, 1, 0,
  612. !                    1, stdout)) {
  613.         error("column_array");
  614.         return retval;
  615.        }
  616. --- 327,337 ----
  617.         error("unique");
  618.         return retval;
  619.        }
  620. !      qsort((char *) strings, num, sizeof(char *), alphacmp);
  621. !      if (retval = column_array(strings, num, DEF_SCR_WIDTH, 0, singlecolumn,
  622. !                    2, 1, 0, 1, stdout)) {
  623.         error("column_array");
  624.         return retval;
  625.        }
  626. ***************
  627. *** 342,348 ****
  628.        *number -= offset;
  629.        files = (char **) realloc((char *) files,
  630.                      (unsigned) (sizeof(char *) * *number));
  631. !      if ((*number != 0) && (! files)) {
  632.         set_error(errno);
  633.         error("realloc");
  634.         return errno;
  635. --- 381,392 ----
  636.        *number -= offset;
  637.        files = (char **) realloc((char *) files,
  638.                      (unsigned) (sizeof(char *) * *number));
  639. ! #ifdef MALLOC_0_RETURNS_NULL
  640. !      if ((! files) && *number)
  641. ! #else
  642. !      if (! files)
  643. ! #endif
  644. !      {
  645.         set_error(errno);
  646.         error("realloc");
  647.         return errno;
  648. *** /tmp/,RCSt1021382    Tue Jun  4 22:31:50 1991
  649. --- stack.c    Tue Jun  4 22:06:00 1991
  650. ***************
  651. *** 11,17 ****
  652.    */
  653.   
  654.   #if (!defined(lint) && !defined(SABER))
  655. !      static char rcsid_stack_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/stack.c,v 1.9 91/02/28 18:43:49 jik Exp $";
  656.   #endif
  657.   
  658.   #include <sys/types.h>
  659. --- 11,17 ----
  660.    */
  661.   
  662.   #if (!defined(lint) && !defined(SABER))
  663. !      static char rcsid_stack_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/stack.c,v 1.10 91/06/04 22:05:49 jik Exp $";
  664.   #endif
  665.   
  666.   #include <sys/types.h>
  667. ***************
  668. *** 63,69 ****
  669.              stack = (caddr_t) (stack ? realloc((char *) stack,
  670.                             (unsigned) size) :
  671.                     Malloc((unsigned) size));
  672. !            if (! stack) {
  673.               size = count = 0;
  674.               set_error(errno);
  675.               error("Malloc");
  676. --- 63,74 ----
  677.              stack = (caddr_t) (stack ? realloc((char *) stack,
  678.                             (unsigned) size) :
  679.                     Malloc((unsigned) size));
  680. ! #ifdef MALLOC_0_RETURNS_NULL
  681. !            if ((! stack) && size)
  682. ! #else
  683. !            if (! stack)
  684. ! #endif
  685. !            {
  686.               size = count = 0;
  687.               set_error(errno);
  688.               error("Malloc");
  689. ***************
  690. *** 119,125 ****
  691.              if (newsize < size) {
  692.               size = newsize;
  693.               stack = (caddr_t) realloc((char *) stack, (unsigned) size);
  694. !             if ((size != 0) && (! stack)) {
  695.                set_error(errno);
  696.                error("realloc");
  697.   #ifdef STACK_DEBUG
  698. --- 124,135 ----
  699.              if (newsize < size) {
  700.               size = newsize;
  701.               stack = (caddr_t) realloc((char *) stack, (unsigned) size);
  702. ! #ifdef MALLOC_0_RETURNS_NULL
  703. !             if ((! stack) && size)
  704. ! #else
  705. !             if (! stack)
  706. ! #endif
  707. !                 {
  708.                set_error(errno);
  709.                error("realloc");
  710.   #ifdef STACK_DEBUG
  711. *** /tmp/,RCSt1021382    Tue Jun  4 22:32:08 1991
  712. --- man1/lsdel.1    Tue Jun  4 18:57:48 1991
  713. ***************
  714. *** 1,6 ****
  715.   .\"    $Source: /afs/athena.mit.edu/astaff/project/delete/src/man1/RCS/lsdel.1,v $
  716.   .\"    $Author: jik $
  717. ! .\"    $Header: /afs/athena.mit.edu/astaff/project/delete/src/man1/RCS/lsdel.1,v 1.6 90/09/26 03:49:35 jik Exp $
  718.   .\"
  719.   .\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  720.   .\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  721. --- 1,6 ----
  722.   .\"    $Source: /afs/athena.mit.edu/astaff/project/delete/src/man1/RCS/lsdel.1,v $
  723.   .\"    $Author: jik $
  724. ! .\"    $Header: /afs/athena.mit.edu/astaff/project/delete/src/man1/RCS/lsdel.1,v 1.7 91/06/04 18:57:40 jik Exp $
  725.   .\"
  726.   .\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  727.   .\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  728. ***************
  729. *** 25,30 ****
  730. --- 25,34 ----
  731.   .B \-m
  732.   ] [
  733.   .B \-y
  734. + ] [
  735. + .B \-1
  736. + ] [
  737. + .B \-C
  738.   ] [ filename [ ... ]]
  739.   .PP
  740.   .SH DESCRIPTION
  741. ***************
  742. *** 72,77 ****
  743. --- 76,89 ----
  744.   option causes
  745.   .I lsdel
  746.   to print the total amount of space taken up by all the files it lists.
  747. + .PP
  748. + The
  749. + .BR \-1
  750. + option forces output to be one file per line; this is the default when
  751. + output is not to a terminal.  The
  752. + .BR \-C
  753. + option does the opposite, forcing multi-column output, which is the
  754. + default when output is to a terminal.
  755.   .SH "SEE ALSO"
  756.   delete(1), undelete(1), purge(1), expunge(1), ls(1)
  757.   .SH AUTHOR
  758. *** /tmp/,RCSt1021382    Tue Jun  4 22:32:13 1991
  759. --- block-test.sh    Tue Jun  4 20:51:52 1991
  760. ***************
  761. *** 9,15 ****
  762.   main()
  763.   {
  764.        struct stat statbuf;
  765. !      char buf[1024];
  766.        int testfile;
  767.        char filename[20];
  768.   
  769. --- 9,15 ----
  770.   main()
  771.   {
  772.        struct stat statbuf;
  773. !      char buf[4096];
  774.        int testfile;
  775.        char filename[20];
  776.   
  777. ***************
  778. *** 37,48 ****
  779.         exit(1);
  780.        }
  781.   
  782. !      if (statbuf.st_blocks == 2) {
  783.         printf("You SHOULD define USE_BLOCKS.\n");
  784.        }
  785.        else {
  786.         printf("You SHOULD NOT define USE_BLOCKS.\n");
  787. !       printf("However, you have an interesting machine that delete might be made to work\nbetter with.  Please contact the author (see the README file for an address)\nand tell him what kind of machine you have and what operating system it is\nrunning.");
  788.        }
  789.        exit(0);
  790.   }
  791. --- 37,48 ----
  792.         exit(1);
  793.        }
  794.   
  795. !      if (statbuf.st_blocks == sizeof(buf) / 512) {
  796.         printf("You SHOULD define USE_BLOCKS.\n");
  797.        }
  798.        else {
  799.         printf("You SHOULD NOT define USE_BLOCKS.\n");
  800. !       printf("However, you have an interesting machine that delete might be made to work\nbetter with.  Please contact the author (see the README file for an address)\nand tell him what kind of machine you have and what operating system it is\nrunning.\n");
  801.        }
  802.        exit(0);
  803.   }
  804. *** /tmp/,RCSt1021382    Tue Jun  4 22:32:14 1991
  805. --- malloc-test.c    Tue Jun  4 22:25:14 1991
  806. ***************
  807. *** 0 ****
  808. --- 1,6 ----
  809. + main()
  810. + {
  811. +      printf("You %s define MALLOC_0_RETURNS_NULL.\n",
  812. +         malloc(0) ? "should NOT" : "SHOULD");
  813. +      exit(0);
  814. + }
  815.  
  816. exit 0 # Just in case...
  817. -- 
  818. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  819. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  820. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  821. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  822.