diff options
author | Miles Bader <miles@gnu.org> | 1995-10-18 17:24:57 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-10-18 17:24:57 +0000 |
commit | e545c728a6514978821b21bc55b75cfe819e0e70 (patch) | |
tree | 8fac62fac2e3ab1ce9f7f3b6b324a3a020924a5f | |
parent | effc226d51d68669c91f24a8069ec900e0be6082 (diff) |
(pfix): New function.
(pfatal, pwarn, errexit): Print DEVICE_NAME too if in preen mode.
(pinode): Take a message & args to print as well.
-rw-r--r-- | ufs-fsck/utilities.c | 65 |
1 files changed, 48 insertions, 17 deletions
diff --git a/ufs-fsck/utilities.c b/ufs-fsck/utilities.c index d5ff8c1b..32ce52d7 100644 --- a/ufs-fsck/utilities.c +++ b/ufs-fsck/utilities.c @@ -164,6 +164,9 @@ pfatal (char *fmt, ...) { va_list args; int ret; + + if (preen && device_name) + printf ("%s: ", device_name); va_start (args, fmt); ret = vprintf (fmt, args); @@ -181,6 +184,9 @@ errexit (char *fmt, ...) { va_list args; + if (preen && device_name) + printf ("%s: ", device_name); + va_start (args, fmt); vprintf (fmt, args); va_end (args); @@ -196,12 +202,24 @@ pwarn (char *fmt, ...) va_list args; int ret; + if (preen && device_name) + printf ("%s: ", device_name); + va_start (args, fmt); ret = vprintf (fmt, args); va_end (args); + return ret; } +/* Print how a problem was fixed in preen mode. */ +void +pfix (char *fix) +{ + if (preen) + printf (" (%s)\n", fix); +} + /* Ask the user a question; return 1 if the user says yes, and 0 if the user says no. */ int @@ -244,27 +262,40 @@ reply (char *question) /* Print a helpful description of the given inode number. */ void -pinode (ino_t ino) +pinode (ino_t ino, char *fmt, ...) { - struct dinode dino; - struct passwd *pw; - char *p; + if (fmt) + { + va_list args; + va_start (args, fmt); + vprintf (fmt, args); + va_end (args); + putchar (' '); + } - printf (" I=%d ", ino); if (ino < ROOTINO || ino > maxino) - return; - getinode (ino, &dino); - - printf (" OWNER="); - pw = getpwuid (dino.di_uid); - if (pw) - printf ("%s ", pw->pw_name); + printf (" NODE I=%d", ino); else - printf ("%lu ", dino.di_uid); + { + char *p; + struct dinode dino; + struct passwd *pw; + + getinode (ino, &dino); + + printf ("%s I=%d", (DI_MODE (&dino) & IFMT) == IFDIR ? "DIR" : "FILE", + ino); + + pw = getpwuid (dino.di_uid); + if (pw) + printf (" OWNER=%s", pw->pw_name); + else + printf (" OWNER=%lu", dino.di_uid); - printf (" MODE=%o\n", DI_MODE (&dino)); - printf ("SIZE=%llu ", dino.di_size); - p = ctime (&dino.di_mtime.ts_sec); - printf ("MTIME=%12.12s %4.4s ", &p[4], &p[20]); + printf (" MODE=%o", DI_MODE (&dino)); + printf (" SIZE=%llu ", dino.di_size); + p = ctime (&dino.di_mtime.ts_sec); + printf (" MTIME=%12.12s %4.4s", &p[4], &p[20]); + } } |