diff --git a/sbin/newfs_msdos/newfs_msdos.8 b/sbin/newfs_msdos/newfs_msdos.8 index 65b5d41a17e3..5112f72a96ca 100644 --- a/sbin/newfs_msdos/newfs_msdos.8 +++ b/sbin/newfs_msdos/newfs_msdos.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: newfs_msdos.8,v 1.9 2002/10/01 13:40:47 wiz Exp $ +.\" $NetBSD: newfs_msdos.8,v 1.10 2003/04/21 07:58:55 dbj Exp $ .\" Copyright (c) 1998 Robert Nordier .\" All rights reserved. .\" @@ -127,6 +127,19 @@ File system size. .It Fl u Ar track-size Number of sectors per track. .El +.Pp +If +.Nm +receives a +.Dv SIGINFO +signal +(see the +.Sy status +argument for +.Xr stty 1 ) , +a line will be written to the standard error output indicating +the name of the device currently being formatted, the sector +number being written, and the total number of sectors to be written. .Sh NOTES FAT file system parameters occupy a "Boot Sector BPB (BIOS Parameter Block)" in the first of the "reserved" sectors which precede the actual diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c index eaf4e5561e8c..c2ce852cf405 100644 --- a/sbin/newfs_msdos/newfs_msdos.c +++ b/sbin/newfs_msdos/newfs_msdos.c @@ -1,4 +1,4 @@ -/* $NetBSD: newfs_msdos.c,v 1.9 2001/09/17 16:26:56 toshii Exp $ */ +/* $NetBSD: newfs_msdos.c,v 1.10 2003/04/21 07:58:55 dbj Exp $ */ /* * Copyright (c) 1998 Robert Nordier @@ -33,7 +33,7 @@ static const char rcsid[] = "$FreeBSD: src/sbin/newfs_msdos/newfs_msdos.c,v 1.15 2000/10/10 01:49:37 wollman Exp $"; #else -__RCSID("$NetBSD: newfs_msdos.c,v 1.9 2001/09/17 16:26:56 toshii Exp $"); +__RCSID("$NetBSD: newfs_msdos.c,v 1.10 2003/04/21 07:58:55 dbj Exp $"); #endif #endif /* not lint */ @@ -224,6 +224,8 @@ static u_int8_t bootcode[] = { 0 }; +static int got_siginfo = 0; /* received a SIGINFO */ + static void check_mounted(const char *, mode_t); static void getstdfmt(const char *, struct bpb *); static void getdiskinfo(int, const char *, const char *, int, @@ -235,6 +237,7 @@ static int oklabel(const char *); static void mklabel(u_int8_t *, const char *); static void setstr(u_int8_t *, const char *, size_t); static void usage(void); +static void infohandler(int sig); /* * Construct a FAT12, FAT16, or FAT32 file system. @@ -567,7 +570,14 @@ main(int argc, char *argv[]) if (!(img = malloc(bpb.bps))) err(1, NULL); dir = bpb.res + (bpb.spf ? bpb.spf : bpb.bspf) * bpb.nft; + signal(SIGINFO, infohandler); for (lsn = 0; lsn < dir + (fat == 32 ? bpb.spc : rds); lsn++) { + if (got_siginfo) { + fprintf(stderr,"%s: writing sector %u of %u (%u%%)\n", + fname,lsn,(dir + (fat == 32 ? bpb.spc : rds)), + (lsn*100)/(dir + (fat == 32 ? bpb.spc : rds))); + got_siginfo = 0; + } x = lsn; if (opt_B && fat == 32 && bpb.bkbs != MAXU16 && @@ -959,3 +969,9 @@ usage(void) fprintf(stderr, "\t-u sectors/track\n"); exit(1); } + +void +infohandler(int sig) +{ + got_siginfo = 1; +}