summaryrefslogtreecommitdiff
path: root/util-linux/mkswap.c
diff options
context:
space:
mode:
authorMatt Kraai2000-07-14 01:51:25 +0000
committerMatt Kraai2000-07-14 01:51:25 +0000
commitd537a95fdbc0b4a5f38edea8593b4c085fdd7fcb (patch)
tree62127f20fc07758e445d8c4e186306cbe83d77b1 /util-linux/mkswap.c
parent4ac6cb534d78d63d7b0a206118c56bad7024b9f8 (diff)
downloadbusybox-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.zip
busybox-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.tar.gz
Use errorMsg rather than fprintf.
Diffstat (limited to 'util-linux/mkswap.c')
-rw-r--r--util-linux/mkswap.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index 2009636..5a33945 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -116,7 +116,7 @@ static void init_signature_page()
#ifdef PAGE_SIZE
if (pagesize != PAGE_SIZE)
- fprintf(stderr, "Assuming pages of size %d\n", pagesize);
+ errorMsg("Assuming pages of size %d\n", pagesize);
#endif
signature_page = (int *) xmalloc(pagesize);
memset(signature_page, 0, pagesize);
@@ -204,7 +204,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr)
void die(const char *str)
{
- fprintf(stderr, "%s: %s\n", applet_name, str);
+ errorMsg("%s\n", str);
exit(FALSE);
}
@@ -345,18 +345,14 @@ int mkswap_main(int argc, char **argv)
}
}
if (!device_name) {
- fprintf(stderr,
- "%s: error: Nowhere to set up swap on?\n", applet_name);
+ errorMsg("error: Nowhere to set up swap on?\n");
usage(mkswap_usage);
}
sz = get_size(device_name);
if (!PAGES) {
PAGES = sz;
} else if (PAGES > sz && !force) {
- fprintf(stderr,
- "%s: error: "
- "size %ld is larger than device size %d\n",
- applet_name,
+ errorMsg("error: size %ld is larger than device size %d\n",
PAGES * (pagesize / 1024), sz * (pagesize / 1024));
exit(FALSE);
}
@@ -372,14 +368,12 @@ int mkswap_main(int argc, char **argv)
version = 1;
}
if (version != 0 && version != 1) {
- fprintf(stderr, "%s: error: unknown version %d\n",
- applet_name, version);
+ errorMsg("error: unknown version %d\n", version);
usage(mkswap_usage);
}
if (PAGES < 10) {
- fprintf(stderr,
- "%s: error: swap area needs to be at least %ldkB\n",
- applet_name, (long) (10 * pagesize / 1024));
+ errorMsg("error: swap area needs to be at least %ldkB\n",
+ (long) (10 * pagesize / 1024));
usage(mkswap_usage);
}
#if 0
@@ -397,8 +391,8 @@ int mkswap_main(int argc, char **argv)
#endif
if (PAGES > maxpages) {
PAGES = maxpages;
- fprintf(stderr, "%s: warning: truncating swap area to %ldkB\n",
- applet_name, PAGES * pagesize / 1024);
+ errorMsg("warning: truncating swap area to %ldkB\n",
+ PAGES * pagesize / 1024);
}
DEV = open(device_name, O_RDWR);
@@ -424,11 +418,10 @@ int mkswap_main(int argc, char **argv)
for (sum = 0; q >= (unsigned short *) buffer;)
sum ^= *q--;
if (!sum) {
- fprintf(stderr, "\
-%s: Device '%s' contains a valid Sun disklabel.\n\
-This probably means creating v0 swap would destroy your partition table\n\
-No swap created. If you really want to create swap v0 on that device, use\n\
-the -f option to force it.\n", applet_name, device_name);
+ errorMsg("Device '%s' contains a valid Sun disklabel.\n"
+"This probably means creating v0 swap would destroy your partition table\n"
+"No swap created. If you really want to create swap v0 on that device, use\n"
+"the -f option to force it.\n", device_name);
exit(FALSE);
}
}