diff options
| author | Matt Kraai <kraai@debian.org> | 2000-07-14 01:51:25 +0000 |
|---|---|---|
| committer | Matt Kraai <kraai@debian.org> | 2000-07-14 01:51:25 +0000 |
| commit | d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb (patch) | |
| tree | 62127f20fc07758e445d8c4e186306cbe83d77b1 /util-linux | |
| parent | 4ac6cb534d78d63d7b0a206118c56bad7024b9f8 (diff) | |
| download | busybox-w32-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.tar.gz busybox-w32-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.tar.bz2 busybox-w32-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.zip | |
Use errorMsg rather than fprintf.
Diffstat (limited to 'util-linux')
| -rw-r--r-- | util-linux/fbset.c | 2 | ||||
| -rw-r--r-- | util-linux/fsck_minix.c | 2 | ||||
| -rw-r--r-- | util-linux/mkfs_minix.c | 6 | ||||
| -rw-r--r-- | util-linux/mkswap.c | 33 | ||||
| -rw-r--r-- | util-linux/mount.c | 8 | ||||
| -rw-r--r-- | util-linux/nfsmount.c | 34 | ||||
| -rw-r--r-- | util-linux/umount.c | 8 |
7 files changed, 37 insertions, 56 deletions
diff --git a/util-linux/fbset.c b/util-linux/fbset.c index 9fde6a19d..2fcc7c294 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c | |||
| @@ -387,7 +387,7 @@ extern int fbset_main(int argc, char **argv) | |||
| 387 | PERROR("fbset(ioctl)"); | 387 | PERROR("fbset(ioctl)"); |
| 388 | if (g_options & OPT_READMODE) { | 388 | if (g_options & OPT_READMODE) { |
| 389 | if (!readmode(&var, modefile, mode)) { | 389 | if (!readmode(&var, modefile, mode)) { |
| 390 | fprintf(stderr, "Unknown video mode `%s'\n", mode); | 390 | errorMsg("Unknown video mode `%s'\n", mode); |
| 391 | exit(1); | 391 | exit(1); |
| 392 | } | 392 | } |
| 393 | } | 393 | } |
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 685e0ee6c..74281a71e 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
| @@ -311,7 +311,7 @@ static void show_usage(void) | |||
| 311 | 311 | ||
| 312 | static void die(const char *str) | 312 | static void die(const char *str) |
| 313 | { | 313 | { |
| 314 | fprintf(stderr, "%s: %s\n", applet_name, str); | 314 | errorMsg("%s\n", str); |
| 315 | leave(8); | 315 | leave(8); |
| 316 | } | 316 | } |
| 317 | 317 | ||
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index b6f958f46..e4dedaf82 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c | |||
| @@ -263,7 +263,7 @@ static unsigned long req_nr_inodes = 0; | |||
| 263 | */ | 263 | */ |
| 264 | static volatile void die(char *str) | 264 | static volatile void die(char *str) |
| 265 | { | 265 | { |
| 266 | fprintf(stderr, "%s: %s\n", applet_name, str); | 266 | errorMsg("%s\n", str); |
| 267 | exit(8); | 267 | exit(8); |
| 268 | } | 268 | } |
| 269 | 269 | ||
| @@ -814,8 +814,8 @@ extern int mkfs_minix_main(int argc, char **argv) | |||
| 814 | #ifdef HAVE_MINIX2 | 814 | #ifdef HAVE_MINIX2 |
| 815 | version2 = 1; | 815 | version2 = 1; |
| 816 | #else | 816 | #else |
| 817 | fprintf(stderr, "%s: not compiled with minix v2 support\n", | 817 | errorMsg("%s: not compiled with minix v2 support\n", |
| 818 | applet_name, device_name); | 818 | device_name); |
| 819 | exit(-1); | 819 | exit(-1); |
| 820 | #endif | 820 | #endif |
| 821 | break; | 821 | break; |
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index 20096361f..5a33945c8 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c | |||
| @@ -116,7 +116,7 @@ static void init_signature_page() | |||
| 116 | 116 | ||
| 117 | #ifdef PAGE_SIZE | 117 | #ifdef PAGE_SIZE |
| 118 | if (pagesize != PAGE_SIZE) | 118 | if (pagesize != PAGE_SIZE) |
| 119 | fprintf(stderr, "Assuming pages of size %d\n", pagesize); | 119 | errorMsg("Assuming pages of size %d\n", pagesize); |
| 120 | #endif | 120 | #endif |
| 121 | signature_page = (int *) xmalloc(pagesize); | 121 | signature_page = (int *) xmalloc(pagesize); |
| 122 | memset(signature_page, 0, pagesize); | 122 | memset(signature_page, 0, pagesize); |
| @@ -204,7 +204,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr) | |||
| 204 | 204 | ||
| 205 | void die(const char *str) | 205 | void die(const char *str) |
| 206 | { | 206 | { |
| 207 | fprintf(stderr, "%s: %s\n", applet_name, str); | 207 | errorMsg("%s\n", str); |
| 208 | exit(FALSE); | 208 | exit(FALSE); |
| 209 | } | 209 | } |
| 210 | 210 | ||
| @@ -345,18 +345,14 @@ int mkswap_main(int argc, char **argv) | |||
| 345 | } | 345 | } |
| 346 | } | 346 | } |
| 347 | if (!device_name) { | 347 | if (!device_name) { |
| 348 | fprintf(stderr, | 348 | errorMsg("error: Nowhere to set up swap on?\n"); |
| 349 | "%s: error: Nowhere to set up swap on?\n", applet_name); | ||
| 350 | usage(mkswap_usage); | 349 | usage(mkswap_usage); |
| 351 | } | 350 | } |
| 352 | sz = get_size(device_name); | 351 | sz = get_size(device_name); |
| 353 | if (!PAGES) { | 352 | if (!PAGES) { |
| 354 | PAGES = sz; | 353 | PAGES = sz; |
| 355 | } else if (PAGES > sz && !force) { | 354 | } else if (PAGES > sz && !force) { |
| 356 | fprintf(stderr, | 355 | errorMsg("error: size %ld is larger than device size %d\n", |
| 357 | "%s: error: " | ||
| 358 | "size %ld is larger than device size %d\n", | ||
| 359 | applet_name, | ||
| 360 | PAGES * (pagesize / 1024), sz * (pagesize / 1024)); | 356 | PAGES * (pagesize / 1024), sz * (pagesize / 1024)); |
| 361 | exit(FALSE); | 357 | exit(FALSE); |
| 362 | } | 358 | } |
| @@ -372,14 +368,12 @@ int mkswap_main(int argc, char **argv) | |||
| 372 | version = 1; | 368 | version = 1; |
| 373 | } | 369 | } |
| 374 | if (version != 0 && version != 1) { | 370 | if (version != 0 && version != 1) { |
| 375 | fprintf(stderr, "%s: error: unknown version %d\n", | 371 | errorMsg("error: unknown version %d\n", version); |
| 376 | applet_name, version); | ||
| 377 | usage(mkswap_usage); | 372 | usage(mkswap_usage); |
| 378 | } | 373 | } |
| 379 | if (PAGES < 10) { | 374 | if (PAGES < 10) { |
| 380 | fprintf(stderr, | 375 | errorMsg("error: swap area needs to be at least %ldkB\n", |
| 381 | "%s: error: swap area needs to be at least %ldkB\n", | 376 | (long) (10 * pagesize / 1024)); |
| 382 | applet_name, (long) (10 * pagesize / 1024)); | ||
| 383 | usage(mkswap_usage); | 377 | usage(mkswap_usage); |
| 384 | } | 378 | } |
| 385 | #if 0 | 379 | #if 0 |
| @@ -397,8 +391,8 @@ int mkswap_main(int argc, char **argv) | |||
| 397 | #endif | 391 | #endif |
| 398 | if (PAGES > maxpages) { | 392 | if (PAGES > maxpages) { |
| 399 | PAGES = maxpages; | 393 | PAGES = maxpages; |
| 400 | fprintf(stderr, "%s: warning: truncating swap area to %ldkB\n", | 394 | errorMsg("warning: truncating swap area to %ldkB\n", |
| 401 | applet_name, PAGES * pagesize / 1024); | 395 | PAGES * pagesize / 1024); |
| 402 | } | 396 | } |
| 403 | 397 | ||
| 404 | DEV = open(device_name, O_RDWR); | 398 | DEV = open(device_name, O_RDWR); |
| @@ -424,11 +418,10 @@ int mkswap_main(int argc, char **argv) | |||
| 424 | for (sum = 0; q >= (unsigned short *) buffer;) | 418 | for (sum = 0; q >= (unsigned short *) buffer;) |
| 425 | sum ^= *q--; | 419 | sum ^= *q--; |
| 426 | if (!sum) { | 420 | if (!sum) { |
| 427 | fprintf(stderr, "\ | 421 | errorMsg("Device '%s' contains a valid Sun disklabel.\n" |
| 428 | %s: Device '%s' contains a valid Sun disklabel.\n\ | 422 | "This probably means creating v0 swap would destroy your partition table\n" |
| 429 | This probably means creating v0 swap would destroy your partition table\n\ | 423 | "No swap created. If you really want to create swap v0 on that device, use\n" |
| 430 | No swap created. If you really want to create swap v0 on that device, use\n\ | 424 | "the -f option to force it.\n", device_name); |
| 431 | the -f option to force it.\n", applet_name, device_name); | ||
| 432 | exit(FALSE); | 425 | exit(FALSE); |
| 433 | } | 426 | } |
| 434 | } | 427 | } |
diff --git a/util-linux/mount.c b/util-linux/mount.c index 900ab30a7..455e4a1c1 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
| @@ -157,15 +157,15 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
| 157 | 157 | ||
| 158 | specialfile = find_unused_loop_device(); | 158 | specialfile = find_unused_loop_device(); |
| 159 | if (specialfile == NULL) { | 159 | if (specialfile == NULL) { |
| 160 | fprintf(stderr, "Could not find a spare loop device\n"); | 160 | errorMsg("Could not find a spare loop device\n"); |
| 161 | return (FALSE); | 161 | return (FALSE); |
| 162 | } | 162 | } |
| 163 | if (set_loop(specialfile, lofile, 0, &loro)) { | 163 | if (set_loop(specialfile, lofile, 0, &loro)) { |
| 164 | fprintf(stderr, "Could not setup loop device\n"); | 164 | errorMsg("Could not setup loop device\n"); |
| 165 | return (FALSE); | 165 | return (FALSE); |
| 166 | } | 166 | } |
| 167 | if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ | 167 | if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ |
| 168 | fprintf(stderr, "WARNING: loop device is read-only\n"); | 168 | errorMsg("WARNING: loop device is read-only\n"); |
| 169 | flags &= ~MS_RDONLY; | 169 | flags &= ~MS_RDONLY; |
| 170 | } | 170 | } |
| 171 | } | 171 | } |
| @@ -329,7 +329,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
| 329 | 329 | ||
| 330 | if (status == FALSE) { | 330 | if (status == FALSE) { |
| 331 | if (whineOnErrors == TRUE) { | 331 | if (whineOnErrors == TRUE) { |
| 332 | fprintf(stderr, "Mounting %s on %s failed: %s\n", | 332 | errorMsg("Mounting %s on %s failed: %s\n", |
| 333 | blockDevice, directory, strerror(errno)); | 333 | blockDevice, directory, strerror(errno)); |
| 334 | } | 334 | } |
| 335 | return (FALSE); | 335 | return (FALSE); |
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c index 8cdfebfce..ad0b5842d 100644 --- a/util-linux/nfsmount.c +++ b/util-linux/nfsmount.c | |||
| @@ -312,8 +312,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
| 312 | msock = fsock = -1; | 312 | msock = fsock = -1; |
| 313 | mclient = NULL; | 313 | mclient = NULL; |
| 314 | if (strlen(spec) >= sizeof(hostdir)) { | 314 | if (strlen(spec) >= sizeof(hostdir)) { |
| 315 | fprintf(stderr, _("mount: " | 315 | errorMsg("excessively long host:dir argument\n"); |
| 316 | "excessively long host:dir argument\n")); | ||
| 317 | goto fail; | 316 | goto fail; |
| 318 | } | 317 | } |
| 319 | strcpy(hostdir, spec); | 318 | strcpy(hostdir, spec); |
| @@ -325,12 +324,10 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
| 325 | until they can be fully supported. (mack@sgi.com) */ | 324 | until they can be fully supported. (mack@sgi.com) */ |
| 326 | if ((s = strchr(hostdir, ','))) { | 325 | if ((s = strchr(hostdir, ','))) { |
| 327 | *s = '\0'; | 326 | *s = '\0'; |
| 328 | fprintf(stderr, _("mount: warning: " | 327 | errorMsg("warning: multiple hostnames not supported\n"); |
| 329 | "multiple hostnames not supported\n")); | ||
| 330 | } | 328 | } |
| 331 | } else { | 329 | } else { |
| 332 | fprintf(stderr, _("mount: " | 330 | errorMsg("directory to mount not in host:dir format\n"); |
| 333 | "directory to mount not in host:dir format\n")); | ||
| 334 | goto fail; | 331 | goto fail; |
| 335 | } | 332 | } |
| 336 | 333 | ||
| @@ -340,13 +337,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
| 340 | #endif | 337 | #endif |
| 341 | { | 338 | { |
| 342 | if ((hp = gethostbyname(hostname)) == NULL) { | 339 | if ((hp = gethostbyname(hostname)) == NULL) { |
| 343 | fprintf(stderr, _("mount: can't get address for %s\n"), | 340 | errorMsg("can't get address for %s\n", hostname); |
| 344 | hostname); | ||
| 345 | goto fail; | 341 | goto fail; |
| 346 | } else { | 342 | } else { |
| 347 | if (hp->h_length > sizeof(struct in_addr)) { | 343 | if (hp->h_length > sizeof(struct in_addr)) { |
| 348 | fprintf(stderr, | 344 | errorMsg("got bad hp->h_length\n"); |
| 349 | _("mount: got bad hp->h_length\n")); | ||
| 350 | hp->h_length = sizeof(struct in_addr); | 345 | hp->h_length = sizeof(struct in_addr); |
| 351 | } | 346 | } |
| 352 | memcpy(&server_addr.sin_addr, | 347 | memcpy(&server_addr.sin_addr, |
| @@ -363,8 +358,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
| 363 | if (!old_opts) | 358 | if (!old_opts) |
| 364 | old_opts = ""; | 359 | old_opts = ""; |
| 365 | if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { | 360 | if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { |
| 366 | fprintf(stderr, _("mount: " | 361 | errorMsg("excessively long option argument\n"); |
| 367 | "excessively long option argument\n")); | ||
| 368 | goto fail; | 362 | goto fail; |
| 369 | } | 363 | } |
| 370 | sprintf(new_opts, "%s%saddr=%s", | 364 | sprintf(new_opts, "%s%saddr=%s", |
| @@ -524,11 +518,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
| 524 | data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); | 518 | data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); |
| 525 | #endif | 519 | #endif |
| 526 | if (nfsvers > MAX_NFSPROT) { | 520 | if (nfsvers > MAX_NFSPROT) { |
| 527 | fprintf(stderr, "NFSv%d not supported!\n", nfsvers); | 521 | errorMsg("NFSv%d not supported!\n", nfsvers); |
| 528 | return 0; | 522 | return 0; |
| 529 | } | 523 | } |
| 530 | if (mountvers > MAX_NFSPROT) { | 524 | if (mountvers > MAX_NFSPROT) { |
| 531 | fprintf(stderr, "NFSv%d not supported!\n", nfsvers); | 525 | errorMsg("NFSv%d not supported!\n", nfsvers); |
| 532 | return 0; | 526 | return 0; |
| 533 | } | 527 | } |
| 534 | if (nfsvers && !mountvers) | 528 | if (nfsvers && !mountvers) |
| @@ -588,13 +582,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
| 588 | mount_server_addr.sin_addr.s_addr = inet_addr(hostname); | 582 | mount_server_addr.sin_addr.s_addr = inet_addr(hostname); |
| 589 | } else { | 583 | } else { |
| 590 | if ((hp = gethostbyname(mounthost)) == NULL) { | 584 | if ((hp = gethostbyname(mounthost)) == NULL) { |
| 591 | fprintf(stderr, _("mount: can't get address for %s\n"), | 585 | errorMsg("can't get address for %s\n", hostname); |
| 592 | hostname); | ||
| 593 | goto fail; | 586 | goto fail; |
| 594 | } else { | 587 | } else { |
| 595 | if (hp->h_length > sizeof(struct in_addr)) { | 588 | if (hp->h_length > sizeof(struct in_addr)) { |
| 596 | fprintf(stderr, | 589 | errorMsg("got bad hp->h_length?\n"); |
| 597 | _("mount: got bad hp->h_length?\n")); | ||
| 598 | hp->h_length = sizeof(struct in_addr); | 590 | hp->h_length = sizeof(struct in_addr); |
| 599 | } | 591 | } |
| 600 | mount_server_addr.sin_family = AF_INET; | 592 | mount_server_addr.sin_family = AF_INET; |
| @@ -729,8 +721,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
| 729 | 721 | ||
| 730 | if (nfsvers == 2) { | 722 | if (nfsvers == 2) { |
| 731 | if (status.nfsv2.fhs_status != 0) { | 723 | if (status.nfsv2.fhs_status != 0) { |
| 732 | fprintf(stderr, | 724 | errorMsg("%s:%s failed, reason given by server: %s\n", |
| 733 | "mount: %s:%s failed, reason given by server: %s\n", | ||
| 734 | hostname, dirname, | 725 | hostname, dirname, |
| 735 | nfs_strerror(status.nfsv2.fhs_status)); | 726 | nfs_strerror(status.nfsv2.fhs_status)); |
| 736 | goto fail; | 727 | goto fail; |
| @@ -748,8 +739,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
| 748 | #if NFS_MOUNT_VERSION >= 4 | 739 | #if NFS_MOUNT_VERSION >= 4 |
| 749 | fhandle3 *fhandle; | 740 | fhandle3 *fhandle; |
| 750 | if (status.nfsv3.fhs_status != 0) { | 741 | if (status.nfsv3.fhs_status != 0) { |
| 751 | fprintf(stderr, | 742 | errorMsg("%s:%s failed, reason given by server: %s\n", |
| 752 | "mount: %s:%s failed, reason given by server: %s\n", | ||
| 753 | hostname, dirname, | 743 | hostname, dirname, |
| 754 | nfs_strerror(status.nfsv3.fhs_status)); | 744 | nfs_strerror(status.nfsv3.fhs_status)); |
| 755 | goto fail; | 745 | goto fail; |
diff --git a/util-linux/umount.c b/util-linux/umount.c index 59dcb6651..1b250fd3a 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c | |||
| @@ -101,7 +101,7 @@ void mtab_read(void) | |||
| 101 | return; | 101 | return; |
| 102 | 102 | ||
| 103 | if ((fp = setmntent(mtab_file, "r")) == NULL) { | 103 | if ((fp = setmntent(mtab_file, "r")) == NULL) { |
| 104 | fprintf(stderr, "Cannot open %s\n", mtab_file); | 104 | errorMsg("Cannot open %s\n", mtab_file); |
| 105 | return; | 105 | return; |
| 106 | } | 106 | } |
| 107 | while ((e = getmntent(fp))) { | 107 | while ((e = getmntent(fp))) { |
| @@ -209,11 +209,9 @@ static int do_umount(const char *name, int useMtab) | |||
| 209 | status = mount(blockDevice, name, NULL, | 209 | status = mount(blockDevice, name, NULL, |
| 210 | MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); | 210 | MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); |
| 211 | if (status == 0) { | 211 | if (status == 0) { |
| 212 | fprintf(stderr, "umount: %s busy - remounted read-only\n", | 212 | errorMsg("%s busy - remounted read-only\n", blockDevice); |
| 213 | blockDevice); | ||
| 214 | } else { | 213 | } else { |
| 215 | fprintf(stderr, "umount: Cannot remount %s read-only\n", | 214 | errorMsg("Cannot remount %s read-only\n", blockDevice); |
| 216 | blockDevice); | ||
| 217 | } | 215 | } |
| 218 | } | 216 | } |
| 219 | if (status == 0) { | 217 | if (status == 0) { |
