aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-04-06 08:06:36 +0000
committerErik Andersen <andersen@codepoet.org>2000-04-06 08:06:36 +0000
commit93d6513d9315fa72d7af4ac2435f8c1e243273cb (patch)
treea7642802cbab4053e62cf13f2daa194c524da2e1
parent7a4b7194864e67f512dac1081f244d3c07a0eca2 (diff)
downloadbusybox-w32-93d6513d9315fa72d7af4ac2435f8c1e243273cb.tar.gz
busybox-w32-93d6513d9315fa72d7af4ac2435f8c1e243273cb.tar.bz2
busybox-w32-93d6513d9315fa72d7af4ac2435f8c1e243273cb.zip
Some more minor updates to better use some gcc attributes.
-Erik
-rw-r--r--coreutils/tail.c2
-rw-r--r--init.c2
-rw-r--r--init/init.c2
-rw-r--r--internal.h4
-rw-r--r--sfdisk.c47
-rw-r--r--sysklogd/syslogd.c2
-rw-r--r--syslogd.c2
-rw-r--r--tail.c2
8 files changed, 38 insertions, 25 deletions
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 5e05fe8e7..315eee188 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -445,6 +445,8 @@ extern int tail_main(int argc, char **argv)
445 445
446 446
447static void detailed_error(int i, int errnum, char *fmt, ...) 447static void detailed_error(int i, int errnum, char *fmt, ...)
448 __attribute__ ((format (printf, 3, 4)));
449static void detailed_error(int i, int errnum, char *fmt, ...)
448{ 450{
449 va_list arguments; 451 va_list arguments;
450 452
diff --git a/init.c b/init.c
index d61d1c38e..033eb519f 100644
--- a/init.c
+++ b/init.c
@@ -136,6 +136,8 @@ static void delete_initAction(initAction * action);
136/* Print a message to the specified device. 136/* Print a message to the specified device.
137 * Device may be bitwise-or'd from LOG | CONSOLE */ 137 * Device may be bitwise-or'd from LOG | CONSOLE */
138static void message(int device, char *fmt, ...) 138static void message(int device, char *fmt, ...)
139 __attribute__ ((format (printf, 2, 3)));
140static void message(int device, char *fmt, ...)
139{ 141{
140 va_list arguments; 142 va_list arguments;
141 int fd; 143 int fd;
diff --git a/init/init.c b/init/init.c
index d61d1c38e..033eb519f 100644
--- a/init/init.c
+++ b/init/init.c
@@ -136,6 +136,8 @@ static void delete_initAction(initAction * action);
136/* Print a message to the specified device. 136/* Print a message to the specified device.
137 * Device may be bitwise-or'd from LOG | CONSOLE */ 137 * Device may be bitwise-or'd from LOG | CONSOLE */
138static void message(int device, char *fmt, ...) 138static void message(int device, char *fmt, ...)
139 __attribute__ ((format (printf, 2, 3)));
140static void message(int device, char *fmt, ...)
139{ 141{
140 va_list arguments; 142 va_list arguments;
141 int fd; 143 int fd;
diff --git a/internal.h b/internal.h
index b90ab7e18..c8c813640 100644
--- a/internal.h
+++ b/internal.h
@@ -164,8 +164,8 @@ extern int yes_main(int argc, char** argv);
164 164
165 165
166extern void usage(const char *usage) __attribute__ ((noreturn)); 166extern void usage(const char *usage) __attribute__ ((noreturn));
167extern void errorMsg(const char *s, ...); 167extern void errorMsg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
168extern void fatalError(const char *s, ...) __attribute__ ((noreturn)); 168extern void fatalError(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
169 169
170const char *modeString(int mode); 170const char *modeString(int mode);
171const char *timeString(time_t timeVal); 171const char *timeString(time_t timeVal);
diff --git a/sfdisk.c b/sfdisk.c
index 0a740ab17..d6ba5370e 100644
--- a/sfdisk.c
+++ b/sfdisk.c
@@ -208,6 +208,7 @@ static int opt_list = 0;
208static char *save_sector_file = NULL; 208static char *save_sector_file = NULL;
209static char *restore_sector_file = NULL; 209static char *restore_sector_file = NULL;
210 210
211static void warn(char *s, ...) __attribute__ ((format (printf, 1, 2)));
211static void warn(char *s, ...) 212static void warn(char *s, ...)
212{ 213{
213 va_list p; 214 va_list p;
@@ -250,7 +251,7 @@ static int sseek(char *dev, unsigned int fd, unsigned long s)
250 if ((out = lseek(fd, in, SEEK_SET)) != in) { 251 if ((out = lseek(fd, in, SEEK_SET)) != in) {
251#endif 252#endif
252 perror("llseek"); 253 perror("llseek");
253 errorMsg("seek error on %s - cannot seek to %lu\n", dev, s, FALSE); 254 errorMsg("seek error on %s - cannot seek to %lu\n", dev, s);
254 return 0; 255 return 0;
255 } 256 }
256 257
@@ -393,7 +394,7 @@ static int save_sectors(char *dev, int fdin)
393 } 394 }
394 if (write(fdout, ss, sizeof(ss)) != sizeof(ss)) { 395 if (write(fdout, ss, sizeof(ss)) != sizeof(ss)) {
395 perror("write"); 396 perror("write");
396 errorMsg("write error on %s\n"), save_sector_file; 397 errorMsg("write error on %s\n", save_sector_file);
397 return 0; 398 return 0;
398 } 399 }
399 } 400 }
@@ -432,14 +433,14 @@ static int restore_sectors(char *dev)
432 } 433 }
433 if (read(fdin, ss, statbuf.st_size) != statbuf.st_size) { 434 if (read(fdin, ss, statbuf.st_size) != statbuf.st_size) {
434 perror("read"); 435 perror("read");
435 errorMsg("error reading %s\n"), restore_sector_file; 436 errorMsg("error reading %s\n", restore_sector_file);
436 return 0; 437 return 0;
437 } 438 }
438 439
439 fdout = open(dev, O_WRONLY); 440 fdout = open(dev, O_WRONLY);
440 if (fdout < 0) { 441 if (fdout < 0) {
441 perror(dev); 442 perror(dev);
442 errorMsg("cannot open device %s for writing\n"), dev; 443 errorMsg("cannot open device %s for writing\n", dev);
443 return 0; 444 return 0;
444 } 445 }
445 446
@@ -517,7 +518,7 @@ static void get_cylindersize(char *dev, int fd, int silent)
517 if (ioctl_ok) { 518 if (ioctl_ok) {
518 if (g.start && !force) { 519 if (g.start && !force) {
519 warn 520 warn
520 ("Warning: start=%d - this looks like a partition rather than\n" 521 ("Warning: start=%ld - this looks like a partition rather than\n"
521 "the entire disk. Using fdisk on it is probably meaningless.\n" 522 "the entire disk. Using fdisk on it is probably meaningless.\n"
522 "[Use the --force option if you really want this]\n", 523 "[Use the --force option if you really want this]\n",
523 g.start); 524 g.start);
@@ -537,7 +538,7 @@ static void get_cylindersize(char *dev, int fd, int silent)
537 printf("Disk %s: cannot get geometry\n", dev); 538 printf("Disk %s: cannot get geometry\n", dev);
538 if (B.sectors > 63) 539 if (B.sectors > 63)
539 warn 540 warn
540 ("Warning: unlikely number of sectors (%d - usually at most 63\n" 541 ("Warning: unlikely number of sectors (%ld - usually at most 63\n"
541 "This will give problems with all software that uses C/H/S addressing.\n", 542 "This will give problems with all software that uses C/H/S addressing.\n",
542 B.sectors); 543 B.sectors);
543 if (!silent) 544 if (!silent)
@@ -626,17 +627,17 @@ static int chs_ok(chs a, char *v, char *w)
626 return 1; 627 return 1;
627 if (B.heads && aa.h >= B.heads) { 628 if (B.heads && aa.h >= B.heads) {
628 warn("%s of partition %s has impossible value for head: " 629 warn("%s of partition %s has impossible value for head: "
629 "%d (should be in 0-%d)\n", w, v, aa.h, B.heads - 1); 630 "%ld (should be in 0-%ld)\n", w, v, aa.h, B.heads - 1);
630 ret = 0; 631 ret = 0;
631 } 632 }
632 if (B.sectors && (aa.s == 0 || aa.s > B.sectors)) { 633 if (B.sectors && (aa.s == 0 || aa.s > B.sectors)) {
633 warn("%s of partition %s has impossible value for sector: " 634 warn("%s of partition %s has impossible value for sector: "
634 "%d (should be in 1-%d)\n", w, v, aa.s, B.sectors); 635 "%ld (should be in 1-%ld)\n", w, v, aa.s, B.sectors);
635 ret = 0; 636 ret = 0;
636 } 637 }
637 if (B.cylinders && aa.c >= B.cylinders) { 638 if (B.cylinders && aa.c >= B.cylinders) {
638 warn("%s of partition %s has impossible value for cylinders: " 639 warn("%s of partition %s has impossible value for cylinders: "
639 "%d (should be in 0-%d)\n", w, v, aa.c, B.cylinders - 1); 640 "%ld (should be in 0-%ld)\n", w, v, aa.c, B.cylinders - 1);
640 ret = 0; 641 ret = 0;
641 } 642 }
642 return ret; 643 return ret;
@@ -881,7 +882,7 @@ static int asc_to_index(char *pnam, struct disk_desc *z)
881 pno = linux_to_index(pnum, z); 882 pno = linux_to_index(pnum, z);
882 } 883 }
883 if (!(pno >= 0 && pno < z->partno)) 884 if (!(pno >= 0 && pno < z->partno))
884 fatalError("%s: no such partition\n"), pnam; 885 fatalError("%s: no such partition\n", pnam);
885 return pno; 886 return pno;
886} 887}
887 888
@@ -1211,7 +1212,7 @@ static int partitions_ok(struct disk_desc *z)
1211 if (!partno) 1212 if (!partno)
1212 fatalError("no partition table present.\n"); 1213 fatalError("no partition table present.\n");
1213 else 1214 else
1214 fatalError("strange, only %d partitions defined.\n"), partno; 1215 fatalError("strange, only %d partitions defined.\n", partno);
1215 return 0; 1216 return 0;
1216 } 1217 }
1217 1218
@@ -1240,8 +1241,8 @@ static int partitions_ok(struct disk_desc *z)
1240 q = p->ep; 1241 q = p->ep;
1241 if (p->start < q->start 1242 if (p->start < q->start
1242 || p->start + p->size > q->start + q->size) { 1243 || p->start + p->size > q->start + q->size) {
1243 warn("Warning: partition %s "), PNO(p); 1244 warn("Warning: partition %s ", PNO(p));
1244 warn("is not contained in partition %s\n"), PNO(q); 1245 warn("is not contained in partition %s\n", PNO(q));
1245 return 0; 1246 return 0;
1246 } 1247 }
1247 } 1248 }
@@ -1252,8 +1253,8 @@ static int partitions_ok(struct disk_desc *z)
1252 for (q = p + 1; q < partitions + partno; q++) 1253 for (q = p + 1; q < partitions + partno; q++)
1253 if (q->size && !is_extended(q->p.sys_type)) 1254 if (q->size && !is_extended(q->p.sys_type))
1254 if (!((p->start > q->start) ? disj(q, p) : disj(p, q))) { 1255 if (!((p->start > q->start) ? disj(q, p) : disj(p, q))) {
1255 warn("Warning: partitions %s "), PNO(p); 1256 warn("Warning: partitions %s ", PNO(p));
1256 warn("and %s overlap\n"), PNO(q); 1257 warn("and %s overlap\n", PNO(q));
1257 return 0; 1258 return 0;
1258 } 1259 }
1259 1260
@@ -1661,7 +1662,7 @@ static int write_partitions(char *dev, int fd, struct disk_desc *z)
1661 } 1662 }
1662 } 1663 }
1663 if (!write_sectors(dev, fd)) { 1664 if (!write_sectors(dev, fd)) {
1664 errorMsg("Failed writing the partition on %s\n"), dev; 1665 errorMsg("Failed writing the partition on %s\n", dev);
1665 return 0; 1666 return 0;
1666 } 1667 }
1667 return 1; 1668 return 1;
@@ -1791,7 +1792,7 @@ read_stdin(unsigned char **fields, unsigned char *line, int fieldssize,
1791 goto nxtfld; 1792 goto nxtfld;
1792 } 1793 }
1793 } 1794 }
1794 fatalError("unrecognized input: %s\n"), ip; 1795 fatalError("unrecognized input: %s\n", ip);
1795 } 1796 }
1796 1797
1797 /* split line into fields */ 1798 /* split line into fields */
@@ -2651,7 +2652,7 @@ static void do_list(char *dev, int silent)
2651 2652
2652 if (verify) { 2653 if (verify) {
2653 if (partitions_ok(z)) 2654 if (partitions_ok(z))
2654 warn("%s: OK\n"), dev; 2655 warn("%s: OK\n", dev);
2655 else 2656 else
2656 exit_status = 1; 2657 exit_status = 1;
2657 } 2658 }
@@ -2687,7 +2688,7 @@ static void do_size(char *dev, int silent)
2687 if (ioctl(fd, BLKGETSIZE, &size)) { 2688 if (ioctl(fd, BLKGETSIZE, &size)) {
2688 if (!silent) { 2689 if (!silent) {
2689 perror(dev); 2690 perror(dev);
2690 fatalError("BLKGETSIZE ioctl failed for %s\n"), dev; 2691 fatalError("BLKGETSIZE ioctl failed for %s\n", dev);
2691 } 2692 }
2692 return; 2693 return;
2693 } 2694 }
@@ -2865,7 +2866,7 @@ static void do_change_id(char *dev, char *pnam, char *id)
2865 } 2866 }
2866 i = strtoul(id, NULL, 16); 2867 i = strtoul(id, NULL, 16);
2867 if (i > 255) 2868 if (i > 255)
2868 fatalError("Bad Id %x\n"), i; 2869 fatalError("Bad Id %lx\n", i);
2869 z->partitions[pno].p.sys_type = i; 2870 z->partitions[pno].p.sys_type = i;
2870 2871
2871 if (write_partitions(dev, fd, z)) 2872 if (write_partitions(dev, fd, z))
@@ -2897,10 +2898,10 @@ static void do_fdisk(char *dev)
2897 2898
2898 if (stat(dev, &statbuf) < 0) { 2899 if (stat(dev, &statbuf) < 0) {
2899 perror(dev); 2900 perror(dev);
2900 fatalError("Fatal error: cannot find %s\n"), dev; 2901 fatalError("Fatal error: cannot find %s\n", dev);
2901 } 2902 }
2902 if (!S_ISBLK(statbuf.st_mode)) { 2903 if (!S_ISBLK(statbuf.st_mode)) {
2903 warn("Warning: %s is not a block device\n"), dev; 2904 warn("Warning: %s is not a block device\n", dev);
2904 no_reread = 1; 2905 no_reread = 1;
2905 } 2906 }
2906 fd = my_open(dev, !no_write, 0); 2907 fd = my_open(dev, !no_write, 0);
@@ -2930,7 +2931,7 @@ static void do_fdisk(char *dev)
2930 out_partitions(dev, z); 2931 out_partitions(dev, z);
2931 2932
2932 if (one_only && (one_only_pno = linux_to_index(one_only, z)) < 0) 2933 if (one_only && (one_only_pno = linux_to_index(one_only, z)) < 0)
2933 fatalError("Partition %d does not exist, cannot change it\n"), one_only; 2934 fatalError("Partition %d does not exist, cannot change it\n", one_only);
2934 2935
2935 z = &newp; 2936 z = &newp;
2936 2937
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 464d7846e..5d6d2a0dd 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -75,6 +75,8 @@ static const char syslogd_usage[] =
75/* Note: There is also a function called "message()" in init.c */ 75/* Note: There is also a function called "message()" in init.c */
76/* Print a message to the log file. */ 76/* Print a message to the log file. */
77static void message(char *fmt, ...) 77static void message(char *fmt, ...)
78 __attribute__ ((format (printf, 1, 2)));
79static void message(char *fmt, ...)
78{ 80{
79 int fd; 81 int fd;
80 va_list arguments; 82 va_list arguments;
diff --git a/syslogd.c b/syslogd.c
index 464d7846e..5d6d2a0dd 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -75,6 +75,8 @@ static const char syslogd_usage[] =
75/* Note: There is also a function called "message()" in init.c */ 75/* Note: There is also a function called "message()" in init.c */
76/* Print a message to the log file. */ 76/* Print a message to the log file. */
77static void message(char *fmt, ...) 77static void message(char *fmt, ...)
78 __attribute__ ((format (printf, 1, 2)));
79static void message(char *fmt, ...)
78{ 80{
79 int fd; 81 int fd;
80 va_list arguments; 82 va_list arguments;
diff --git a/tail.c b/tail.c
index 5e05fe8e7..315eee188 100644
--- a/tail.c
+++ b/tail.c
@@ -445,6 +445,8 @@ extern int tail_main(int argc, char **argv)
445 445
446 446
447static void detailed_error(int i, int errnum, char *fmt, ...) 447static void detailed_error(int i, int errnum, char *fmt, ...)
448 __attribute__ ((format (printf, 3, 4)));
449static void detailed_error(int i, int errnum, char *fmt, ...)
448{ 450{
449 va_list arguments; 451 va_list arguments;
450 452