home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / minix / 5107 < prev    next >
Encoding:
Text File  |  1993-01-09  |  31.3 KB  |  1,131 lines

  1. Newsgroups: comp.os.minix
  2. Path: sparky!uunet!munnari.oz.au!metro!ipso!runxtsa!bde
  3. From: bde@runx.oz.au (Bruce Evans)
  4. Subject: Fixes for 1.6.24b commands [a-d]
  5. Message-ID: <1993Jan9.162101.14717@runx.oz.au>
  6. Organization: RUNX Un*x Timeshare.  Sydney, Australia.
  7. Date: Sat, 9 Jan 93 16:21:01 GMT
  8. Lines: 1121
  9.  
  10. Here are some fixes and improvements for the 1.6.24b commands/*.c files.
  11. The most important fixes are marked with a '!'.
  12.  
  13. arglist.c:
  14.     Kludge to get _PROTOTYPE defined.  The <stdio.h> in estdio does not
  15.     define it.  Most programs include more headers and chance to have it
  16.     defined somewhere else.
  17.  
  18. badblocks.c:
  19.     Don't use %d or %u to print "block_t num".  block_t is now long.
  20.  
  21.     Harmless printf format mismatches are fixed too.
  22.  
  23. cdiff.c:
  24.     ! Don't follow null pointers.
  25.  
  26. chmem.c:
  27.     Don't abort early when the size is too large for one file.  The
  28.     maximum now depends on the file.
  29.  
  30.     Reset errno after handling an error to try to avoid using a stale
  31.     errno in a report about a non-system error for the next file.
  32.  
  33.     This program needs to be reformatted.
  34.  
  35. chgrp.c:
  36.     This need not exist.  chmod.c and chgrp.c are completely independent
  37.     but both support both chmod and chgrp using linked binaries.  chmod.c
  38.     is now far more up to date.  The only reason for keeping both files
  39.     is that they have different copyrights.
  40.  
  41.     No changes here for this file.
  42.  
  43. cp.c, cpdir.c:
  44.     cpdir.c should not exist.  The cpdir binary is supposed to be a link
  45.     to the cp binary.
  46.  
  47.     cpdir.c was the most up to date.  It still had a flag test back to
  48.     front so that "cp /dev/null foo" tried to create the device.  cp.c
  49.     was missing support for symlinks and some fixes for comments.
  50.  
  51.     After patching cpdir.c, mv it to cp.c to delete the old cp.c, and
  52.     arrange for fixbin.sh to link /bin/cp to /bin/cpdir.
  53.  
  54.     The prototypes are from cp.c; pretty had munged them.
  55.  
  56.     Avoid warnings about if (foo = bar).
  57.  
  58.     ! The correct treatment of rflag and rrflag is from cp.c.
  59.  
  60.     ! Fix cp -p to change the modes properly when run as root.
  61.  
  62. cron.c:
  63.     Don't include <stdlib.h> twice.  The second one would undo
  64.     the kludge of including <stdio.h> last to get NULL redefined.
  65.  
  66. diskcheck.c:
  67.     Don't depend on ERROR being defined in <errno.h>.
  68.  
  69.     Use short for pat1, pat2 and testb arrays in all cases to avoid
  70.     ifdefs.
  71.  
  72.     Use off_t for file positions.  off_t is now unsigned long, so
  73.     using plain long tends to cause compiler warnings.
  74.  
  75.     Flush output after printf without a newline.
  76.  
  77.     Make purging work (incredibly slowly) on my system.  When there
  78.     are 2000 buffers it is painful to read that many for every block
  79.     tested.
  80.  
  81. diskcheck.c:
  82.     Avoid the usual long vs off_t type mismatches.
  83.  
  84.     ! Check the value returned by opendir().  opendir() often fails
  85.     due to lack of memory.
  86.  
  87.     ! Don't scanf into a uid_t using %d format.  uid_t is unsigned
  88.     short so it might be shorter than an int.
  89.  
  90.     ! Don't continue after malloc fails.
  91.  
  92. du.c:
  93.     Cleaned up.
  94.  
  95.     Improved counting and reporting.  See comments in the file for
  96.     details.  Still doesn't know about indirect blocks or zero blocks.
  97.  
  98. I will post changes to these files over the next few days:
  99.  
  100.     find.c fsck.c fsck2.c getlf.c getty.c hyphenate.c kill.c leave.c
  101.     login.c ls.c man.c mkfs.c mv.c ps.c roff.c sort.c stty.c su.c
  102.     swapfs.c term.c test.c time.c uname.c users.c
  103. ---
  104. #! /bin/sh
  105. # This is a shell archive.  Remove anything before this line, then unpack
  106. # it by saving it into a file and typing "sh file".  To overwrite existing
  107. # files, type "sh file -c".  You can also feed this as standard input via
  108. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  109. # will see the following message at the end:
  110. #        "End of shell archive."
  111. # Contents:  arglist.c.cd badblocks.c.cd cdiff.c.cd chmem.c.cd
  112. #   cpdir.c.cd cron.c.cd diskcheck.c.cd diskusage.c.cd du.c.cd
  113. # Wrapped by src@besplex on Sun Jan 10 02:41:30 1993
  114. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  115. if test -f 'arglist.c.cd' -a "${1}" != "-c" ; then 
  116.   echo shar: Will not clobber existing file \"'arglist.c.cd'\"
  117. else
  118. echo shar: Extracting \"'arglist.c.cd'\" \(495 characters\)
  119. sed "s/^X//" >'arglist.c.cd' <<'END_OF_FILE'
  120. X*** 1.6.24b/arglist.c  crc=02747    233    Sun Jan  3 12:44:57 1993
  121. X--- arglist.c  crc=02807    311    Sun Jan  3 15:14:28 1993
  122. X***************
  123. X*** 1,7 ****
  124. X  #include <stdio.h>
  125. X  
  126. X  _PROTOTYPE(int main, (int argc, char **argv));
  127. X  
  128. X! main(argc, argv)
  129. X  int argc;
  130. X  char *argv[];
  131. X--- 1,10 ----
  132. X+ /* XXX - using _PROTOTYPE destroys STDC conformance */
  133. X+ #include <ansi.h>
  134. X+ 
  135. X  #include <stdio.h>
  136. X  
  137. X  _PROTOTYPE(int main, (int argc, char **argv));
  138. X  
  139. X! int main(argc, argv)
  140. X  int argc;
  141. X  char *argv[];
  142. END_OF_FILE
  143. if test 495 -ne `wc -c <'arglist.c.cd'`; then
  144.     echo shar: \"'arglist.c.cd'\" unpacked with wrong size!
  145. fi
  146. # end of 'arglist.c.cd'
  147. fi
  148. if test -f 'badblocks.c.cd' -a "${1}" != "-c" ; then 
  149.   echo shar: Will not clobber existing file \"'badblocks.c.cd'\"
  150. else
  151. echo shar: Extracting \"'badblocks.c.cd'\" \(2575 characters\)
  152. sed "s/^X//" >'badblocks.c.cd' <<'END_OF_FILE'
  153. X*** 1.6.24b/badblocks.c  crc=08766  15365    Sun Jan  3 12:48:28 1993
  154. X--- badblocks.c  crc=62664  15472    Sun Jan  3 16:51:17 1993
  155. X***************
  156. X*** 124,128 ****
  157. X  struct stat stat_buf;
  158. X  struct super_block *sp;
  159. X! int inodes_per_block, inode_size;
  160. X  int v1fs;            /* TRUE for V1 file system, FALSE for V2 */
  161. X  
  162. X--- 124,129 ----
  163. X  struct stat stat_buf;
  164. X  struct super_block *sp;
  165. X! int inodes_per_block;
  166. X! size_t inode_size;
  167. X  int v1fs;            /* TRUE for V1 file system, FALSE for V2 */
  168. X  
  169. X***************
  170. X*** 148,154 ****
  171. X      rwd = write(fd, (char *) sp, SUPER_SIZE);
  172. X    if (rwd != SUPER_SIZE) {    /* ok ? */
  173. X!     printf("Bad %s in get_super() (should be %d is %d)\n",
  174. X             flag == READ ? "read" : "write",
  175. X!            SUPER_SIZE, rwd);
  176. X      done(DIR_CREATED);
  177. X    }
  178. X--- 149,155 ----
  179. X      rwd = write(fd, (char *) sp, SUPER_SIZE);
  180. X    if (rwd != SUPER_SIZE) {    /* ok ? */
  181. X!     printf("Bad %s in get_super() (should be %u is %d)\n",
  182. X             flag == READ ? "read" : "write",
  183. X!            (unsigned) SUPER_SIZE, rwd);
  184. X      done(DIR_CREATED);
  185. X    }
  186. X***************
  187. X*** 168,172 ****
  188. X    } else {
  189. X      /* Neither V1 nor V2. */
  190. X!     printf("Bad magic number in super_block (0x%x)\n", sp->s_magic);
  191. X      done(DIR_CREATED);
  192. X    }
  193. X--- 169,174 ----
  194. X    } else {
  195. X      /* Neither V1 nor V2. */
  196. X!     printf("Bad magic number in super_block (0x%x)\n",
  197. X!            (unsigned) sp->s_magic);
  198. X      done(DIR_CREATED);
  199. X    }
  200. X***************
  201. X*** 461,465 ****
  202. X    int i;
  203. X  
  204. X!   for (i = 0; i < blk_cnt; i++) printf("Block[%d] = %ld\n", i, block[i]);
  205. X  }
  206. X  
  207. X--- 463,468 ----
  208. X    int i;
  209. X  
  210. X!   for (i = 0; i < blk_cnt; i++)
  211. X!     printf("Block[%d] = %lu\n", i, (unsigned long) block[i]);
  212. X  }
  213. X  
  214. X***************
  215. X*** 488,492 ****
  216. X  
  217. X    if (blk_is_used(num)) {
  218. X!     printf("Duplicate block (%d) given\n", num);
  219. X      return NOT_OK;
  220. X    }
  221. X--- 491,495 ----
  222. X  
  223. X    if (blk_is_used(num)) {
  224. X!     printf("Duplicate block (%lu) given\n", (unsigned long) num);
  225. X      return NOT_OK;
  226. X    }
  227. X***************
  228. X*** 521,525 ****
  229. X      return OK;
  230. X    else {
  231. X!     printf("Bad number %d. ", num);
  232. X      printf("This zone (block) is marked in bitmap\n");
  233. X      return NOT_OK;
  234. X--- 524,528 ----
  235. X      return OK;
  236. X    else {
  237. X!     printf("Bad number %lu. ", (unsigned long) num);
  238. X      printf("This zone (block) is marked in bitmap\n");
  239. X      return NOT_OK;
  240. X***************
  241. X*** 567,571 ****
  242. X      return;
  243. X    }
  244. X!   printf("Bit map indicates that block %u is in use. Not marked.\n", num);
  245. X  /*  done(DIR_CREATED); */
  246. X    return;
  247. X--- 570,575 ----
  248. X      return;
  249. X    }
  250. X!   printf("Bit map indicates that block %lu is in use. Not marked.\n",
  251. X!      (unsigned long) num);
  252. X  /*  done(DIR_CREATED); */
  253. X    return;
  254. END_OF_FILE
  255. if test 2575 -ne `wc -c <'badblocks.c.cd'`; then
  256.     echo shar: \"'badblocks.c.cd'\" unpacked with wrong size!
  257. fi
  258. # end of 'badblocks.c.cd'
  259. fi
  260. if test -f 'cdiff.c.cd' -a "${1}" != "-c" ; then 
  261.   echo shar: Will not clobber existing file \"'cdiff.c.cd'\"
  262. else
  263. echo shar: Extracting \"'cdiff.c.cd'\" \(724 characters\)
  264. sed "s/^X//" >'cdiff.c.cd' <<'END_OF_FILE'
  265. X*** 1.6.24b/cdiff.c  crc=27806   7109    Sun Jan  3 12:48:30 1993
  266. X--- cdiff.c  crc=32541   7107    Mon Jan  4 15:39:37 1993
  267. X***************
  268. X*** 187,191 ****
  269. X          for (i = oldbeg; i <= oldmax; i++) {
  270. X              line = getold(i);
  271. X!             if (!*line) {
  272. X                  oldend = oldmax = i - 1;
  273. X                  break;
  274. X--- 187,191 ----
  275. X          for (i = oldbeg; i <= oldmax; i++) {
  276. X              line = getold(i);
  277. X!             if (!line) {
  278. X                  oldend = oldmax = i - 1;
  279. X                  break;
  280. X***************
  281. X*** 210,214 ****
  282. X          for (i = newbeg; i <= newmax; i++) {
  283. X              line = getnew(i);
  284. X!             if (!*line) {
  285. X                  newend = newmax = i - 1;
  286. X                  break;
  287. X--- 210,214 ----
  288. X          for (i = newbeg; i <= newmax; i++) {
  289. X              line = getnew(i);
  290. X!             if (!line) {
  291. X                  newend = newmax = i - 1;
  292. X                  break;
  293. END_OF_FILE
  294. if test 724 -ne `wc -c <'cdiff.c.cd'`; then
  295.     echo shar: \"'cdiff.c.cd'\" unpacked with wrong size!
  296. fi
  297. # end of 'cdiff.c.cd'
  298. fi
  299. if test -f 'chmem.c.cd' -a "${1}" != "-c" ; then 
  300.   echo shar: Will not clobber existing file \"'chmem.c.cd'\"
  301. else
  302. echo shar: Extracting \"'chmem.c.cd'\" \(455 characters\)
  303. sed "s/^X//" >'chmem.c.cd' <<'END_OF_FILE'
  304. X*** 1.6.24b/chmem.c  crc=23511   3335    Sun Jan  3 12:48:31 1993
  305. X--- chmem.c  crc=56602   3358    Tue Jan  5 02:35:32 1993
  306. X***************
  307. X*** 97,102 ****
  308. X      if (lsize > max)
  309. X      {
  310. X!           error(p + 1, "is too large");
  311. X!         exit(1);
  312. X      }
  313. X      
  314. X--- 97,102 ----
  315. X      if (lsize > max)
  316. X      {
  317. X!           error("size is too large for", *argv);
  318. X!         continue;
  319. X      }
  320. X      
  321. X***************
  322. X*** 138,141 ****
  323. X--- 138,142 ----
  324. X    else
  325. X      fprintf(stderr, "%s\n", s2);
  326. X+   errno = 0;
  327. X  }
  328. X  
  329. END_OF_FILE
  330. if test 455 -ne `wc -c <'chmem.c.cd'`; then
  331.     echo shar: \"'chmem.c.cd'\" unpacked with wrong size!
  332. fi
  333. # end of 'chmem.c.cd'
  334. fi
  335. if test -f 'cpdir.c.cd' -a "${1}" != "-c" ; then 
  336.   echo shar: Will not clobber existing file \"'cpdir.c.cd'\"
  337. else
  338. echo shar: Extracting \"'cpdir.c.cd'\" \(4076 characters\)
  339. sed "s/^X//" >'cpdir.c.cd' <<'END_OF_FILE'
  340. X*** 1.6.24b/cpdir.c  crc=01274  12817    Sun Jan  3 12:48:33 1993
  341. X--- cpdir.c  crc=09981  12849    Sat Jan  9 01:21:19 1993
  342. X***************
  343. X*** 70,76 ****
  344. X  _PROTOTYPE(void doing, (char *what, char *with, char *on));
  345. X  _PROTOTYPE(void do_close, (void));
  346. X! _PROTOTYPE(void similar, (struct stat * sp));
  347. X! _PROTOTYPE(void do_cpfile, (int new, struct stat * st));
  348. X! _PROTOTYPE(void do_cpdir, (int new, struct stat * oldmode, TREE * dotdot));
  349. X  _PROTOTYPE(int do_cp, (char *source));
  350. X  _PROTOTYPE(void usage, (void));
  351. X--- 70,76 ----
  352. X  _PROTOTYPE(void doing, (char *what, char *with, char *on));
  353. X  _PROTOTYPE(void do_close, (void));
  354. X! _PROTOTYPE(void similar, (struct stat *sp));
  355. X! _PROTOTYPE(void do_cpfile, (int new, struct stat *st));
  356. X! _PROTOTYPE(void do_cpdir, (int new, struct stat *oldmode, TREE *dotdot));
  357. X  _PROTOTYPE(int do_cp, (char *source));
  358. X  _PROTOTYPE(void usage, (void));
  359. X***************
  360. X*** 92,96 ****
  361. X    struct stat st;
  362. X  
  363. X!   if (s = strrchr(*argv, '/'))
  364. X      s++;
  365. X    else
  366. X--- 92,96 ----
  367. X    struct stat st;
  368. X  
  369. X!   if ((s = strrchr(*argv, '/')) != NULL)
  370. X      s++;
  371. X    else
  372. X***************
  373. X*** 99,102 ****
  374. X--- 99,103 ----
  375. X      cflag = 1;
  376. X      rflag = 1;
  377. X+     rrflag = 1;
  378. X    }
  379. X    opterr = 0;
  380. X***************
  381. X*** 115,121 ****
  382. X          case 'p':    pflag = 1;    break;
  383. X          case 'v':    vflag = 1;    break;
  384. X!         case 'r':
  385. X!         if (!cflag) rrflag = 1;
  386. X!         case 'R':    rflag = 1;    break;
  387. X          default:    usage();
  388. X      }
  389. X--- 116,121 ----
  390. X          case 'p':    pflag = 1;    break;
  391. X          case 'v':    vflag = 1;    break;
  392. X!         case 'R':    rrflag = 1;
  393. X!         case 'r':    rflag = 1;    break;
  394. X          default:    usage();
  395. X      }
  396. X***************
  397. X*** 225,229 ****
  398. X      errors = 1;
  399. X    }
  400. X!   if (userid || chown(dst_path, sp->st_uid, sp->st_gid))
  401. X      sp->st_mode &= ALL_MODES;
  402. X    if (chmod(dst_path, sp->st_mode)) {
  403. X--- 225,229 ----
  404. X      errors = 1;
  405. X    }
  406. X!   if (chown(dst_path, sp->st_uid, sp->st_gid) || userid != 0)
  407. X      sp->st_mode &= ALL_MODES;
  408. X    if (chmod(dst_path, sp->st_mode)) {
  409. X***************
  410. X*** 288,292 ****
  411. X      if ((linkp = (LINK *) malloc(sizeof(LINK))) == (LINK *) 0)
  412. X          perror(dst_path);
  413. X!     else if ((linkp->path = (char *) malloc(strlen(dst_path) + 1)) == NONE) {
  414. X          perror(dst_path);
  415. X          free(linkp);
  416. X--- 288,292 ----
  417. X      if ((linkp = (LINK *) malloc(sizeof(LINK))) == (LINK *) 0)
  418. X          perror(dst_path);
  419. X!     else if ((linkp->path = (char *)malloc(strlen(dst_path) + 1)) == NONE){
  420. X          perror(dst_path);
  421. X          free(linkp);
  422. X***************
  423. X*** 303,307 ****
  424. X        S_ISLNK(st->st_mode) ||
  425. X  #endif
  426. X!       !rrflag && (S_ISBLK(st->st_mode) ||
  427. X          S_ISCHR(st->st_mode) || S_ISFIFO(st->st_mode))) {
  428. X      if (!new) {
  429. X--- 303,307 ----
  430. X        S_ISLNK(st->st_mode) ||
  431. X  #endif
  432. X!       rrflag && (S_ISBLK(st->st_mode) ||
  433. X          S_ISCHR(st->st_mode) || S_ISFIFO(st->st_mode))) {
  434. X      if (!new) {
  435. X***************
  436. X*** 380,384 ****
  437. X      return;
  438. X    }
  439. X!   while (n = read(fd, buffer, sizeof(buffer))) {
  440. X      if (n < 0) {
  441. X          perror(src_path);
  442. X--- 380,384 ----
  443. X      return;
  444. X    }
  445. X!   while ((n = read(fd, buffer, sizeof(buffer))) != 0) {
  446. X      if (n < 0) {
  447. X          perror(src_path);
  448. X***************
  449. X*** 495,499 ****
  450. X              stat(src_path, &d.st)
  451. X  #endif
  452. X!             ) {
  453. X              perror(src);
  454. X              errors = 1;
  455. X--- 495,499 ----
  456. X              stat(src_path, &d.st)
  457. X  #endif
  458. X!            ) {
  459. X              perror(src);
  460. X              errors = 1;
  461. X***************
  462. X*** 502,506 ****
  463. X          d.pos = entp->d_off;
  464. X  
  465. X!         if (new2 = stat(dst_path, &st2)) {
  466. X              if (S_ISDIR(d.st.st_mode)) {
  467. X                  do_cpdir(new2, &d.st, &d);
  468. X--- 502,506 ----
  469. X          d.pos = entp->d_off;
  470. X  
  471. X!         if ((new2 = stat(dst_path, &st2)) != 0) {
  472. X              if (S_ISDIR(d.st.st_mode)) {
  473. X                  do_cpdir(new2, &d.st, &d);
  474. X***************
  475. X*** 555,559 ****
  476. X    strcpy(dst_path, dest);
  477. X    if (dflag) {
  478. X!     if (s = strrchr(source, '/'))
  479. X          strcat(dst_path, s);
  480. X      else {
  481. X--- 555,559 ----
  482. X    strcpy(dst_path, dest);
  483. X    if (dflag) {
  484. X!     if ((s = strrchr(source, '/')) != NULL)
  485. X          strcat(dst_path, s);
  486. X      else {
  487. X***************
  488. X*** 567,571 ****
  489. X          std_err(",");
  490. X          std_err(dst_path);
  491. X!         std_err(": Same files\n");
  492. X          return(1);
  493. X      }
  494. X--- 567,571 ----
  495. X          std_err(",");
  496. X          std_err(dst_path);
  497. X!         std_err(": Same file\n");
  498. X          return(1);
  499. X      }
  500. END_OF_FILE
  501. if test 4076 -ne `wc -c <'cpdir.c.cd'`; then
  502.     echo shar: \"'cpdir.c.cd'\" unpacked with wrong size!
  503. fi
  504. # end of 'cpdir.c.cd'
  505. fi
  506. if test -f 'cron.c.cd' -a "${1}" != "-c" ; then 
  507.   echo shar: Will not clobber existing file \"'cron.c.cd'\"
  508. else
  509. echo shar: Extracting \"'cron.c.cd'\" \(270 characters\)
  510. sed "s/^X//" >'cron.c.cd' <<'END_OF_FILE'
  511. X*** 1.6.24b/cron.c  crc=57855   8539    Sun Jan  3 12:48:34 1993
  512. X--- cron.c  crc=65530   8519    Fri Jul 12 14:59:45 1991
  513. X***************
  514. X*** 44,48 ****
  515. X  #include <sys/wait.h>
  516. X  #include <stdio.h>
  517. X- #include <stdlib.h>
  518. X  
  519. X  #define CRONTAB        "/usr/lib/crontab"
  520. X--- 44,47 ----
  521. END_OF_FILE
  522. if test 270 -ne `wc -c <'cron.c.cd'`; then
  523.     echo shar: \"'cron.c.cd'\" unpacked with wrong size!
  524. fi
  525. # end of 'cron.c.cd'
  526. fi
  527. if test -f 'diskcheck.c.cd' -a "${1}" != "-c" ; then 
  528.   echo shar: Will not clobber existing file \"'diskcheck.c.cd'\"
  529. else
  530. echo shar: Extracting \"'diskcheck.c.cd'\" \(5503 characters\)
  531. sed "s/^X//" >'diskcheck.c.cd' <<'END_OF_FILE'
  532. X*** 1.6.24b/diskcheck.c  crc=55647   5309    Sun Jan  3 12:48:35 1993
  533. X--- diskcheck.c  crc=25422   5487    Tue Jan  5 02:12:41 1993
  534. X***************
  535. X*** 13,30 ****
  536. X  #include <stdio.h>
  537. X  
  538. X  #define OK 0
  539. X  #define PRINTFREQ  10
  540. X  #define N 30
  541. X  
  542. X  char purgebuf[BLOCK_SIZE * N];
  543. X  char buf[BLOCK_SIZE], zero[BLOCK_SIZE];
  544. X! 
  545. X! /* There are some tricks used here, that only work if ints are 16 bits. */
  546. X! #ifndef INTEL_32BITS
  547. X! int pat1[BLOCK_SIZE / 2], pat2[BLOCK_SIZE / 2];
  548. X! #else
  549. X! short pat1[BLOCK_SIZE / 2], pat2[BLOCK_SIZE / 2];
  550. X! #endif
  551. X! 
  552. X  int blk = -1;            /* number of the block in buf, or -1 */
  553. X  int pfd;            /* file descriptor for purging */
  554. X--- 13,26 ----
  555. X  #include <stdio.h>
  556. X  
  557. X+ #undef ERROR            /* ERROR might be defined in <errno.h> :-( */
  558. X+ #define ERROR (-99)
  559. X  #define OK 0
  560. X  #define PRINTFREQ  10
  561. X  #define N 30
  562. X+ #define SHORTS_PER_BLOCK (BLOCK_SIZE / sizeof(short))
  563. X  
  564. X  char purgebuf[BLOCK_SIZE * N];
  565. X  char buf[BLOCK_SIZE], zero[BLOCK_SIZE];
  566. X! short pat1[SHORTS_PER_BLOCK], pat2[SHORTS_PER_BLOCK];
  567. X  int blk = -1;            /* number of the block in buf, or -1 */
  568. X  int pfd;            /* file descriptor for purging */
  569. X***************
  570. X*** 34,42 ****
  571. X  unsigned limit;            /* first block beyond test zone */
  572. X  unsigned errors;        /* # errors so far */
  573. X! unsigned ct = 0;        /* # blocks read so far */
  574. X  int intflag;            /* set when signal seen */
  575. X  int rawdev;            /* set when I/O done on raw device */
  576. X- extern errno;
  577. X- long pos;
  578. X  char *purgefile = "/dev/ram";
  579. X  
  580. X--- 30,36 ----
  581. X  unsigned limit;            /* first block beyond test zone */
  582. X  unsigned errors;        /* # errors so far */
  583. X! unsigned ct;            /* # blocks read so far */
  584. X  int intflag;            /* set when signal seen */
  585. X  int rawdev;            /* set when I/O done on raw device */
  586. X  char *purgefile = "/dev/ram";
  587. X  
  588. X***************
  589. X*** 48,52 ****
  590. X  _PROTOTYPE(void catch, (int sig ));
  591. X  _PROTOTYPE(void usage, (void ));
  592. X! _PROTOTYPE(int wtest, (long pos , int pat []));
  593. X  _PROTOTYPE(void purge_cache, (void ));
  594. X  
  595. X--- 42,46 ----
  596. X  _PROTOTYPE(void catch, (int sig ));
  597. X  _PROTOTYPE(void usage, (void ));
  598. X! _PROTOTYPE(int wtest, (off_t pos , short *pat ));
  599. X  _PROTOTYPE(void purge_cache, (void ));
  600. X  
  601. X***************
  602. X*** 79,83 ****
  603. X    if (limit <= initblock) usage();
  604. X  
  605. X!   for (i = 0; i < BLOCK_SIZE / 2; i++) {
  606. X      pat1[i] = i;
  607. X      pat2[i] = 1000 - i;
  608. X--- 73,77 ----
  609. X    if (limit <= initblock) usage();
  610. X  
  611. X!   for (i = 0; i < SHORTS_PER_BLOCK; i++) {
  612. X      pat1[i] = i;
  613. X      pat2[i] = 1000 - i;
  614. X***************
  615. X*** 90,94 ****
  616. X          if (blk == b) {
  617. X              /* Read ok, write failed; try to restore block. */
  618. X!             lseek(fd, pos, SEEK_SET);
  619. X              write(fd, buf, BLOCK_SIZE);
  620. X          }
  621. X--- 84,88 ----
  622. X          if (blk == b) {
  623. X              /* Read ok, write failed; try to restore block. */
  624. X!             lseek(fd, (off_t) BLOCK_SIZE * (off_t) b, SEEK_SET);
  625. X              write(fd, buf, BLOCK_SIZE);
  626. X          }
  627. X***************
  628. X*** 113,120 ****
  629. X   */
  630. X  
  631. X    int s;
  632. X  
  633. X    blk = -1;
  634. X!   pos = (long) BLOCK_SIZE *(long) b;
  635. X    purge_cache();
  636. X    if (lseek(fd, pos, SEEK_SET) != pos) fatal("Cannot seek to block ", b);
  637. X--- 107,115 ----
  638. X   */
  639. X  
  640. X+   off_t pos;
  641. X    int s;
  642. X  
  643. X    blk = -1;
  644. X!   pos = (off_t) BLOCK_SIZE * (off_t) b;
  645. X    purge_cache();
  646. X    if (lseek(fd, pos, SEEK_SET) != pos) fatal("Cannot seek to block ", b);
  647. X***************
  648. X*** 156,159 ****
  649. X--- 151,155 ----
  650. X    printf("%8u blocks tested, %u errors detected (last block tested = %5u)\r",
  651. X           ct, errors, curblock);
  652. X+   fflush(stdout);
  653. X  }
  654. X  
  655. X***************
  656. X*** 191,206 ****
  657. X  
  658. X  int wtest(pos, pat)
  659. X! long pos;
  660. X! #ifndef INTEL_32BITS
  661. X! int pat[];
  662. X! #else
  663. X! short pat[];
  664. X! #endif
  665. X  {
  666. X! #ifndef INTEL_32BITS
  667. X!   int testb[BLOCK_SIZE / 2];
  668. X! #else
  669. X!   short testb[BLOCK_SIZE / 2];
  670. X! #endif
  671. X    int i;
  672. X  
  673. X--- 187,194 ----
  674. X  
  675. X  int wtest(pos, pat)
  676. X! off_t pos;
  677. X! short *pat;
  678. X  {
  679. X!   short testb[SHORTS_PER_BLOCK];
  680. X    int i;
  681. X  
  682. X***************
  683. X*** 211,215 ****
  684. X    lseek(fd, pos, SEEK_SET);
  685. X    if (read(fd, (char *) testb, BLOCK_SIZE) != BLOCK_SIZE) return(ERROR);
  686. X!   for (i = 0; i < BLOCK_SIZE / 2; i++)
  687. X      if (testb[i] != pat[i]) {
  688. X          printf("%d %d\n", testb[i], pat[i]);
  689. X--- 199,203 ----
  690. X    lseek(fd, pos, SEEK_SET);
  691. X    if (read(fd, (char *) testb, BLOCK_SIZE) != BLOCK_SIZE) return(ERROR);
  692. X!   for (i = 0; i < SHORTS_PER_BLOCK; i++)
  693. X      if (testb[i] != pat[i]) {
  694. X          printf("%d %d\n", testb[i], pat[i]);
  695. X***************
  696. X*** 227,234 ****
  697. X    if (rawdev) return;
  698. X    pfd = open(purgefile, O_RDONLY);
  699. X    left = NR_BUFS;
  700. X    while (left > 0) {
  701. X      count = (left < N ? left : N);
  702. X!     if ((r = read(pfd, purgebuf, count * BLOCK_SIZE)) != count * BLOCK_SIZE) {
  703. X          if (r == 0) {
  704. X              if (!warned) printf("WARNING: Cannot purge cache.\n");
  705. X--- 215,231 ----
  706. X    if (rawdev) return;
  707. X    pfd = open(purgefile, O_RDONLY);
  708. X+ #ifdef NR_BUFS
  709. X    left = NR_BUFS;
  710. X+ #else
  711. X+   /* XXX - buffers are dynamically allocated and there are likely to be
  712. X+    * several MB worth.  This purge is unlikely to work.  There should be
  713. X+    * raw devices to avoid such complications.
  714. X+    */
  715. X+   left = 8000;
  716. X+ #endif
  717. X    while (left > 0) {
  718. X      count = (left < N ? left : N);
  719. X!     r = read(pfd, purgebuf, (size_t) (count * BLOCK_SIZE));
  720. X!     if (r != count * BLOCK_SIZE) {
  721. X          if (r == 0) {
  722. X              if (!warned) printf("WARNING: Cannot purge cache.\n");
  723. X***************
  724. X*** 237,241 ****
  725. X          }
  726. X          printf("ERROR: count=%d  left=%d r=%d.  ", count, left, r);
  727. X!         fatal("Cannot purge cache.  errno= ", errno);
  728. X      }
  729. X      left -= count;
  730. X--- 234,238 ----
  731. X          }
  732. X          printf("ERROR: count=%d  left=%d r=%d.  ", count, left, r);
  733. X!         fatal("Cannot purge cache.  errno= ", (unsigned) errno);
  734. X      }
  735. X      left -= count;
  736. END_OF_FILE
  737. if test 5503 -ne `wc -c <'diskcheck.c.cd'`; then
  738.     echo shar: \"'diskcheck.c.cd'\" unpacked with wrong size!
  739. fi
  740. # end of 'diskcheck.c.cd'
  741. fi
  742. if test -f 'diskusage.c.cd' -a "${1}" != "-c" ; then 
  743.   echo shar: Will not clobber existing file \"'diskusage.c.cd'\"
  744. else
  745. echo shar: Extracting \"'diskusage.c.cd'\" \(3095 characters\)
  746. sed "s/^X//" >'diskusage.c.cd' <<'END_OF_FILE'
  747. X*** 1.6.24b/diskusage.c  crc=18858  12822    Sun Jan  3 12:44:58 1993
  748. X--- diskusage.c  crc=56940  13058    Sat Jan  9 01:57:10 1993
  749. X***************
  750. X*** 53,56 ****
  751. X--- 53,57 ----
  752. X  #include <string.h>
  753. X  #include <dirent.h>
  754. X+ #include <errno.h>
  755. X  #include <limits.h>
  756. X  #include <blocksize.h>
  757. X***************
  758. X*** 105,109 ****
  759. X  _PROTOTYPE(void make_userlist, (void));
  760. X  _PROTOTYPE(void showlist, (void));
  761. X! _PROTOTYPE(int update_list, (Uid_t uid, long bytes));
  762. X  _PROTOTYPE(void search_all, (char *cur_dir));
  763. X  _PROTOTYPE(int ilist_search, (char *path));
  764. X--- 106,110 ----
  765. X  _PROTOTYPE(void make_userlist, (void));
  766. X  _PROTOTYPE(void showlist, (void));
  767. X! _PROTOTYPE(int update_list, (Uid_t uid, off_t bytes));
  768. X  _PROTOTYPE(void search_all, (char *cur_dir));
  769. X  _PROTOTYPE(int ilist_search, (char *path));
  770. X***************
  771. X*** 183,187 ****
  772. X  int update_list(uid, bytes)    /* Increment uid's total.   */
  773. X  Uid_t uid;            /* If uid has duplicates    */
  774. X! long bytes;            /* will be charged to first. */
  775. X  {
  776. X    USEREC *curs;
  777. X--- 184,188 ----
  778. X  int update_list(uid, bytes)    /* Increment uid's total.   */
  779. X  Uid_t uid;            /* If uid has duplicates    */
  780. X! off_t bytes;            /* will be charged to first. */
  781. X  {
  782. X    USEREC *curs;
  783. X***************
  784. X*** 216,220 ****
  785. X    }
  786. X    dp1 = opendir(cur_dir);
  787. X!   while (this_file = readdir(dp1)) {    /* Iterate through this directory */
  788. X      if (strcmp(this_file->d_name, ".") &&
  789. X          strcmp(this_file->d_name, "..")) {
  790. X--- 217,226 ----
  791. X    }
  792. X    dp1 = opendir(cur_dir);
  793. X!   if (dp1 == NULL) {
  794. X!     fprintf(stderr, "Opendir returned NULL.  (%s).\n", strerror(errno));
  795. X!     exit(EXIT_FAILURE);
  796. X!   }
  797. X!   while ((this_file = readdir(dp1)) != NULL) {
  798. X!     /* Iterate through this directory */
  799. X      if (strcmp(this_file->d_name, ".") &&
  800. X          strcmp(this_file->d_name, "..")) {
  801. X***************
  802. X*** 295,298 ****
  803. X--- 301,305 ----
  804. X    uid_t m_uid;
  805. X    long m_blocks;
  806. X+   unsigned scan_uid;
  807. X    progname = argv[0];
  808. X    argc--;
  809. X***************
  810. X*** 378,382 ****
  811. X          }
  812. X          while (fgets(line, PLENGTH, dskusg)) {
  813. X!             sscanf(line, "%d%s%ld", &m_uid, mf1, &m_blocks);
  814. X              if (!exists(list_head, m_uid)) {
  815. X                  m_rec = (USEREC *) malloc(sizeof(USEREC));
  816. X--- 385,390 ----
  817. X          }
  818. X          while (fgets(line, PLENGTH, dskusg)) {
  819. X!             sscanf(line, "%u%s%ld", &scan_uid, mf1, &m_blocks);
  820. X!             m_uid = scan_uid;
  821. X              if (!exists(list_head, m_uid)) {
  822. X                  m_rec = (USEREC *) malloc(sizeof(USEREC));
  823. X***************
  824. X*** 389,393 ****
  825. X                  insert(&list_head, m_rec);
  826. X              }    /* if !exist */
  827. X!             update_list((Uid_t) m_uid, BLOCK_SIZE * m_blocks);
  828. X          }        /* while fgets */
  829. X          fclose(dskusg);
  830. X--- 397,402 ----
  831. X                  insert(&list_head, m_rec);
  832. X              }    /* if !exist */
  833. X!             update_list((Uid_t) m_uid,
  834. X!                     (off_t) BLOCK_SIZE * m_blocks);
  835. X          }        /* while fgets */
  836. X          fclose(dskusg);
  837. X***************
  838. X*** 464,469 ****
  839. X  void *ptr;
  840. X  {
  841. X!   if (ptr == NULL)
  842. X      fprintf(stderr, 
  843. X            "Malloc returned NULL.  Use chmem to allocate more stack\n");
  844. X  }
  845. X--- 473,480 ----
  846. X  void *ptr;
  847. X  {
  848. X!   if (ptr == NULL) {
  849. X      fprintf(stderr, 
  850. X            "Malloc returned NULL.  Use chmem to allocate more stack\n");
  851. X+     exit(EXIT_FAILURE);
  852. X+   }
  853. X  }
  854. END_OF_FILE
  855. if test 3095 -ne `wc -c <'diskusage.c.cd'`; then
  856.     echo shar: \"'diskusage.c.cd'\" unpacked with wrong size!
  857. fi
  858. # end of 'diskusage.c.cd'
  859. fi
  860. if test -f 'du.c.cd' -a "${1}" != "-c" ; then 
  861.   echo shar: Will not clobber existing file \"'du.c.cd'\"
  862. else
  863. echo shar: Extracting \"'du.c.cd'\" \(6647 characters\)
  864. sed "s/^X//" >'du.c.cd' <<'END_OF_FILE'
  865. X*** 1.6.24b/du.c  crc=10307   4442    Sun Jan  3 12:48:36 1993
  866. X--- du.c  crc=17350   4765    Mon Jan  4 02:23:13 1993
  867. X***************
  868. X*** 6,10 ****
  869. X   *            1.3    31 Mar 89    nick@nswitgould.oz
  870. X   *            1.4    22 Feb 90    meulenbr@cst.prl.philips.nl
  871. X!  *            1.5    01 Oct 92    kjb@cs.vu.nl
  872. X   *
  873. X   *    Copyright 1987, Joypace Ltd., London UK. All rights reserved.
  874. X--- 6,12 ----
  875. X   *            1.3    31 Mar 89    nick@nswitgould.oz
  876. X   *            1.4    22 Feb 90    meulenbr@cst.prl.philips.nl
  877. X!  *            1.5    09 Jul 91    hp@vmars.tuwien.ac.at
  878. X!  *            1.6    01 Oct 92    kjb@cs.vu.nl
  879. X!  *            1.7    04 Jan 93    bde
  880. X   *
  881. X   *    Copyright 1987, Joypace Ltd., London UK. All rights reserved.
  882. X***************
  883. X*** 17,22 ****
  884. X   *  1.3:    Add [-l levels] option to restrict printing.
  885. X   *  1.4:    Added processing of multiple arguments
  886. X!  *  1.5:    Use readdir
  887. X!  *
  888. X   */
  889. X  
  890. X--- 19,31 ----
  891. X   *  1.3:    Add [-l levels] option to restrict printing.
  892. X   *  1.4:    Added processing of multiple arguments
  893. X!  *  1.5:    Fixed processing of multiple arguments. General cleanup.
  894. X!  *  1.6:    Use readdir
  895. X!  *  1.7:    Merged 1.5 and 1.6.
  896. X!  *        Print totals even for non-dirs at top level.
  897. X!  *        Count blocks for each dir before printing total for the dir.
  898. X!  *        Count blocks for all non-special files.
  899. X!  *        Don't clutter link buffer with directories.
  900. X!  *  TODO    Report all errors.  Count indirect blocks.  Don't forget
  901. X!  *        links.
  902. X   */
  903. X  
  904. X***************
  905. X*** 24,29 ****
  906. X--- 33,41 ----
  907. X  #include <sys/types.h>
  908. X  #include <sys/stat.h>
  909. X+ #include <blocksize.h>
  910. X  #include <fcntl.h>
  911. X  #include <blocksize.h>
  912. X+ #include <errno.h>
  913. X+ #include <limits.h>
  914. X  #include <stdlib.h>
  915. X  #include <string.h>
  916. X***************
  917. X*** 35,46 ****
  918. X  extern int optind;
  919. X  
  920. X! char *prog;            /* program name */
  921. X! char *optstr = "asl:";        /* -a and -s arguments */
  922. X! int silent = 0;            /* silent mode */
  923. X! int all = 0;            /* all directory entries mode */
  924. X! char *startdir = ".";        /* starting from here */
  925. X! int levels = 255;        /* # of directory levels to print */
  926. X! 
  927. X! #define    LINELEN 256
  928. X  
  929. X  #ifdef S_IFLNK
  930. X--- 47,52 ----
  931. X  extern int optind;
  932. X  
  933. X! #define    LINELEN        256
  934. X! #define    MAXALREADY    512
  935. X  
  936. X  #ifdef S_IFLNK
  937. X***************
  938. X*** 50,80 ****
  939. X  #endif
  940. X  
  941. X! typedef struct _alstr {
  942. X    int al_dev;
  943. X    ino_t al_inum;
  944. X  } ALREADY;
  945. X  
  946. X- #define    MAXALREADY    50
  947. X- ALREADY already[MAXALREADY];
  948. X- int alc = 0;
  949. X- 
  950. X  _PROTOTYPE(int main, (int argc, char **argv));
  951. X- _PROTOTYPE(char *myindex, (char *s, int c));
  952. X  _PROTOTYPE(int makedname, (char *d, char *f, char *out, int outlen));
  953. X  _PROTOTYPE(int done, (int dev, Ino_t inum));
  954. X  _PROTOTYPE(long dodir, (char *d, int thislev));
  955. X  
  956. X! /*
  957. X!  *    myindex - stop the scanf bug
  958. X!  */
  959. X! char *myindex(s, c)
  960. X! register char *s;
  961. X! register char c;
  962. X! {
  963. X!   for (; *s; s++)
  964. X!     if (*s == c) return(s);
  965. X!   return(NULL);
  966. X! }
  967. X  
  968. X  /*
  969. X   *    makedname - make the pathname from the directory name, and the
  970. X--- 56,79 ----
  971. X  #endif
  972. X  
  973. X! typedef struct {
  974. X    int al_dev;
  975. X    ino_t al_inum;
  976. X  } ALREADY;
  977. X  
  978. X  _PROTOTYPE(int main, (int argc, char **argv));
  979. X  _PROTOTYPE(int makedname, (char *d, char *f, char *out, int outlen));
  980. X  _PROTOTYPE(int done, (int dev, Ino_t inum));
  981. X  _PROTOTYPE(long dodir, (char *d, int thislev));
  982. X  
  983. X! char *prog;            /* program name */
  984. X! char *optstr = "asl:";        /* -a and -s arguments */
  985. X! int silent = 0;            /* silent mode */
  986. X! int all = 0;            /* all directory entries mode */
  987. X! char *startdir = ".";        /* starting from here */
  988. X! int levels = INT_MAX;        /* # of directory levels to print */
  989. X! ALREADY already[MAXALREADY];
  990. X! int alc;
  991. X  
  992. X+ 
  993. X  /*
  994. X   *    makedname - make the pathname from the directory name, and the
  995. X***************
  996. X*** 91,97 ****
  997. X    int length;
  998. X  
  999. X-   /* Find length of directory entry */
  1000. X    length = strlen(f);
  1001. X- 
  1002. X    if (strlen(d) + length + 2 > outlen) return(0);
  1003. X    for (cp = out; *d; *cp++ = *d++);
  1004. X--- 90,94 ----
  1005. X***************
  1006. X*** 134,179 ****
  1007. X  int thislev;
  1008. X  {
  1009. X    struct stat s;
  1010. X!   long total = 0L;
  1011. X    char dent[LINELEN];
  1012. X    DIR *dp;
  1013. X    struct dirent *entry;
  1014. X  
  1015. X!   if ((dp = opendir(d)) == NULL) return(0L);
  1016. X!   while ((entry = readdir(dp)) != NULL) {
  1017. X!     if (strcmp(entry->d_name, ".") == 0 ||
  1018. X!         strcmp(entry->d_name, "..") == 0)
  1019. X!         continue;
  1020. X!     if (!makedname(d, entry->d_name, dent, sizeof(dent))) continue;
  1021. X!     if (LSTAT(dent, &s) < 0) continue;
  1022. X!     if (s.st_nlink > 1 && done(s.st_dev, s.st_ino)) continue;
  1023. X!     if ((s.st_mode & S_IFMT) == S_IFDIR)
  1024. X          total += dodir(dent, thislev - 1);
  1025. X-     switch (s.st_mode & S_IFMT) {
  1026. X-         case S_IFREG:
  1027. X-         case S_IFDIR:
  1028. X-         total += (s.st_size + BLOCK_SIZE - 1) / BLOCK_SIZE;
  1029. X-         break;
  1030. X      }
  1031. X!     if (all && (s.st_mode & S_IFMT) != S_IFDIR)
  1032. X!         if (thislev > 0)/* this is correct - file in subdir */
  1033. X!             printf("%ld\t%s\n",
  1034. X!                    (s.st_size + BLOCK_SIZE - 1) / BLOCK_SIZE, dent);
  1035. X    }
  1036. X!   closedir(dp);
  1037. X!   if (!silent)
  1038. X!     if (thislev >= 0)    /* this is correct - subdir itself */
  1039. X!         printf("%ld\t%s\n", total, d);
  1040. X    return(total);
  1041. X  }
  1042. X  
  1043. X- /*
  1044. X-  *    OK, here goes...
  1045. X-  */
  1046. X  int main(argc, argv)
  1047. X  int argc;
  1048. X  char **argv;
  1049. X  {
  1050. X-   long tot;
  1051. X    int c;
  1052. X  
  1053. X--- 131,182 ----
  1054. X  int thislev;
  1055. X  {
  1056. X+   int maybe_print;
  1057. X    struct stat s;
  1058. X!   long total;
  1059. X    char dent[LINELEN];
  1060. X    DIR *dp;
  1061. X    struct dirent *entry;
  1062. X  
  1063. X!   if (LSTAT(d, &s) < 0) {
  1064. X!     fprintf(stderr,
  1065. X!         "%s: %s: %s\n", prog, d, strerror(errno));
  1066. X!         return 0L;
  1067. X!   }
  1068. X!   total = (s.st_size + (BLOCK_SIZE - 1)) / BLOCK_SIZE;
  1069. X!   switch (s.st_mode & S_IFMT) {
  1070. X!     case S_IFDIR:
  1071. X!     /* Directories should not be linked except to "." and "..", so this
  1072. X!      * directory should not already have been done.
  1073. X!      */
  1074. X!     maybe_print = !silent;
  1075. X!     if ((dp = opendir(d)) == NULL) break;
  1076. X!     while ((entry = readdir(dp)) != NULL) {
  1077. X!         if (strcmp(entry->d_name, ".") == 0 ||
  1078. X!             strcmp(entry->d_name, "..") == 0)
  1079. X!             continue;
  1080. X!         if (!makedname(d, entry->d_name, dent, sizeof(dent))) continue;
  1081. X          total += dodir(dent, thislev - 1);
  1082. X      }
  1083. X!     closedir(dp);
  1084. X!     break;
  1085. X!     case S_IFBLK:
  1086. X!     case S_IFCHR:
  1087. X!     /* st_size for special files is not related to blocks used. */
  1088. X!     total = 0;
  1089. X!     /* Fall through. */
  1090. X!     default:
  1091. X!     if (s.st_nlink > 1 && done(s.st_dev, s.st_ino)) return 0L;
  1092. X!     maybe_print = all;
  1093. X!     break;
  1094. X    }
  1095. X!   if (thislev >= levels || (maybe_print && thislev >= 0))
  1096. X!     printf("%ld\t%s\n", total, d);
  1097. X    return(total);
  1098. X  }
  1099. X  
  1100. X  int main(argc, argv)
  1101. X  int argc;
  1102. X  char **argv;
  1103. X  {
  1104. X    int c;
  1105. X  
  1106. X***************
  1107. X*** 190,195 ****
  1108. X    do {
  1109. X      if (optind < argc) startdir = argv[optind++];
  1110. X!     tot = dodir(startdir, levels);
  1111. X!     if (silent) printf("%ld\t%s\n", tot, startdir);
  1112. X    } while (optind < argc);
  1113. X    return(0);
  1114. X--- 193,198 ----
  1115. X    do {
  1116. X      if (optind < argc) startdir = argv[optind++];
  1117. X!     alc = 0;
  1118. X!     (void) dodir(startdir, levels);
  1119. X    } while (optind < argc);
  1120. X    return(0);
  1121. END_OF_FILE
  1122. if test 6647 -ne `wc -c <'du.c.cd'`; then
  1123.     echo shar: \"'du.c.cd'\" unpacked with wrong size!
  1124. fi
  1125. # end of 'du.c.cd'
  1126. fi
  1127. echo shar: End of shell archive.
  1128. exit 0
  1129. -- 
  1130. Bruce Evans  (bde@runx.oz.au)
  1131.