home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume33 / delete / patch15 next >
Encoding:
Text File  |  1992-11-11  |  35.4 KB  |  1,175 lines

  1. Newsgroups: comp.sources.misc
  2. From: jik@Athena.MIT.EDU (Jonathan I. Kamens)
  3. Subject:  v33i070:  delete - MIT Athena delete/undelete programs, Patch15
  4. Message-ID: <1992Nov10.151207.27537@sparky.imd.sterling.com>
  5. X-Md4-Signature: c25b91c7c7af45f5a3ce3b4e597c6ed3
  6. Date: Tue, 10 Nov 1992 15:12:07 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: jik@Athena.MIT.EDU (Jonathan I. Kamens)
  10. Posting-number: Volume 33, Issue 70
  11. Archive-name: delete/patch15
  12. Environment: SunOS, BSD, Ultrix, Mach, A/UX, HP-UX
  13. Patch-To: delete: Volume 17, Issue 23-26
  14.  
  15. This patch brings the "delete" package from patchlevel 14 to patchlevel 15. 
  16. Use "patch -p0" in your delete source directory to apply it.
  17.  
  18. This patch accomplishes the following:
  19.  
  20. 1) The test to see if malloc(0) returns 0 also checks to see if realloc(0)
  21. returns 0, since this is the case on some systems.
  22.  
  23. 2) The POSIX dirent support has been updated slightly, to take into account
  24. the fact that doing "#define direct dirent" breaks on some systems (e.g.,
  25. Ultrix systems).
  26.  
  27. 3) If the AFS_MOUNTPOINTS option is used to include support for AFS when
  28. compiling, the mtime of a file is changed when the file is deleted, so that
  29. "expunge" will do the right thing when only removing files that were deleted
  30. more than a specified amount of time previously.
  31.  
  32. 4) Several large buffers in recursive functions have been made static, so that
  33. they would not need to be allocated on the stack for each recursion.  This
  34. prevents the programs from running out of memory and/or overrunning their
  35. stack space when descending trees with large amounts of nesting.
  36.  
  37. 5) A bug related to symbolic links pointing nowhere has been fixed.
  38.  
  39. 6) Minor changes have been made for HP-UX and UTEK support.
  40.  
  41. 7) I've given up on trying to make RCS "$Header$" and "$Source$" lines
  42. work in our environment, where AFS mount points and the way AFS works
  43. causes their value to change often when it shouldn't.  Therefore, much
  44. of this patch is just removing "$Header$", "$Source$" and "$Author$"
  45. lines and replacing them with "$Id$" lines (besides, the "$Source$"
  46. and "$Author$" lines were redundant when "$Source$" was present).  I
  47. hope this is the last patch I'll have to release with major RCS
  48. frobbing in it.
  49.  
  50. *** ../delete.old/PATCHLEVEL    Tue Nov 10 00:21:56 1992
  51. --- PATCHLEVEL    Tue Nov 10 01:02:08 1992
  52. ***************
  53. *** 1 ****
  54. ! 14
  55. --- 1 ----
  56. ! 15
  57. *** ../delete.old/col.c    Tue Nov 10 00:19:32 1992
  58. --- col.c    Tue Nov 10 00:57:45 1992
  59. ***************
  60. *** 1,7 ****
  61.   /*
  62. -  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/col.c,v $
  63. -  * $Author: jik $
  64. -  *
  65.    * This program is part of a package including delete, undelete,
  66.    * lsdel, expunge and purge.  The software suite is meant as a
  67.    * replacement for rm which allows for file recovery.
  68. --- 1,4 ----
  69. ***************
  70. *** 11,17 ****
  71.    */
  72.   
  73.   #if (!defined(lint) && !defined(SABER))
  74. !      static char rcsid_col_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/col.c,v 1.8 91/02/28 18:42:09 jik Exp $";
  75.   #endif
  76.   
  77.   /*
  78. --- 8,14 ----
  79.    */
  80.   
  81.   #if (!defined(lint) && !defined(SABER))
  82. !      static char rcsid_col_c[] = "$Id: col.c,v 1.9 1992/11/10 05:57:24 jik Exp $";
  83.   #endif
  84.   
  85.   /*
  86. *** ../delete.old/col.h    Tue Nov 10 00:19:32 1992
  87. --- col.h    Tue Nov 10 00:57:46 1992
  88. ***************
  89. *** 1,6 ****
  90.   /*
  91. !  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/col.h,v $
  92. !  * $Author: jik $
  93.    *
  94.    * This header file is part of a package including delete, undelete,
  95.    * lsdel, expunge and purge.  The software suite is meant as a
  96. --- 1,5 ----
  97.   /*
  98. !  * $Id: col.h,v 1.4 1992/11/10 05:57:24 jik Exp $
  99.    *
  100.    * This header file is part of a package including delete, undelete,
  101.    * lsdel, expunge and purge.  The software suite is meant as a
  102. *** ../delete.old/delete.h    Tue Nov 10 00:19:33 1992
  103. --- delete.h    Tue Nov 10 00:57:51 1992
  104. ***************
  105. *** 1,7 ****
  106.   /*
  107. !  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/delete.h,v $
  108. !  * $Author: jik $
  109. !  * $Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/delete.h,v 1.5 91/02/28 18:42:22 jik Exp $
  110.    * 
  111.    * This file is part of a package including delete, undelete,
  112.    * lsdel, expunge and purge.  The software suite is meant as a
  113. --- 1,5 ----
  114.   /*
  115. !  * $Id: delete.h,v 1.6 1992/11/10 05:57:24 jik Exp $
  116.    * 
  117.    * This file is part of a package including delete, undelete,
  118.    * lsdel, expunge and purge.  The software suite is meant as a
  119. *** ../delete.old/delete_errs.et    Tue Nov 10 00:19:33 1992
  120. --- delete_errs.et    Tue Nov 10 00:57:52 1992
  121. ***************
  122. *** 3,11 ****
  123.   #     For copying and distribution information, see the file
  124.   #     "mit-copying.h".
  125.   #
  126. ! #     $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/delete_errs.et,v $
  127. ! #     $Author: jik $
  128. ! #     $Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/delete_errs.et,v 1.4 91/02/28 18:42:24 jik Exp $
  129.   #
  130.   
  131.       et    del
  132. --- 3,9 ----
  133.   #     For copying and distribution information, see the file
  134.   #     "mit-copying.h".
  135.   #
  136. ! #     $Id: delete_errs.et,v 1.5 1992/11/10 05:57:24 jik Exp $
  137.   #
  138.   
  139.       et    del
  140. *** ../delete.old/directories.h    Tue Nov 10 00:19:34 1992
  141. --- directories.h    Tue Nov 10 00:57:55 1992
  142. ***************
  143. *** 1,7 ****
  144.   /*
  145. !  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/directories.h,v $
  146. !  * $Author: jik $
  147. !  * $Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/directories.h,v 1.12 91/03/11 18:41:30 jik Exp $
  148.    * 
  149.    * This file is part of a package including delete, undelete,
  150.    * lsdel, expunge and purge.  The software suite is meant as a
  151. --- 1,5 ----
  152.   /*
  153. !  * $Id: directories.h,v 1.13 1992/11/10 05:57:24 jik Exp $
  154.    * 
  155.    * This file is part of a package including delete, undelete,
  156.    * lsdel, expunge and purge.  The software suite is meant as a
  157. *** ../delete.old/errors.c    Tue Nov 10 00:19:34 1992
  158. --- errors.c    Tue Nov 10 00:57:58 1992
  159. ***************
  160. *** 1,7 ****
  161.   /*
  162. -  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/errors.c,v $
  163. -  * $Author: jik $
  164. -  *
  165.    * This program is part of a package including delete, undelete,
  166.    * lsdel, expunge and purge.  The software suite is meant as a
  167.    * replacement for rm which allows for file recovery.
  168. --- 1,4 ----
  169. ***************
  170. *** 11,17 ****
  171.    */
  172.   
  173.   #if (!defined(lint) && !defined(SABER))
  174. !      static char rcsid_errors_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/errors.c,v 1.4 91/02/28 18:42:40 jik Exp $";
  175.   #endif
  176.   
  177.   #include <com_err.h>
  178. --- 8,14 ----
  179.    */
  180.   
  181.   #if (!defined(lint) && !defined(SABER))
  182. !      static char rcsid_errors_c[] = "$Id: errors.c,v 1.5 1992/11/10 05:57:24 jik Exp $";
  183.   #endif
  184.   
  185.   #include <com_err.h>
  186. *** ../delete.old/errors.h    Tue Nov 10 00:19:35 1992
  187. --- errors.h    Tue Nov 10 00:57:59 1992
  188. ***************
  189. *** 1,7 ****
  190.   /*
  191. !  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/errors.h,v $
  192. !  * $Author: jik $
  193. !  * $Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/errors.h,v 1.3 91/02/28 18:42:52 jik Exp $
  194.    * 
  195.    * This file is part of a package including delete, undelete,
  196.    * lsdel, expunge and purge.  The software suite is meant as a
  197. --- 1,5 ----
  198.   /*
  199. !  * $Id: errors.h,v 1.4 1992/11/10 05:57:24 jik Exp $
  200.    * 
  201.    * This file is part of a package including delete, undelete,
  202.    * lsdel, expunge and purge.  The software suite is meant as a
  203. *** ../delete.old/expunge.h    Tue Nov 10 00:19:35 1992
  204. --- expunge.h    Tue Nov 10 00:58:03 1992
  205. ***************
  206. *** 1,7 ****
  207.   /*
  208. !  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/expunge.h,v $
  209. !  * $Author: jik $
  210. !  * $Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/expunge.h,v 1.5 91/02/28 18:43:02 jik Exp $
  211.    * 
  212.    * This file is part of a package including delete, undelete,
  213.    * lsdel, expunge and purge.  The software suite is meant as a
  214. --- 1,5 ----
  215.   /*
  216. !  * $Id: expunge.h,v 1.6 1992/11/10 05:57:24 jik Exp $
  217.    * 
  218.    * This file is part of a package including delete, undelete,
  219.    * lsdel, expunge and purge.  The software suite is meant as a
  220. *** ../delete.old/lsdel.h    Tue Nov 10 00:19:36 1992
  221. --- lsdel.h    Tue Nov 10 00:58:07 1992
  222. ***************
  223. *** 1,7 ****
  224.   /*
  225. !  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/lsdel.h,v $
  226. !  * $Author: jik $
  227. !  * $Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/lsdel.h,v 1.5 91/02/28 18:43:08 jik Exp $
  228.    * 
  229.    * This file is part of a package including delete, undelete,
  230.    * lsdel, expunge and purge.  The software suite is meant as a
  231. --- 1,5 ----
  232.   /*
  233. !  * $Id: lsdel.h,v 1.6 1992/11/10 05:57:24 jik Exp $
  234.    * 
  235.    * This file is part of a package including delete, undelete,
  236.    * lsdel, expunge and purge.  The software suite is meant as a
  237. *** ../delete.old/man1/delete.1    Tue Nov 10 00:19:36 1992
  238. --- man1/delete.1    Tue Nov 10 01:00:54 1992
  239. ***************
  240. *** 1,6 ****
  241. ! .\"    $Source: /afs/athena.mit.edu/astaff/project/delete/src/man1/RCS/delete.1,v $
  242. ! .\"    $Author: jik $
  243. ! .\"    $Header: /afs/athena.mit.edu/astaff/project/delete/src/man1/RCS/delete.1,v 1.5 89/09/14 03:42:51 jik Exp $
  244.   .\"
  245.   .\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  246.   .\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  247. --- 1,4 ----
  248. ! .\"    $Id: delete.1,v 1.7 1992/11/10 06:00:44 jik Exp $
  249.   .\"
  250.   .\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  251.   .\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  252. ***************
  253. *** 131,136 ****
  254. --- 129,145 ----
  255.   file names, even if they start with a dash.
  256.   .SH "SEE ALSO"
  257.   undelete(1), purge(1), expunge(1), lsdel(1), rm(1), rmdir(1)
  258. + .SH BUGS
  259. + .I Delete
  260. + may change the access and modification times on a file when it is
  261. + deleted.  This is necessary in order to guarantee that
  262. + .I expunge
  263. + will work correctly in
  264. + .I AFS
  265. + filesystems.  You might say that this is a bug in
  266. + .IR AFS ,
  267. + rather than a bug in
  268. + .IR delete .
  269.   .SH AUTHOR
  270.   Jonathan I. Kamens (MIT-Project Athena)
  271.   .SH COPYRIGHT
  272. *** ../delete.old/man1/expunge.1    Tue Nov 10 00:19:37 1992
  273. --- man1/expunge.1    Tue Nov 10 01:00:58 1992
  274. ***************
  275. *** 1,6 ****
  276. ! .\"    $Source: /afs/athena.mit.edu/astaff/project/delete/src/man1/RCS/expunge.1,v $
  277. ! .\"    $Author: jik $
  278. ! .\"    $Header: /afs/athena.mit.edu/astaff/project/delete/src/man1/RCS/expunge.1,v 1.9 91/01/01 05:09:52 jik Exp $
  279.   .\"
  280.   .\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  281.   .\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  282. --- 1,4 ----
  283. ! .\"    $Id: expunge.1,v 1.10 1992/11/10 06:00:44 jik Exp $
  284.   .\"
  285.   .\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  286.   .\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  287. *** ../delete.old/man1/lsdel.1    Tue Nov 10 00:22:03 1992
  288. --- man1/lsdel.1    Tue Nov 10 01:01:00 1992
  289. ***************
  290. *** 1,6 ****
  291. ! .\"    $Source: /afs/athena.mit.edu/astaff/project/delete/src/man1/RCS/lsdel.1,v $
  292. ! .\"    $Author: jik $
  293. ! .\"    $Header: /afs/athena.mit.edu/astaff/project/delete/src/man1/RCS/lsdel.1,v 1.7 91/06/04 18:57:40 jik Exp $
  294.   .\"
  295.   .\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  296.   .\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  297. --- 1,4 ----
  298. ! .\"    $Id: lsdel.1,v 1.8 1992/11/10 06:00:44 jik Exp $
  299.   .\"
  300.   .\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  301.   .\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  302. *** ../delete.old/man1/purge.1    Tue Nov 10 00:19:38 1992
  303. --- man1/purge.1    Tue Nov 10 01:01:04 1992
  304. ***************
  305. *** 1,6 ****
  306. ! .\"    $Source: /afs/athena.mit.edu/astaff/project/delete/src/man1/RCS/purge.1,v $
  307. ! .\"    $Author: jik $
  308. ! .\"    $Header: /afs/athena.mit.edu/astaff/project/delete/src/man1/RCS/purge.1,v 1.1 89/01/27 04:50:13 jik Exp $
  309.   .\"
  310.   .\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  311.   .\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  312. --- 1,4 ----
  313. ! .\"    $Id: purge.1,v 1.2 1992/11/10 06:00:44 jik Exp $
  314.   .\"
  315.   .\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  316.   .\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  317. *** ../delete.old/man1/undelete.1    Tue Nov 10 00:19:39 1992
  318. --- man1/undelete.1    Tue Nov 10 01:01:08 1992
  319. ***************
  320. *** 1,6 ****
  321. ! .\"    $Source: /afs/athena.mit.edu/astaff/project/delete/src/man1/RCS/undelete.1,v $
  322. ! .\"    $Author: jik $
  323. ! .\"    $Header: /afs/athena.mit.edu/astaff/project/delete/src/man1/RCS/undelete.1,v 1.5 89/11/02 07:13:26 jik Exp $
  324.   .\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  325.   .\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  326.   .\" the terms and conditions for redistribution.
  327. --- 1,4 ----
  328. ! .\"    $Id: undelete.1,v 1.6 1992/11/10 06:00:44 jik Exp $
  329.   .\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  330.   .\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  331.   .\" the terms and conditions for redistribution.
  332. *** ../delete.old/pattern.h    Tue Nov 10 00:19:39 1992
  333. --- pattern.h    Tue Nov 10 00:58:13 1992
  334. ***************
  335. *** 1,7 ****
  336.   /*
  337. !  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/pattern.h,v $
  338. !  * $Author: jik $
  339. !  * $Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/pattern.h,v 1.6 91/02/28 18:43:19 jik Exp $
  340.    * 
  341.    * This program is part of a package including delete, undelete,
  342.    * lsdel, expunge and purge.  The software suite is meant as a
  343. --- 1,5 ----
  344.   /*
  345. !  * $Id: pattern.h,v 1.7 1992/11/10 05:57:24 jik Exp $
  346.    * 
  347.    * This program is part of a package including delete, undelete,
  348.    * lsdel, expunge and purge.  The software suite is meant as a
  349. *** ../delete.old/shell_regexp.c    Tue Nov 10 00:19:40 1992
  350. --- shell_regexp.c    Tue Nov 10 00:58:15 1992
  351. ***************
  352. *** 1,7 ****
  353.   /*
  354. -  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/shell_regexp.c,v $
  355. -  * $Author: jik $
  356. -  *
  357.    * This program is part of a package including delete, undelete,
  358.    * lsdel, expunge and purge.  The software suite is meant as a
  359.    * replacement for rm which allows for file recovery.
  360. --- 1,4 ----
  361. ***************
  362. *** 11,17 ****
  363.    */
  364.   
  365.   #if (!defined(lint) && !defined(SABER))
  366. !      static char rcsid_shell_regexp_c[] = "$Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/shell_regexp.c,v 1.3 91/02/28 18:43:43 jik Exp $";
  367.   #endif
  368.   
  369.   #include <com_err.h>
  370. --- 8,14 ----
  371.    */
  372.   
  373.   #if (!defined(lint) && !defined(SABER))
  374. !      static char rcsid_shell_regexp_c[] = "$Id: shell_regexp.c,v 1.4 1992/11/10 05:57:24 jik Exp $";
  375.   #endif
  376.   
  377.   #include <com_err.h>
  378. *** ../delete.old/shell_regexp.h    Tue Nov 10 00:19:40 1992
  379. --- shell_regexp.h    Tue Nov 10 00:58:16 1992
  380. ***************
  381. *** 1,6 ****
  382.   /*
  383. !  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/shell_regexp.h,v $
  384. !  * $Author: jik $
  385.    *
  386.    * This program is part of a package including delete, undelete,
  387.    * lsdel, expunge and purge.  The software suite is meant as a
  388. --- 1,5 ----
  389.   /*
  390. !  * $Id: shell_regexp.h,v 1.4 1992/11/10 05:57:24 jik Exp $
  391.    *
  392.    * This program is part of a package including delete, undelete,
  393.    * lsdel, expunge and purge.  The software suite is meant as a
  394. *** ../delete.old/stack.c    Tue Nov 10 00:22:03 1992
  395. --- stack.c    Tue Nov 10 00:58:18 1992
  396. ***************
  397. *** 1,7 ****
  398.   /*
  399. -  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/stack.c,v $
  400. -  * $Author: jik $
  401. -  *
  402.    * This program is part of a package including delete, undelete,
  403.    * lsdel, expunge and purge.  The software suite is meant as a
  404.    * replacement for rm which allows for file recovery.
  405. --- 1,4 ----
  406. ***************
  407. *** 11,17 ****
  408.    */
  409.   
  410.   #if (!defined(lint) && !defined(SABER))
  411. !      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 $";
  412.   #endif
  413.   
  414.   #include <sys/types.h>
  415. --- 8,14 ----
  416.    */
  417.   
  418.   #if (!defined(lint) && !defined(SABER))
  419. !      static char rcsid_stack_c[] = "$Id: stack.c,v 1.11 1992/11/10 05:57:24 jik Exp $";
  420.   #endif
  421.   
  422.   #include <sys/types.h>
  423. *** ../delete.old/stack.h    Tue Nov 10 00:19:41 1992
  424. --- stack.h    Tue Nov 10 00:58:19 1992
  425. ***************
  426. *** 1,7 ****
  427.   /*
  428. !  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/stack.h,v $
  429. !  * $Author: jik $
  430. !  * $Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/stack.h,v 1.3 91/02/28 18:43:52 jik Exp $
  431.    * 
  432.    * This file is part of a package including delete, undelete,
  433.    * lsdel, expunge and purge.  The software suite is meant as a
  434. --- 1,5 ----
  435.   /*
  436. !  * $Id: stack.h,v 1.4 1992/11/10 05:57:24 jik Exp $
  437.    * 
  438.    * This file is part of a package including delete, undelete,
  439.    * lsdel, expunge and purge.  The software suite is meant as a
  440. *** ../delete.old/undelete.h    Tue Nov 10 00:19:42 1992
  441. --- undelete.h    Tue Nov 10 00:59:21 1992
  442. ***************
  443. *** 1,7 ****
  444.   /*
  445. !  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/undelete.h,v $
  446. !  * $Author: jik $
  447. !  * $Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/undelete.h,v 1.5 91/02/28 18:44:06 jik Exp $
  448.    * 
  449.    * This program is part of a package including delete, undelete,
  450.    * lsdel, expunge and purge.  The software suite is meant as a
  451. --- 1,5 ----
  452.   /*
  453. !  * $Id: undelete.h,v 1.6 1992/11/10 05:57:24 jik Exp $
  454.    * 
  455.    * This program is part of a package including delete, undelete,
  456.    * lsdel, expunge and purge.  The software suite is meant as a
  457. *** ../delete.old/util.h    Tue Nov 10 00:19:42 1992
  458. --- util.h    Tue Nov 10 00:59:24 1992
  459. ***************
  460. *** 1,7 ****
  461.   /*
  462. !  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/util.h,v $
  463. !  * $Author: jik $
  464. !  * $Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/util.h,v 1.12 91/02/28 18:44:15 jik Exp $
  465.    * 
  466.    * This file is part of a package including delete, undelete,
  467.    * lsdel, expunge and purge.  The software suite is meant as a
  468. --- 1,5 ----
  469.   /*
  470. !  * $Id: util.h,v 1.13 1992/11/10 05:57:24 jik Exp $
  471.    * 
  472.    * This file is part of a package including delete, undelete,
  473.    * lsdel, expunge and purge.  The software suite is meant as a
  474. *** ../delete.old/Makefile    Tue Nov 10 00:21:55 1992
  475. --- Makefile    Tue Nov 10 00:57:43 1992
  476. ***************
  477. *** 3,11 ****
  478.   #     For copying and distribution information, see the file
  479.   #     "mit-copying.h".
  480.   #
  481. ! #     $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/Makefile,v $
  482. ! #     $Author: jik $
  483. ! #     $Header: /afs/athena.mit.edu/astaff/project/delete/src/RCS/Makefile,v 1.32 91/06/04 22:17:28 jik Exp $
  484.   #
  485.   
  486.   # If you are compiling on a system that has an st_blocks field in
  487. --- 3,9 ----
  488.   #     For copying and distribution information, see the file
  489.   #     "mit-copying.h".
  490.   #
  491. ! #     $Id: Makefile,v 1.34 1992/11/10 05:57:24 jik Exp $
  492.   #
  493.   
  494.   # If you are compiling on a system that has an st_blocks field in
  495. ***************
  496. *** 14,22 ****
  497.   # variable below.  If you don't know whether or not to define it, run
  498.   # "make block-test".
  499.   # 
  500. ! # If you are using a system where malloc(0) returns 0 even when it
  501. ! # succeeds, then set MALLOC below to -DMALLOC_0_RETURNS_NULL.  If you
  502. ! # don't know whether or not to define it, run "make malloc-test".
  503.   
  504.   DESTDIR=
  505.   TARGETS=     delete undelete expunge purge lsdel
  506. --- 12,21 ----
  507.   # variable below.  If you don't know whether or not to define it, run
  508.   # "make block-test".
  509.   # 
  510. ! # If you are using a system where malloc(0) or realloc(ptr, 0) returns
  511. ! # 0 even when it succeeds, then set MALLOC below to
  512. ! # -DMALLOC_0_RETURNS_NULL.  If you don't know whether or not to define
  513. ! # it, run "make malloc-test".
  514.   
  515.   DESTDIR=
  516.   TARGETS=     delete undelete expunge purge lsdel
  517. *** ../delete.old/expunge.c    Tue Nov 10 00:22:02 1992
  518. --- expunge.c    Tue Nov 10 00:58:02 1992
  519. ***************
  520. *** 1,7 ****
  521.   /*
  522. -  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/expunge.c,v $
  523. -  * $Author: jik $
  524. -  *
  525.    * This program is part of a package including delete, undelete,
  526.    * lsdel, expunge and purge.  The software suite is meant as a
  527.    * replacement for rm which allows for file recovery.
  528. --- 1,4 ----
  529. ***************
  530. *** 11,17 ****
  531.    */
  532.   
  533.   #if (!defined(lint) && !defined(SABER))
  534. !      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 $";
  535.   #endif
  536.   
  537.   #include <stdio.h>
  538. --- 8,14 ----
  539.    */
  540.   
  541.   #if (!defined(lint) && !defined(SABER))
  542. !      static char rcsid_expunge_c[] = "$Id: expunge.c,v 1.23 1992/11/10 05:57:24 jik Exp $";
  543.   #endif
  544.   
  545.   #include <stdio.h>
  546. ***************
  547. *** 19,25 ****
  548.   #include <sys/time.h>
  549.   #ifdef POSIX
  550.   #include <dirent.h>
  551. - #define direct dirent
  552.   #else
  553.   #include <sys/dir.h>
  554.   #endif
  555. --- 16,21 ----
  556. ***************
  557. *** 292,298 ****
  558.        int retval;
  559.        
  560.        if ((leaf->specified) && ((leaf->specs.st_mode & S_IFMT) == S_IFDIR)) {
  561. !       char buf[MAXPATHLEN];
  562.   
  563.         if (retval = get_leaf_path(leaf, buf)) {
  564.              error("get_leaf_path");
  565. --- 288,298 ----
  566.        int retval;
  567.        
  568.        if ((leaf->specified) && ((leaf->specs.st_mode & S_IFMT) == S_IFDIR)) {
  569. !       /*
  570. !        * This is static so that we don't create a copy of it for
  571. !        * every recursive invocation of expunge_specified.
  572. !        */
  573. !       static char buf[MAXPATHLEN];
  574.   
  575.         if (retval = get_leaf_path(leaf, buf)) {
  576.              error("get_leaf_path");
  577. *** ../delete.old/lsdel.c    Tue Nov 10 00:22:02 1992
  578. --- lsdel.c    Tue Nov 10 00:58:05 1992
  579. ***************
  580. *** 1,7 ****
  581.   /*
  582. -  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/lsdel.c,v $
  583. -  * $Author: jik $
  584. -  *
  585.    * This program is a replacement for rm.  Instead of actually deleting
  586.    * files, it marks them for deletion by prefixing them with a ".#"
  587.    * prefix.
  588. --- 1,4 ----
  589. ***************
  590. *** 11,17 ****
  591.    */
  592.   
  593.   #if (!defined(lint) && !defined(SABER))
  594. !      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 $";
  595.   #endif
  596.   
  597.   #include <stdio.h>
  598. --- 8,14 ----
  599.    */
  600.   
  601.   #if (!defined(lint) && !defined(SABER))
  602. !      static char rcsid_lsdel_c[] = "$Id: lsdel.c,v 1.21 1992/11/10 05:57:24 jik Exp $";
  603.   #endif
  604.   
  605.   #include <stdio.h>
  606. ***************
  607. *** 18,24 ****
  608.   #include <sys/types.h>
  609.   #ifdef POSIX
  610.   #include <dirent.h>
  611. - #define direct dirent
  612.   #else
  613.   #include <sys/dir.h>
  614.   #endif
  615. --- 15,20 ----
  616. *** ../delete.old/undelete.c    Tue Nov 10 00:21:58 1992
  617. --- undelete.c    Tue Nov 10 00:59:19 1992
  618. ***************
  619. *** 1,7 ****
  620.   /*
  621. -  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/undelete.c,v $
  622. -  * $Author: jik $
  623. -  *
  624.    * This program is part of a package including delete, undelete,
  625.    * lsdel, expunge and purge.  The software suite is meant as a
  626.    * replacement for rm which allows for file recovery.
  627. --- 1,4 ----
  628. ***************
  629. *** 11,17 ****
  630.    */
  631.   
  632.   #if (!defined(lint) && !defined(SABER))
  633. !      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 $";
  634.   #endif
  635.   
  636.   #include <stdio.h>
  637. --- 8,14 ----
  638.    */
  639.   
  640.   #if (!defined(lint) && !defined(SABER))
  641. !      static char rcsid_undelete_c[] = "$Id: undelete.c,v 1.26 1992/11/10 05:57:24 jik Exp $";
  642.   #endif
  643.   
  644.   #include <stdio.h>
  645. ***************
  646. *** 18,24 ****
  647.   #include <sys/types.h>
  648.   #ifdef POSIX
  649.   #include <dirent.h>
  650. - #define direct dirent
  651.   #else
  652.   #include <sys/dir.h>
  653.   #endif
  654. --- 15,20 ----
  655. ***************
  656. *** 545,551 ****
  657. --- 541,551 ----
  658.        char buf[MAXPATHLEN];
  659.        struct stat stat_buf;
  660.        DIR *dirp;
  661. + #ifdef POSIX
  662. +      struct dirent *dp;
  663. + #else
  664.        struct direct *dp;
  665. + #endif
  666.        int retval;
  667.        int status = 0;
  668.        
  669. *** ../delete.old/util.c    Tue Nov 10 00:22:01 1992
  670. --- util.c    Tue Nov 10 00:59:22 1992
  671. ***************
  672. *** 1,7 ****
  673.   /*
  674. -  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/util.c,v $
  675. -  * $Author: jik $
  676. -  *
  677.    * This program is a replacement for rm.  Instead of actually deleting
  678.    * files, it marks them for deletion by prefixing them with a ".#"
  679.    * prefix.
  680. --- 1,4 ----
  681. ***************
  682. *** 11,28 ****
  683.    */
  684.   
  685.   #if (!defined(lint) && !defined(SABER))
  686. !      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 $";
  687.   #endif
  688.   
  689.   #include <stdio.h>
  690.   #include <sys/param.h>
  691.   #include <sys/types.h>
  692. ! #ifdef SYSV /* SYSV doesn't define uid_t */
  693.   typedef unsigned short uid_t;
  694.   #endif
  695.   #ifdef POSIX
  696.   #include <dirent.h>
  697. - #define direct dirent
  698.   #else
  699.   #include <sys/dir.h>
  700.   #endif
  701. --- 8,24 ----
  702.    */
  703.   
  704.   #if (!defined(lint) && !defined(SABER))
  705. !      static char rcsid_util_c[] = "$Id: util.c,v 1.28 1992/11/10 05:57:24 jik Exp $";
  706.   #endif
  707.   
  708.   #include <stdio.h>
  709.   #include <sys/param.h>
  710.   #include <sys/types.h>
  711. ! #if defined(SYSV) && !defined(hpux) /* SYSV doesn't define uid_t */
  712.   typedef unsigned short uid_t;
  713.   #endif
  714.   #ifdef POSIX
  715.   #include <dirent.h>
  716.   #else
  717.   #include <sys/dir.h>
  718.   #endif
  719. ***************
  720. *** 39,44 ****
  721. --- 35,41 ----
  722.   #include <sys/ioctl.h>
  723.   #include <afs/param.h>
  724.   #include <afs/vice.h>
  725. + #include <netinet/in.h>
  726.   #include <afs/venus.h>
  727.   #endif
  728.   #include "delete_errs.h"
  729. ***************
  730. *** 48,55 ****
  731.   #include "errors.h"
  732.   
  733.   extern char *getenv();
  734. - extern uid_t getuid();
  735.   extern int errno;
  736.   
  737.   char *convert_to_user_name(real_name, user_name)
  738.   char real_name[];
  739. --- 45,57 ----
  740.   #include "errors.h"
  741.   
  742.   extern char *getenv();
  743.   extern int errno;
  744. + #ifdef UTEK
  745. + extern int getuid();
  746. + #else /* ! UTEK */
  747. + extern uid_t getuid();
  748. + #endif /* UTEK */
  749.   
  750.   char *convert_to_user_name(real_name, user_name)
  751.   char real_name[];
  752. *** ../delete.old/delete.c    Tue Nov 10 00:21:56 1992
  753. --- delete.c    Tue Nov 10 00:57:48 1992
  754. ***************
  755. *** 1,7 ****
  756.   /*
  757. -  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/delete.c,v $
  758. -  * $Author: jik $
  759. -  *
  760.    * This program is a replacement for rm.  Instead of actually deleting
  761.    * files, it marks them for deletion by prefixing them with a ".#"
  762.    * prefix.
  763. --- 1,4 ----
  764. ***************
  765. *** 11,24 ****
  766.    */
  767.   
  768.   #if (!defined(lint) && !defined(SABER))
  769. !      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 $";
  770.   #endif
  771.   
  772.   #include <sys/types.h>
  773.   #include <stdio.h>
  774.   #ifdef POSIX
  775.   #include <dirent.h>
  776. - #define direct dirent
  777.   #else
  778.   #include <sys/dir.h>
  779.   #endif
  780. --- 8,23 ----
  781.    */
  782.   
  783.   #if (!defined(lint) && !defined(SABER))
  784. !      static char rcsid_delete_c[] = "$Id: delete.c,v 1.30 1992/11/10 05:57:24 jik Exp $";
  785.   #endif
  786.   
  787.   #include <sys/types.h>
  788. + #ifdef AFS_MOUNTPOINTS
  789. + #include <sys/time.h>
  790. + #endif
  791.   #include <stdio.h>
  792.   #ifdef POSIX
  793.   #include <dirent.h>
  794.   #else
  795.   #include <sys/dir.h>
  796.   #endif
  797. ***************
  798. *** 79,84 ****
  799. --- 78,86 ----
  800.   int force, interactive, recursive, noop, verbose, filesonly, directoriesonly;
  801.   int emulate_rm, linked_to_rm, linked_to_rmdir;
  802.   extern int errno;
  803. + #ifdef AFS_MOUNTPOINTS
  804. + struct timeval tvp[2];
  805. + #endif
  806.   
  807.   main(argc, argv)
  808.   int argc;
  809. ***************
  810. *** 91,97 ****
  811.        whoami = lastpart(argv[0]);
  812.   
  813.        initialize_del_error_table();
  814. !      
  815.        force = interactive = recursive = noop = verbose = filesonly =
  816.         directoriesonly = emulate_rm = linked_to_rm = linked_to_rmdir = 0;
  817.   
  818. --- 93,104 ----
  819.        whoami = lastpart(argv[0]);
  820.   
  821.        initialize_del_error_table();
  822. ! #ifdef AFS_MOUNTPOINTS
  823. !      gettimeofday(&tvp[0], (struct timezone *)0);
  824. !      tvp[1] = tvp[0];
  825. ! #endif
  826.        force = interactive = recursive = noop = verbose = filesonly =
  827.         directoriesonly = emulate_rm = linked_to_rm = linked_to_rmdir = 0;
  828.   
  829. ***************
  830. *** 319,325 ****
  831. --- 326,336 ----
  832.   char *filename;
  833.   {
  834.        DIR *dirp;
  835. + #ifdef POSIX
  836. +      struct dirent *dp;
  837. + #else
  838.        struct direct *dp;
  839. + #endif
  840.   
  841.        dirp = Opendir(filename);
  842.        if (! dirp) {
  843. ***************
  844. *** 350,356 ****
  845. --- 361,371 ----
  846.   int recursed;
  847.   {
  848.        DIR *dirp;
  849. + #ifdef POSIX
  850. +      struct dirent *dp;
  851. + #else
  852.        struct direct *dp;
  853. + #endif
  854.        int status = 0;
  855.        char newfile[MAXPATHLEN];
  856.        int retval = 0;
  857. ***************
  858. *** 496,501 ****
  859. --- 511,533 ----
  860.        else {
  861.         if (verbose)
  862.              fprintf(stderr, "%s: %s removed\n", whoami, filename);
  863. + #ifdef AFS_MOUNTPOINTS
  864. +       /*
  865. +        * Normally, expunge uses the ctime to determine how long
  866. +        * ago a file was deleted (since the ctime is normally
  867. +        * updated when a file is renamed).  However, in AFS,
  868. +        * renaming a file does not change the ctime, mtime OR
  869. +        * atime, so we have to use utimes to force the change.
  870. +        * This unfortunately causes the loss of the real mtime, but
  871. +        * there's nothing we can do about that, if we want expunge
  872. +        * to be able to do the right thing.
  873. +        *
  874. +        * Don't bother checking for errors, because we can't do
  875. +        * anything about them anyway, and in any case, this isn't a
  876. +        * *really* important operation.
  877. +        */
  878. +       utimes(buf, tvp);
  879. + #endif
  880.         return 0;
  881.        }
  882.   }
  883. ***************
  884. *** 508,514 ****
  885. --- 540,550 ----
  886.        char buf[MAXPATHLEN];
  887.        struct stat stat_buf;
  888.        DIR *dirp;
  889. + #ifdef POSIX
  890. +      struct dirent *dp;
  891. + #else
  892.        struct direct *dp;
  893. + #endif
  894.        int status = 0;
  895.        int retval;
  896.        
  897. *** ../delete.old/directories.c    Tue Nov 10 00:21:59 1992
  898. --- directories.c    Tue Nov 10 00:57:54 1992
  899. ***************
  900. *** 1,7 ****
  901.   /*
  902. -  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/directories.c,v $
  903. -  * $Author: jik $
  904. -  * 
  905.    * This program is part of a package including delete, undelete,
  906.    * lsdel, expunge and purge.  The software suite is meant as a
  907.    * replacement for rm which allows for file recovery.
  908. --- 1,4 ----
  909. ***************
  910. *** 11,17 ****
  911.    */
  912.   
  913.   #if !defined(lint) && !defined(SABER)
  914. !      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 $";
  915.   #endif
  916.   
  917.   #include <stdio.h>
  918. --- 8,14 ----
  919.    */
  920.   
  921.   #if !defined(lint) && !defined(SABER)
  922. !      static char rcsid_directories_c[] = "$Id: directories.c,v 1.24 1992/11/10 05:57:24 jik Exp $";
  923.   #endif
  924.   
  925.   #include <stdio.h>
  926. ***************
  927. *** 19,25 ****
  928.   #include <sys/param.h>
  929.   #ifdef POSIX
  930.   #include <dirent.h>
  931. - #define direct dirent
  932.   #else
  933.   #include <sys/dir.h>
  934.   #endif
  935. --- 16,21 ----
  936. ***************
  937. *** 369,375 ****
  938.   void print_paths_from(leaf)
  939.   filerec *leaf;
  940.   {
  941. !      char buf[MAXPATHLEN];
  942.   
  943.        printf("%s\n", get_leaf_path(leaf, buf));
  944.        if (leaf->dirs)
  945. --- 365,375 ----
  946.   void print_paths_from(leaf)
  947.   filerec *leaf;
  948.   {
  949. !      /*
  950. !       * This is static to prevent multiple copies of it when calling
  951. !       * recursively.
  952. !       */
  953. !      static char buf[MAXPATHLEN];
  954.   
  955.        printf("%s\n", get_leaf_path(leaf, buf));
  956.        if (leaf->dirs)
  957. ***************
  958. *** 384,390 ****
  959.   void print_specified_paths_from(leaf)
  960.   filerec *leaf;
  961.   {
  962. !      char buf[MAXPATHLEN];
  963.   
  964.        if (leaf->specified)
  965.         printf("%s\n", get_leaf_path(leaf, buf));
  966. --- 384,394 ----
  967.   void print_specified_paths_from(leaf)
  968.   filerec *leaf;
  969.   {
  970. !      /*
  971. !       * This is static to prevent multiple copies of it when calling
  972. !       * recursively.
  973. !       */
  974. !      static char buf[MAXPATHLEN];
  975.   
  976.        if (leaf->specified)
  977.         printf("%s\n", get_leaf_path(leaf, buf));
  978. ***************
  979. *** 663,674 ****
  980.   char ***in_strings;
  981.   int *num;
  982.   {
  983. -      char newname[MAXPATHLEN];
  984.        char **strings;
  985.        int retval;
  986.        
  987.        strings = *in_strings;
  988.        if (leaf->specified) {
  989.         *num += 1;
  990.         strings = (char **) realloc((char *) strings, (unsigned)
  991.                         (sizeof(char *) * (*num)));
  992. --- 667,684 ----
  993.   char ***in_strings;
  994.   int *num;
  995.   {
  996.        char **strings;
  997.        int retval;
  998.        
  999.        strings = *in_strings;
  1000.        if (leaf->specified) {
  1001. +       /*
  1002. +        * This array is static so that only one copy of it is allocated,
  1003. +        * rather than one copy on the stack for each recursive
  1004. +        * invocation of accumulate_names.
  1005. +        */
  1006. +       static char newname[MAXPATHLEN];
  1007.         *num += 1;
  1008.         strings = (char **) realloc((char *) strings, (unsigned)
  1009.                         (sizeof(char *) * (*num)));
  1010. *** ../delete.old/pattern.c    Tue Nov 10 00:22:00 1992
  1011. --- pattern.c    Tue Nov 10 00:58:11 1992
  1012. ***************
  1013. *** 1,7 ****
  1014.   /*
  1015. -  * $Source: /afs/athena.mit.edu/astaff/project/delete/src/RCS/pattern.c,v $
  1016. -  * $Author: jik $
  1017. -  *
  1018.    * This program is part of a package including delete, undelete,
  1019.    * lsdel, expunge and purge.  The software suite is meant as a
  1020.    * replacement for rm which allows for file recovery.
  1021. --- 1,4 ----
  1022. ***************
  1023. *** 11,17 ****
  1024.    */
  1025.   
  1026.   #if (!defined(lint) && !defined(SABER))
  1027. !      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 $";
  1028.   #endif
  1029.   
  1030.   #include <stdio.h>
  1031. --- 8,14 ----
  1032.    */
  1033.   
  1034.   #if (!defined(lint) && !defined(SABER))
  1035. !      static char rcsid_pattern_c[] = "$Id: pattern.c,v 1.26 1992/11/10 05:57:24 jik Exp $";
  1036.   #endif
  1037.   
  1038.   #include <stdio.h>
  1039. ***************
  1040. *** 18,24 ****
  1041.   #include <sys/types.h>
  1042.   #ifdef POSIX
  1043.   #include <dirent.h>
  1044. - #define direct dirent
  1045.   #else
  1046.   #include <sys/dir.h>
  1047.   #endif
  1048. --- 15,20 ----
  1049. ***************
  1050. *** 422,428 ****
  1051. --- 418,428 ----
  1052.   Boolean match_undeleted, match_deleted;
  1053.   {
  1054.        char base[MAXPATHLEN];
  1055. + #ifdef POSIX
  1056. +      struct dirent *dp;
  1057. + #else
  1058.        struct direct *dp;
  1059. + #endif
  1060.        DIR *dirp;
  1061.        char first[MAXNAMLEN], rest[MAXPATHLEN];
  1062.        int retval;
  1063. ***************
  1064. *** 581,596 ****
  1065.              continue;
  1066.         }
  1067.   
  1068. !       if (! stat(base, &statbuf)) {
  1069. !            if ((statbuf.st_mode & S_IFMT) == S_IFDIR)
  1070. !             dirp = Opendir(base);
  1071. !       }
  1072. !       else {
  1073. !            dirp = NULL;
  1074. !       }
  1075.         if (! dirp) {
  1076. !            set_error(errno);
  1077. !            error(base);
  1078.              string_pop(base);
  1079.              string_pop(rest);
  1080.              string_pop(first);
  1081. --- 581,627 ----
  1082.              continue;
  1083.         }
  1084.   
  1085. !       /*
  1086. !        * The logic here in this attempt to descend is as follows:
  1087. !        *
  1088. !        * Try to stat base.  Succeeds?
  1089. !        * Yes:
  1090. !        *   Is it a directory?
  1091. !        *   Yes:
  1092. !        *     Try to open it.
  1093. !        *     Does the open succeed?
  1094. !        *     Yes:
  1095. !        *       Continue the loop.
  1096. !        *     No:
  1097. !        *       Print an error, and pop up to the last directory.
  1098. !        *   No:
  1099. !        *     Pop up to the last directory.
  1100. !        * No:
  1101. !        *   Try to lstat base.  Succeeds?
  1102. !        *   Yes:
  1103. !        *     Is it a directory?
  1104. !        *     Yes: see above.  *** this should never happen ***
  1105. !        *     No:
  1106. !        *       Pop up to the last directory.
  1107. !        *   No:
  1108. !        *     Print an error, and pop up to the last directory.
  1109. !        *
  1110. !        * The reason for the lstat is that we don't want to print
  1111. !        * errors when we can't descend because we're trying to go
  1112. !        * into a symlink pointing nowhere; a symlink pointing
  1113. !        * nowhere is not an error when matching, it just means that
  1114. !        * we can't descend.
  1115. !        */
  1116. !       dirp = NULL;
  1117. !       if (((! (retval = stat(base, &statbuf))) ||
  1118. !            (! (retval = lstat(base, &statbuf)))) &&
  1119. !           ((statbuf.st_mode & S_IFMT) == S_IFDIR))
  1120. !            dirp = Opendir(base);
  1121.         if (! dirp) {
  1122. !            if (retval || ((statbuf.st_mode & S_IFMT) == S_IFDIR)) {
  1123. !             set_error(errno);
  1124. !             error(base);
  1125. !            }
  1126.              string_pop(base);
  1127.              string_pop(rest);
  1128.              string_pop(first);
  1129. ***************
  1130. *** 743,749 ****
  1131. --- 774,784 ----
  1132.   int options;
  1133.   {
  1134.        char base[MAXPATHLEN];
  1135. + #ifdef POSIX
  1136. +      struct dirent *dp;
  1137. + #else
  1138.        struct direct *dp;
  1139. + #endif
  1140.        DIR *dirp;
  1141.        int retval;
  1142.        int strsize;
  1143. *** ../delete.old/malloc-test.c    Tue Nov 10 00:22:04 1992
  1144. --- malloc-test.c    Tue Nov 10 00:41:30 1992
  1145. ***************
  1146. *** 1,6 ****
  1147.   main()
  1148.   {
  1149.        printf("You %s define MALLOC_0_RETURNS_NULL.\n",
  1150. !         malloc(0) ? "should NOT" : "SHOULD");
  1151.        exit(0);
  1152.   }
  1153. --- 1,11 ----
  1154.   main()
  1155.   {
  1156. +      char *ptr1, *ptr2;
  1157. +      ptr1 = (char *) malloc(0);
  1158. +      ptr2 = (char *) realloc(ptr1, 0);
  1159.        printf("You %s define MALLOC_0_RETURNS_NULL.\n",
  1160. !         (ptr1 && ptr2) ? "should NOT" : "SHOULD");
  1161.        exit(0);
  1162.   }
  1163.  
  1164. -- 
  1165. Jonathan Kamens                                         jik@MIT.Edu
  1166. MIT Information Systems/Athena              Moderator, news.answers
  1167.  
  1168. exit 0 # Just in case...
  1169.