home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sources / misc / 4075 < prev    next >
Encoding:
Text File  |  1992-11-10  |  35.5 KB  |  1,180 lines

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