1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ff -- obtain file names from reading filesystem
*/
#define NB 500
#define MAXNINDIR (MAXBSIZE / sizeof (daddr32_t))
#include <sys/param.h>
#include <sys/types.h>
#include <sys/mntent.h>
#include <sys/vnode.h>
#include <sys/fs/ufs_inode.h>
#include <sys/stat.h>
#include <sys/fs/ufs_fs.h>
#include <sys/fs/ufs_fsdir.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <pwd.h>
#include "roll_log.h"
#define MIN_PHYS_READ BBSIZE
#define DAY (24*60*60)
union {
struct fs sblk;
char xxx[SBSIZE]; /* because fs is variable length */
} real_fs;
#define sblock real_fs.sblk
struct dinode *itab; /* = (struct dinode *)itab; */
struct dinode *gip;
struct ilist {
ino_t ino;
ushort_t mode;
uid_t uid;
gid_t gid;
} ilist[NB];
struct htab
{
ino_t h_ino;
ino_t h_pino;
int h_name_index; /* index into string table */
} *htab;
char *strngtab;
long hsize;
int strngloc;
int strngtab_size;
#define STRNGTAB_INCR (1024*16) /* amount to grow strngtab */
#define MAX_STRNGTAB_INDEX() (strngtab_size - 1)
#define AVG_PATH_LEN 30 /* average (?) length of name */
struct dirstuff {
int loc;
struct dinode *ip;
char dbuf[MAXBSIZE];
};
int Aflg = 0; /* accessed in n days */
int Mflg = 0; /* modified in n days */
int Nflg = 0; /* modified more recently than 'file' */
int Cflg = 0; /* changed within n days */
int aflg = 0; /* print the names `.' and `..' */
int sflg = 0; /* print only special files and files with set-user-ID mode */
int Sflg = 0; /* print file size */
int iflg = 0; /* number of inodes being searched for */
int Iflg = 0; /* do not print i-number */
int Lflg = 0; /* supplementary list of multiply linked files */
int mflg = 0;
int pflg = 0; /* a prefix exists */
int uflg = 0; /* print the owner's login name */
int fi;
ino_t ino;
int nhent;
int nxfile;
int imax; /* highest inode number */
int inode_reads;
int passwd_lookups;
int Adelay; /* Access delay */
int Asign; /* Access sign */
int Mdelay; /* Modify delay */
int Msign; /* Modify sign */
int Cdelay; /* change delay */
int Csign; /* change sign */
time_t Nage; /* Last modification time of the file */
char *Lname; /* filename for supplementary list */
FILE *Lfile; /* file for supplementary list */
/*
* Function prototypes
*/
void check(char *file);
void pass1(struct dinode *ip);
void pass2(struct dinode *ip);
void pass3(struct dinode *ip);
struct direct *dreaddir(struct dirstuff *dirp);
int dotname(struct direct *dp);
void pname(FILE *stream, ino_t i, int lev);
struct htab *lookup(ino_t i, int ef);
void bread(diskaddr_t bno, char *buf, int cnt);
diskaddr_t bmap(diskaddr_t i);
struct dinode *ginode(ino_t inumber);
char *user_name(int uid);
int cmp(int a, int b, int s);
time_t mod_time(char *file);
void out_multilinks();
void usage();
int extend_strngtab(unsigned int size);
long atol();
offset_t llseek();
char *strcpy();
char *prefix;
time_t Today;
int nerror;
extern int optind;
extern char *optarg;
char *subopts [] = {
#define A_FLAG 0
"a",
#define M_FLAG 1
"m",
#define S_FLAG 2
"s",
NULL
};
int
main(int argc, char *argv[])
{
long n;
int opt;
char *suboptions, *value;
char *p;
int first = 0;
Today = time((time_t *)0);
while ((opt = getopt(argc, argv, "Ia:c:i:lm:n:o:p:su")) != EOF) {
switch (opt) {
case 'a':
Aflg++;
Adelay = atoi(optarg);
Asign = optarg[0];
break;
case 'I':
Iflg++;
break;
case 'c':
Cflg++;
Cdelay = atoi(optarg);
Csign = optarg[0];
break;
case 'l':
Lflg++;
Lname = tmpnam((char *)0);
if ((Lfile = fopen(Lname, "w+")) == NULL) {
perror("open");
(void) fprintf(stderr,
"ff: unable to open temp file, -l ignored\n");
Lflg = 0;
}
break;
case 'm':
Mflg++;
Mdelay = atoi(optarg);
Msign = optarg[0];
break;
case 'n':
Nflg++;
Nage = mod_time(optarg);
break;
case 'o':
/*
* ufs specific options.
*/
suboptions = optarg;
if (*suboptions == '\0')
usage();
while (*suboptions != '\0') {
switch ((getsubopt(&suboptions,
subopts, &value))) {
case A_FLAG:
aflg++;
break;
case M_FLAG:
mflg++;
break;
case S_FLAG:
sflg++;
break;
default:
usage();
}
}
break;
case 'i':
while ((p = (char *)strtok(((first++ == 0) ?
optarg: ((char *)0)), ", ")) != NULL) {
if ((n = atoi(p)) == 0)
break;
ilist[iflg].ino = n;
nxfile = iflg;
iflg++;
}
break;
case 'p':
prefix = optarg;
pflg++;
break;
case 's':
Sflg++;
break;
case 'u':
uflg++;
break;
case '?':
usage();
}
}
argc -= optind;
argv = &argv[optind];
while (argc--) {
check(*argv);
argv++;
}
if (Lflg) {
out_multilinks();
}
if (nerror)
return (32);
return (0);
}
void
check(char *file)
{
int i, j, c;
fi = open64(file, 0);
if (fi < 0) {
(void) fprintf(stderr, "ff: cannot open %s\n", file);
nerror++;
return;
}
nhent = 0;
(void) printf("%s:\n", file);
sync();
bread(SBLOCK, (char *)&sblock, SBSIZE);
if ((sblock.fs_magic != FS_MAGIC) &&
(sblock.fs_magic != MTB_UFS_MAGIC)) {
(void) fprintf(stderr, "%s: not a ufs file system\n", file);
nerror++;
return;
}
if (sblock.fs_magic == FS_MAGIC &&
(sblock.fs_version != UFS_EFISTYLE4NONEFI_VERSION_2 &&
sblock.fs_version != UFS_VERSION_MIN)) {
(void) fprintf(stderr, "%s: unrecognized version of UFS: %d\n",
file, sblock.fs_version);
nerror++;
return;
}
if (sblock.fs_magic == MTB_UFS_MAGIC &&
(sblock.fs_version > MTB_UFS_VERSION_1 ||
sblock.fs_version < MTB_UFS_VERSION_MIN)) {
(void) fprintf(stderr, "%s: unrecognized version of UFS: %d\n",
file, sblock.fs_version);
nerror++;
return;
}
/* If fs is logged, roll the log. */
if (sblock.fs_logbno) {
switch (rl_roll_log(file)) {
case RL_SUCCESS:
/*
* Reread the superblock. Rolling the log may have
* changed it.
*/
bread(SBLOCK, (char *)&sblock, SBSIZE);
break;
case RL_SYSERR:
(void) printf("Warning: Cannot roll log for %s. %s\n",
file, strerror(errno));
break;
default:
(void) printf("Warning: Cannot roll log for %s.\n ",
file);
break;
}
}
itab = (struct dinode *)calloc(sblock.fs_ipg, sizeof (struct dinode));
imax = sblock.fs_ncg * sblock.fs_ipg;
hsize = sblock.fs_ipg * sblock.fs_ncg - sblock.fs_cstotal.cs_nifree + 1;
htab = (struct htab *)calloc(hsize, sizeof (struct htab));
if (!extend_strngtab(AVG_PATH_LEN * hsize)) {
(void) printf("not enough memory to allocate tables\n");
nerror++;
return;
}
strngloc = 0;
if ((itab == NULL) || (htab == NULL)) {
(void) printf("not enough memory to allocate tables\n");
nerror++;
return;
}
ino = 0;
for (c = 0; c < sblock.fs_ncg; c++) {
bread(fsbtodb(&sblock, cgimin(&sblock, c)), (char *)itab,
(int)(sblock.fs_ipg * sizeof (struct dinode)));
for (j = 0; j < sblock.fs_ipg; j++) {
if (itab[j].di_smode != 0) {
itab[j].di_mode = itab[j].di_smode;
if (itab[j].di_suid != (o_uid_t)UID_LONG)
itab[j].di_uid = (unsigned int)itab[j].di_suid;
if (itab[j].di_sgid != GID_LONG)
itab[j].di_gid = (unsigned int)itab[j].di_sgid;
pass1(&itab[j]);
}
ino++;
}
}
ilist[nxfile+1].ino = 0;
ino = 0;
for (c = 0; c < sblock.fs_ncg; c++) {
bread(fsbtodb(&sblock, cgimin(&sblock, c)), (char *)itab,
(int)(sblock.fs_ipg * sizeof (struct dinode)));
for (j = 0; j < sblock.fs_ipg; j++) {
if (itab[j].di_smode != 0) {
itab[j].di_mode = itab[j].di_smode;
pass2(&itab[j]);
}
ino++;
}
}
ino = 0;
for (c = 0; c < sblock.fs_ncg; c++) {
bread(fsbtodb(&sblock, cgimin(&sblock, c)), (char *)itab,
(int)(sblock.fs_ipg * sizeof (struct dinode)));
for (j = 0; j < sblock.fs_ipg; j++) {
if (itab[j].di_smode != 0) {
itab[j].di_mode = itab[j].di_smode;
pass3(&itab[j]);
}
ino++;
}
}
(void) close(fi);
for (i = iflg; i < NB; i++)
ilist[i].ino = 0;
nxfile = iflg;
free(itab);
free(htab);
free(strngtab);
}
void
pass1(struct dinode *ip)
{
int i;
if (mflg)
for (i = 0; i < iflg; i++)
if (ino == ilist[i].ino) {
ilist[i].mode = ip->di_mode;
ilist[i].uid = ip->di_uid;
ilist[i].gid = ip->di_gid;
}
if ((ip->di_mode & IFMT) != IFDIR) {
if (sflg == 0 || nxfile >= NB)
return;
if ((ip->di_mode&IFMT) == IFBLK ||
(ip->di_mode&IFMT) == IFCHR || ip->di_mode&(ISUID|ISGID)) {
ilist[nxfile].ino = ino;
ilist[nxfile].mode = ip->di_mode;
ilist[nxfile].uid = ip->di_uid;
ilist[nxfile++].gid = ip->di_gid;
return;
}
}
(void) lookup(ino, 1);
}
void
pass2(struct dinode *ip)
{
struct direct *dp;
struct dirstuff dirp;
struct htab *hp;
if ((ip->di_mode&IFMT) != IFDIR)
return;
dirp.loc = 0;
dirp.ip = ip;
gip = ip;
for (dp = dreaddir(&dirp); dp != NULL; dp = dreaddir(&dirp)) {
int nmlen;
if (dp->d_ino == 0)
continue;
hp = lookup(dp->d_ino, 0);
if (hp == 0)
continue;
if (dotname(dp))
continue;
hp->h_pino = ino;
nmlen = strlen(dp->d_name);
if (strngloc + nmlen + 1 > MAX_STRNGTAB_INDEX()) {
if (!extend_strngtab(STRNGTAB_INCR)) {
perror("ncheck: can't grow string table\n");
exit(32);
}
}
hp->h_name_index = strngloc;
(void) strcpy(&strngtab[strngloc], dp->d_name);
strngloc += nmlen + 1;
}
}
void
pass3(struct dinode *ip)
{
struct direct *dp;
struct dirstuff dirp;
struct dinode *dip;
int k;
if ((ip->di_mode&IFMT) != IFDIR)
return;
dirp.loc = 0;
dirp.ip = ip;
gip = ip;
for (dp = dreaddir(&dirp); dp != NULL; dp = dreaddir(&dirp)) {
if (aflg == 0 && dotname(dp))
continue;
if (sflg == 0 && iflg == 0)
goto pr;
for (k = 0; ilist[k].ino != 0; k++)
if (ilist[k].ino == dp->d_ino)
break;
if (ilist[k].ino == 0)
continue;
if (mflg)
(void) printf("mode %-6o uid %-5ld gid %-5ld ino ",
ilist[k].mode, ilist[k].uid, ilist[k].gid);
pr:
if (Sflg || uflg || Aflg || Mflg || Cflg || Nflg || Lflg)
dip = ginode(dp->d_ino);
if ((!Aflg ||
cmp((Today - dip->di_un.di_icom.ic_atime)/DAY, Adelay,
Asign)) &&
(!Mflg || cmp((Today - dip->di_un.di_icom.ic_mtime)/DAY,
Mdelay, Msign)) &&
(!Cflg || cmp((Today - dip->di_un.di_icom.ic_mtime)/DAY,
Cdelay, Csign)) &&
(!Nflg || cmp(dip->di_un.di_icom.ic_mtime, Nage, '+'))) {
if (Iflg == 0)
(void) printf("%-5u\t", dp->d_ino);
pname(stdout, ino, 0);
(void) printf("/%s", dp->d_name);
if (lookup(dp->d_ino, 0))
(void) printf("/.");
if (Sflg)
(void) printf("\t%6lld",
dip->di_un.di_icom.ic_lsize);
if (uflg)
(void) printf("\t%s",
user_name(dip->di_un.di_icom.ic_uid));
(void) printf("\n");
if (Lflg && (dip->di_un.di_icom.ic_nlink > 1)) {
(void) fprintf(Lfile, "%-5u\t",
dp->d_ino);
(void) fprintf(Lfile, "%-5u\t",
dip->di_un.di_icom.ic_nlink);
pname(Lfile, ino, 0);
(void) fprintf(Lfile, "/%s\n", dp->d_name);
}
}
}
}
/*
* get next entry in a directory.
*/
struct direct *
dreaddir(struct dirstuff *dirp)
{
struct direct *dp;
diskaddr_t lbn, d;
for (;;) {
if (dirp->loc >= (int)dirp->ip->di_size)
return (NULL);
if (blkoff(&sblock, dirp->loc) == 0) {
lbn = lblkno(&sblock, dirp->loc);
d = bmap(lbn);
if (d == 0)
return (NULL);
bread(fsbtodb(&sblock, d), dirp->dbuf,
(int)dblksize(&sblock, dirp->ip, (int)lbn));
}
dp = (struct direct *)
(dirp->dbuf + blkoff(&sblock, dirp->loc));
dirp->loc += dp->d_reclen;
if (dp->d_ino == 0)
continue;
return (dp);
}
}
int
dotname(struct direct *dp)
{
if (dp->d_name[0] == '.')
if (dp->d_name[1] == 0 ||
(dp->d_name[1] == '.' && dp->d_name[2] == 0))
return (1);
return (0);
}
void
pname(FILE *stream, ino_t i, int lev)
{
struct htab *hp;
if (i == UFSROOTINO)
return;
if ((hp = lookup(i, 0)) == 0) {
(void) fprintf(stream, "???");
return;
}
if (lev > 10) {
(void) fprintf(stream, "...");
return;
}
pname(stream, hp->h_pino, ++lev);
if (pflg)
(void) fprintf(stream, "%s/%s", prefix,
&(strngtab[hp->h_name_index]));
else
(void) fprintf(stream, "/%s",
&(strngtab[hp->h_name_index]));
}
struct htab *
lookup(ino_t i, int ef)
{
struct htab *hp;
for (hp = &htab[(int)i%hsize]; hp->h_ino; ) {
if (hp->h_ino == i)
return (hp);
if (++hp >= &htab[hsize])
hp = htab;
}
if (ef == 0)
return (0);
if (++nhent >= hsize) {
(void) fprintf(stderr,
"ff: hsize of %ld is too small\n", hsize);
exit(32);
}
hp->h_ino = i;
return (hp);
}
void
bread(diskaddr_t bno, char *buf, int cnt)
{
int i;
int got;
offset_t offset;
offset = (offset_t)bno * DEV_BSIZE;
if (llseek(fi, offset, 0) == (offset_t)-1) {
(void) fprintf(stderr,
"ff: llseek error %lx %lx\n",
((long *)&offset)[0], ((long *)&offset)[1]);
for (i = 0; i < cnt; i++)
buf[i] = 0;
return;
}
got = read((int)fi, buf, cnt);
if (got != cnt) {
perror("read");
(void) fprintf(stderr,
"ff: (wanted %d got %d blk %lld)\n", cnt, got, bno);
for (i = 0; i < cnt; i++)
buf[i] = 0;
}
}
diskaddr_t
bmap(diskaddr_t i)
{
daddr32_t ibuf[MAXNINDIR];
if (i < NDADDR)
return ((diskaddr_t)gip->di_db[i]);
i -= NDADDR;
if (i > NINDIR(&sblock)) {
(void) fprintf(stderr, "ff : %lu - huge directory\n", ino);
return ((diskaddr_t)0);
}
bread(fsbtodb(&sblock, gip->di_ib[0]), (char *)ibuf, sizeof (ibuf));
return ((diskaddr_t)ibuf[i]);
}
struct dinode *
ginode(ino_t inumber)
{
diskaddr_t iblk;
diskaddr_t dblk;
int ioff;
static diskaddr_t curr_dblk;
static char buf[MIN_PHYS_READ];
struct dinode *ibuf;
if (inumber < UFSROOTINO || (int)inumber > imax) {
(void) fprintf(stderr,
"bad inode number %ld to ginode\n", inumber);
exit(32);
}
iblk = itod(&sblock, (int)inumber);
dblk = fsbtodb(&sblock, iblk);
ioff = itoo(&sblock, (int)inumber);
if (dblk != curr_dblk) {
bread(dblk, &buf[0], sizeof (buf));
curr_dblk = dblk;
inode_reads++;
}
ibuf = (struct dinode *)&buf[0];
ibuf += ioff;
return (ibuf);
}
#define HASHNAMESIZE 16
struct name_ent {
struct name_ent *name_nxt;
int name_uid;
char *name_string;
};
struct name_ent *hashtable[HASHNAMESIZE];
char *
user_name(int uid)
{
int h_index;
struct name_ent *hp;
struct passwd *pwent;
h_index = uid % HASHNAMESIZE;
for (hp = hashtable[h_index]; hp != NULL; hp = hp->name_nxt) {
if (hp->name_uid == uid) {
return (hp->name_string);
}
}
hp = (struct name_ent *)calloc(1, sizeof (struct name_ent));
hp->name_nxt = hashtable[h_index];
hp->name_uid = uid;
hashtable[h_index] = hp;
if ((pwent = getpwuid(uid)) == NULL) {
hp->name_string = "unknown";
} else {
hp->name_string = (char *)strdup(pwent->pw_name);
}
passwd_lookups++;
return (hp->name_string);
}
int
cmp(int a, int b, int s)
{
if (s == '+')
return (a > b);
if (s == '-')
return (a < -(b));
return (a == b);
}
/*
* We can't do this one by reading the disk directly, since there
* is no guarantee that the file is even on a local disk.
*/
time_t
mod_time(char *file)
{
struct stat64 stat_buf;
if (stat64(file, &stat_buf) < 0) {
(void) fprintf(stderr, "ff: can't stat '%s' - ignored\n", file);
return (0);
}
return (stat_buf.st_mtime);
}
void
out_multilinks()
{
int length;
if ((length = fseek(Lfile, 0L, 2)) < 0) {
perror("fseek");
exit(32);
} else
if ((length = ftell(Lfile)) > 0) {
(void) fprintf(stdout,
"\nmultilink files\nIno\tLinks\tPathname\n\n");
rewind(Lfile);
while (length-- > 0)
(void) putc(getc(Lfile), stdout);
} else
(void) fprintf(stdout, "No multilink files\n");
(void) fclose(Lfile);
}
void
usage()
{
(void) fprintf(stderr,
"ufs usage: ff [-F ufs] [generic options] [-o a,m,s] special\n");
exit(32);
}
/*
* Extend or create the string table.
* Preserves contents.
* Return non-zero for success.
*/
int
extend_strngtab(unsigned int size)
{
strngtab_size += size;
strngtab = (char *)realloc(strngtab, strngtab_size);
return ((int)strngtab);
}
|