From a29582a1b753e26ec46a4ac60c8c29f7edc6c509 Mon Sep 17 00:00:00 2001 From: charnier Date: Sun, 21 Apr 2002 07:18:16 +0000 Subject: [PATCH] Add FBSDID. Start errx(3) messages with lowercase. Remove a ')' with no '('. In usage(), use fprintf(3) instead of errx(3), to make the printed string really start with `usage: ...'. Reviewed by: marcel --- sbin/savecore/savecore.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c index 7e574d3cd136..86be83ccb267 100644 --- a/sbin/savecore/savecore.c +++ b/sbin/savecore/savecore.c @@ -31,10 +31,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include @@ -103,7 +104,7 @@ DoFile(const char *device) if (!error) error = ioctl(fd, DIOCGSECTORSIZE, §orsize); if (error) { - warn("Couldn't find media and/or sector size of %s)", device); + warn("couldn't find media and/or sector size of %s", device); goto closefd; } @@ -116,18 +117,18 @@ DoFile(const char *device) lseek(fd, lasthd, SEEK_SET); error = read(fd, &kdhl, sizeof kdhl); if (error != sizeof kdhl) { - warn("Error reading last dump header at offset %lld in %s", + warn("error reading last dump header at offset %lld in %s", (long long)lasthd, device); goto closefd; } if (memcmp(kdhl.magic, KERNELDUMPMAGIC, sizeof kdhl.magic)) { if (verbose) - warnx("Magic mismatch on last dump header on %s", + warnx("magic mismatch on last dump header on %s", device); goto closefd; } if (dtoh32(kdhl.version) != KERNELDUMPVERSION) { - warnx("Unknown version (%d) in last dump header on %s", + warnx("unknown version (%d) in last dump header on %s", dtoh32(kdhl.version), device); goto closefd; } @@ -137,7 +138,7 @@ DoFile(const char *device) goto nuke; if (kerneldump_parity(&kdhl)) { - warnx("Parity error on last dump header on %s", device); + warnx("parity error on last dump header on %s", device); goto closefd; } dumpsize = dtoh64(kdhl.dumplength); @@ -145,12 +146,12 @@ DoFile(const char *device) lseek(fd, firsthd, SEEK_SET); error = read(fd, &kdhf, sizeof kdhf); if (error != sizeof kdhf) { - warn("Error reading first dump header at offset %lld in %s", + warn("error reading first dump header at offset %lld in %s", (long long)firsthd, device); goto closefd; } if (memcmp(&kdhl, &kdhf, sizeof kdhl)) { - warn("First and last dump headers disagree on %s", device); + warn("first and last dump headers disagree on %s", device); goto closefd; } md5 = MD5Data((unsigned char *)&kdhl, sizeof kdhl, NULL); @@ -168,7 +169,7 @@ DoFile(const char *device) goto closefd; } } else if (errno != ENOENT) { - warn("Error while checking for pre-saved core file"); + warn("error while checking for pre-saved core file"); goto closefd; } @@ -203,12 +204,12 @@ DoFile(const char *device) wl = dumpsize; error = read(fd, buf, wl); if (error != wl) { - warn("Read error on %s", device); + warn("read error on %s", device); goto closeall; } error = write(fdcore, buf, wl); if (error != wl) { - warn("Write error on %s.core file", md5); + warn("write error on %s.core file", md5); goto closeall; } dumpsize -= wl; @@ -227,7 +228,7 @@ DoFile(const char *device) lseek(fd, lasthd, SEEK_SET); error = write(fd, &kdhl, sizeof kdhl); if (error != sizeof kdhl) - warn("Error while clearing the dump header"); + warn("error while clearing the dump header"); } close(fd); return; @@ -243,7 +244,7 @@ DoFile(const char *device) static void usage(void) { - errx(1, "usage: savecore [-cfkv] [directory [device...]]"); + fprintf(stderr, "usage: savecore [-cfkv] [directory [device...]]\n"); exit (1); }