aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-11-29 16:45:45 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2013-11-29 16:45:45 +0100
commit327f550669a80d72f36bc9e4de619c163aa46eff (patch)
treed304092aeb06539085be1385ab9298876c414b44
parent9b2a9f0210f13f1c59c0b954c4aa0eeb0a66efd1 (diff)
downloadbusybox-w32-327f550669a80d72f36bc9e4de619c163aa46eff.tar.gz
busybox-w32-327f550669a80d72f36bc9e4de619c163aa46eff.tar.bz2
busybox-w32-327f550669a80d72f36bc9e4de619c163aa46eff.zip
Use unsigned printf/scanf conversion where more appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/cal.c2
-rw-r--r--coreutils/sum.c4
-rw-r--r--e2fsprogs/old_e2fsprogs/mke2fs.c2
-rw-r--r--e2fsprogs/old_e2fsprogs/tune2fs.c2
-rw-r--r--e2fsprogs/old_e2fsprogs/util.c2
-rw-r--r--editors/patch_bbox.c4
-rw-r--r--miscutils/hdparm.c8
-rw-r--r--networking/arp.c4
-rw-r--r--networking/netstat.c8
-rw-r--r--networking/pscan.c2
-rw-r--r--procps/pgrep.c4
-rw-r--r--procps/top.c2
-rw-r--r--sysklogd/logread.c2
-rw-r--r--util-linux/fdformat.c2
-rw-r--r--util-linux/fsck_minix.c2
-rw-r--r--util-linux/ipcs.c10
-rw-r--r--util-linux/mkfs_minix.c2
-rw-r--r--util-linux/readprofile.c12
18 files changed, 37 insertions, 37 deletions
diff --git a/coreutils/cal.c b/coreutils/cal.c
index 0d388aa1c..12c46b14f 100644
--- a/coreutils/cal.c
+++ b/coreutils/cal.c
@@ -165,7 +165,7 @@ int cal_main(int argc UNUSED_PARAM, char **argv)
165 char lineout[30]; 165 char lineout[30];
166 166
167 day_array(month, year, dp); 167 day_array(month, year, dp);
168 len = sprintf(lineout, "%s %d", month_names[month - 1], year); 168 len = sprintf(lineout, "%s %u", month_names[month - 1], year);
169 printf("%*s%s\n%s\n", 169 printf("%*s%s\n%s\n",
170 ((7*julian + WEEK_LEN) - len) / 2, "", 170 ((7*julian + WEEK_LEN) - len) / 2, "",
171 lineout, day_headings); 171 lineout, day_headings);
diff --git a/coreutils/sum.c b/coreutils/sum.c
index 75f6ef60a..deb068e10 100644
--- a/coreutils/sum.c
+++ b/coreutils/sum.c
@@ -70,9 +70,9 @@ static unsigned sum_file(const char *file, unsigned type)
70 if (type >= SUM_SYSV) { 70 if (type >= SUM_SYSV) {
71 r = (s & 0xffff) + ((s & 0xffffffff) >> 16); 71 r = (s & 0xffff) + ((s & 0xffffffff) >> 16);
72 s = (r & 0xffff) + (r >> 16); 72 s = (r & 0xffff) + (r >> 16);
73 printf("%d %llu %s\n", s, (total_bytes + 511) / 512, file); 73 printf("%u %llu %s\n", s, (total_bytes + 511) / 512, file);
74 } else 74 } else
75 printf("%05d %5llu %s\n", s, (total_bytes + 1023) / 1024, file); 75 printf("%05u %5llu %s\n", s, (total_bytes + 1023) / 1024, file);
76 return 1; 76 return 1;
77#undef buf 77#undef buf
78} 78}
diff --git a/e2fsprogs/old_e2fsprogs/mke2fs.c b/e2fsprogs/old_e2fsprogs/mke2fs.c
index e44d9865c..ebcb46cf2 100644
--- a/e2fsprogs/old_e2fsprogs/mke2fs.c
+++ b/e2fsprogs/old_e2fsprogs/mke2fs.c
@@ -239,7 +239,7 @@ static void test_disk(ext2_filsys fs, badblocks_list *bb_list)
239 errcode_t retval; 239 errcode_t retval;
240 char buf[1024]; 240 char buf[1024];
241 241
242 sprintf(buf, "badblocks -b %d %s%s%s %d", fs->blocksize, 242 sprintf(buf, "badblocks -b %u %s%s%s %d", fs->blocksize,
243 quiet ? "" : "-s ", (cflag > 1) ? "-w " : "", 243 quiet ? "" : "-s ", (cflag > 1) ? "-w " : "",
244 fs->device_name, fs->super->s_blocks_count); 244 fs->device_name, fs->super->s_blocks_count);
245 mke2fs_verbose("Running command: %s\n", buf); 245 mke2fs_verbose("Running command: %s\n", buf);
diff --git a/e2fsprogs/old_e2fsprogs/tune2fs.c b/e2fsprogs/old_e2fsprogs/tune2fs.c
index 3c3f4afa5..bbe30e5a0 100644
--- a/e2fsprogs/old_e2fsprogs/tune2fs.c
+++ b/e2fsprogs/old_e2fsprogs/tune2fs.c
@@ -607,7 +607,7 @@ int tune2fs_main(int argc, char **argv)
607 if (e_flag) { 607 if (e_flag) {
608 sb->s_errors = errors; 608 sb->s_errors = errors;
609 ext2fs_mark_super_dirty(fs); 609 ext2fs_mark_super_dirty(fs);
610 printf("Setting error behavior to %d\n", errors); 610 printf("Setting error behavior to %u\n", errors);
611 } 611 }
612 if (g_flag) { 612 if (g_flag) {
613 sb->s_def_resgid = resgid; 613 sb->s_def_resgid = resgid;
diff --git a/e2fsprogs/old_e2fsprogs/util.c b/e2fsprogs/old_e2fsprogs/util.c
index e6758e093..3e7ee8e75 100644
--- a/e2fsprogs/old_e2fsprogs/util.c
+++ b/e2fsprogs/old_e2fsprogs/util.c
@@ -239,7 +239,7 @@ void make_journal_blocks(ext2_filsys fs, int journal_size, int journal_flags, in
239 return; 239 return;
240 } 240 }
241 if (!quiet) 241 if (!quiet)
242 printf("Creating journal (%ld blocks): ", journal_blocks); 242 printf("Creating journal (%lu blocks): ", journal_blocks);
243 fflush(stdout); 243 fflush(stdout);
244 retval = ext2fs_add_journal_inode(fs, journal_blocks, 244 retval = ext2fs_add_journal_inode(fs, journal_blocks,
245 journal_flags); 245 journal_flags);
diff --git a/editors/patch_bbox.c b/editors/patch_bbox.c
index 78aa5fde8..aae7b7987 100644
--- a/editors/patch_bbox.c
+++ b/editors/patch_bbox.c
@@ -188,8 +188,8 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
188 unsigned src_last_line = 1; 188 unsigned src_last_line = 1;
189 unsigned dst_last_line = 1; 189 unsigned dst_last_line = 1;
190 190
191 if ((sscanf(patch_line, "@@ -%d,%d +%d,%d", &src_beg_line, &src_last_line, &dst_beg_line, &dst_last_line) < 3) 191 if ((sscanf(patch_line, "@@ -%u,%u +%u,%u", &src_beg_line, &src_last_line, &dst_beg_line, &dst_last_line) < 3)
192 && (sscanf(patch_line, "@@ -%d +%d,%d", &src_beg_line, &dst_beg_line, &dst_last_line) < 2) 192 && (sscanf(patch_line, "@@ -%u +%u,%u", &src_beg_line, &dst_beg_line, &dst_last_line) < 2)
193 ) { 193 ) {
194 /* No more hunks for this file */ 194 /* No more hunks for this file */
195 break; 195 break;
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 69726ae72..f0e9c9d75 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -465,14 +465,14 @@ static void on_off(int value)
465static void print_flag_on_off(int get_arg, const char *s, unsigned long arg) 465static void print_flag_on_off(int get_arg, const char *s, unsigned long arg)
466{ 466{
467 if (get_arg) { 467 if (get_arg) {
468 printf(" setting %s to %ld", s, arg); 468 printf(" setting %s to %lu", s, arg);
469 on_off(arg); 469 on_off(arg);
470 } 470 }
471} 471}
472 472
473static void print_value_on_off(const char *str, unsigned long argp) 473static void print_value_on_off(const char *str, unsigned long argp)
474{ 474{
475 printf(" %s\t= %2ld", str, argp); 475 printf(" %s\t= %2lu", str, argp);
476 on_off(argp != 0); 476 on_off(argp != 0);
477} 477}
478 478
@@ -1509,7 +1509,7 @@ static void bus_state_value(unsigned value)
1509 else if (value == BUSSTATE_TRISTATE) 1509 else if (value == BUSSTATE_TRISTATE)
1510 printf(" (tristate)\n"); 1510 printf(" (tristate)\n");
1511 else 1511 else
1512 printf(" (unknown: %d)\n", value); 1512 printf(" (unknown: %u)\n", value);
1513} 1513}
1514#endif 1514#endif
1515 1515
@@ -1589,7 +1589,7 @@ static void interpret_xfermode(unsigned xfermode)
1589static void print_flag(int flag, const char *s, unsigned long value) 1589static void print_flag(int flag, const char *s, unsigned long value)
1590{ 1590{
1591 if (flag) 1591 if (flag)
1592 printf(" setting %s to %ld\n", s, value); 1592 printf(" setting %s to %lu\n", s, value);
1593} 1593}
1594 1594
1595static void process_dev(char *devname) 1595static void process_dev(char *devname)
diff --git a/networking/arp.c b/networking/arp.c
index 40d244116..e79b1b6a1 100644
--- a/networking/arp.c
+++ b/networking/arp.c
@@ -459,12 +459,12 @@ static int arp_show(char *name)
459 arp_disp(hostname, ip, type, flags, hwa, mask, dev); 459 arp_disp(hostname, ip, type, flags, hwa, mask, dev);
460 } 460 }
461 if (option_mask32 & ARP_OPT_v) 461 if (option_mask32 & ARP_OPT_v)
462 printf("Entries: %d\tSkipped: %d\tFound: %d\n", 462 printf("Entries: %u\tSkipped: %u\tFound: %u\n",
463 entries, entries - shown, shown); 463 entries, entries - shown, shown);
464 464
465 if (!shown) { 465 if (!shown) {
466 if (hw_set || host || device[0]) 466 if (hw_set || host || device[0])
467 printf("No match found in %d entries\n", entries); 467 printf("No match found in %u entries\n", entries);
468 } 468 }
469 if (ENABLE_FEATURE_CLEAN_UP) { 469 if (ENABLE_FEATURE_CLEAN_UP) {
470 free((char*)host); 470 free((char*)host);
diff --git a/networking/netstat.c b/networking/netstat.c
index c0c6ba501..f80b845bc 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -125,10 +125,10 @@ typedef enum {
125 */ 125 */
126#define ADDR_WIDE 51 /* INET6_ADDRSTRLEN + 5 for the port number */ 126#define ADDR_WIDE 51 /* INET6_ADDRSTRLEN + 5 for the port number */
127#if ENABLE_FEATURE_NETSTAT_WIDE 127#if ENABLE_FEATURE_NETSTAT_WIDE
128# define FMT_NET_CONN_DATA "%s %6ld %6ld %-*s %-*s %-12s" 128# define FMT_NET_CONN_DATA "%s %6lu %6lu %-*s %-*s %-12s"
129# define FMT_NET_CONN_HEADER "\nProto Recv-Q Send-Q %-*s %-*s State %s\n" 129# define FMT_NET_CONN_HEADER "\nProto Recv-Q Send-Q %-*s %-*s State %s\n"
130#else 130#else
131# define FMT_NET_CONN_DATA "%s %6ld %6ld %-23s %-23s %-12s" 131# define FMT_NET_CONN_DATA "%s %6lu %6lu %-23s %-23s %-12s"
132# define FMT_NET_CONN_HEADER "\nProto Recv-Q Send-Q %-23s %-23s State %s\n" 132# define FMT_NET_CONN_HEADER "\nProto Recv-Q Send-Q %-23s %-23s State %s\n"
133#endif 133#endif
134 134
@@ -403,7 +403,7 @@ static int scan_inet_proc_line(struct inet_params *param, char *line)
403 "%*d: %32[0-9A-Fa-f]:%X " 403 "%*d: %32[0-9A-Fa-f]:%X "
404 "%32[0-9A-Fa-f]:%X %X " 404 "%32[0-9A-Fa-f]:%X %X "
405 "%lX:%lX %*X:%*X " 405 "%lX:%lX %*X:%*X "
406 "%*X %d %*d %ld ", 406 "%*X %d %*d %lu ",
407 local_addr, &param->local_port, 407 local_addr, &param->local_port,
408 rem_addr, &param->rem_port, &param->state, 408 rem_addr, &param->rem_port, &param->state,
409 &param->txq, &param->rxq, 409 &param->txq, &param->rxq,
@@ -611,7 +611,7 @@ static int FAST_FUNC unix_do_one(char *line)
611 strcat(ss_flags, "N "); 611 strcat(ss_flags, "N ");
612 strcat(ss_flags, "]"); 612 strcat(ss_flags, "]");
613 613
614 printf("%-5s %-6ld %-11s %-10s %-13s %6lu ", 614 printf("%-5s %-6lu %-11s %-10s %-13s %6lu ",
615 ss_proto, refcnt, ss_flags, ss_type, ss_state, inode 615 ss_proto, refcnt, ss_flags, ss_type, ss_state, inode
616 ); 616 );
617 617
diff --git a/networking/pscan.c b/networking/pscan.c
index 28005ad57..72ed8cdb5 100644
--- a/networking/pscan.c
+++ b/networking/pscan.c
@@ -157,7 +157,7 @@ int pscan_main(int argc UNUSED_PARAM, char **argv)
157 } 157 }
158 if (ENABLE_FEATURE_CLEAN_UP) free(lsap); 158 if (ENABLE_FEATURE_CLEAN_UP) free(lsap);
159 159
160 printf("%d closed, %d open, %d timed out (or blocked) ports\n", 160 printf("%u closed, %u open, %u timed out (or blocked) ports\n",
161 closed_ports, 161 closed_ports,
162 open_ports, 162 open_ports,
163 nports - (closed_ports + open_ports)); 163 nports - (closed_ports + open_ports));
diff --git a/procps/pgrep.c b/procps/pgrep.c
index 8daf5b28a..1c7c7c48b 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -65,9 +65,9 @@ static void act(unsigned pid, char *cmd, int signo)
65{ 65{
66 if (pgrep) { 66 if (pgrep) {
67 if (option_mask32 & (1 << OPTBIT_L)) /* OPT_LIST */ 67 if (option_mask32 & (1 << OPTBIT_L)) /* OPT_LIST */
68 printf("%d %s\n", pid, cmd); 68 printf("%u %s\n", pid, cmd);
69 else 69 else
70 printf("%d\n", pid); 70 printf("%u\n", pid);
71 } else 71 } else
72 kill(pid, signo); 72 kill(pid, signo);
73} 73}
diff --git a/procps/top.c b/procps/top.c
index 31f2a5113..51f1c1aed 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -677,7 +677,7 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
677 if (s->vsz >= 100000) 677 if (s->vsz >= 100000)
678 sprintf(vsz_str_buf, "%6ldm", s->vsz/1024); 678 sprintf(vsz_str_buf, "%6ldm", s->vsz/1024);
679 else 679 else
680 sprintf(vsz_str_buf, "%7ld", s->vsz); 680 sprintf(vsz_str_buf, "%7lu", s->vsz);
681 /* PID PPID USER STAT VSZ %VSZ [%CPU] COMMAND */ 681 /* PID PPID USER STAT VSZ %VSZ [%CPU] COMMAND */
682 col = snprintf(line_buf, scr_width, 682 col = snprintf(line_buf, scr_width,
683 "\n" "%5u%6u %-8.8s %s%s" FMT 683 "\n" "%5u%6u %-8.8s %s%s" FMT
diff --git a/sysklogd/logread.c b/sysklogd/logread.c
index 92a562919..bea73d932 100644
--- a/sysklogd/logread.c
+++ b/sysklogd/logread.c
@@ -126,7 +126,7 @@ int logread_main(int argc UNUSED_PARAM, char **argv)
126 shbuf_data = shbuf->data; /* pointer! */ 126 shbuf_data = shbuf->data; /* pointer! */
127 127
128 if (DEBUG) 128 if (DEBUG)
129 printf("cur:%d tail:%i size:%i\n", 129 printf("cur:%u tail:%u size:%u\n",
130 cur, shbuf_tail, shbuf_size); 130 cur, shbuf_tail, shbuf_size);
131 131
132 if (!follow) { 132 if (!follow) {
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c
index b3e918fb0..6f49cec8f 100644
--- a/util-linux/fdformat.c
+++ b/util-linux/fdformat.c
@@ -72,7 +72,7 @@ int fdformat_main(int argc UNUSED_PARAM, char **argv)
72 /* original message was: "Could not determine current format type" */ 72 /* original message was: "Could not determine current format type" */
73 xioctl(fd, FDGETPRM, &param); 73 xioctl(fd, FDGETPRM, &param);
74 74
75 printf("%s-sided, %d tracks, %d sec/track. Total capacity %d kB\n", 75 printf("%s-sided, %u tracks, %u sec/track. Total capacity %d kB\n",
76 (param.head == 2) ? "Double" : "Single", 76 (param.head == 2) ? "Double" : "Single",
77 param.track, param.sect, param.size >> 1); 77 param.track, param.sect, param.size >> 1);
78 78
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index c1d1b2cc3..33767a1af 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -686,7 +686,7 @@ static void get_inode_common(unsigned nr, uint16_t i_mode)
686 total++; 686 total++;
687 if (!inode_count[nr]) { 687 if (!inode_count[nr]) {
688 if (!inode_in_use(nr)) { 688 if (!inode_in_use(nr)) {
689 printf("Inode %d is marked as 'unused', but it is used " 689 printf("Inode %u is marked as 'unused', but it is used "
690 "for file '%s'\n", nr, current_name); 690 "for file '%s'\n", nr, current_name);
691 if (OPT_repair) { 691 if (OPT_repair) {
692 if (ask("Mark as 'in use'", 1)) 692 if (ask("Mark as 'in use'", 1))
diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c
index 2668cafd4..67a25a8ef 100644
--- a/util-linux/ipcs.c
+++ b/util-linux/ipcs.c
@@ -166,10 +166,10 @@ static NOINLINE void do_shm(void)
166 case STATUS: 166 case STATUS:
167 printf("------ Shared Memory %s --------\n", "Status"); 167 printf("------ Shared Memory %s --------\n", "Status");
168 printf("segments allocated %d\n" 168 printf("segments allocated %d\n"
169 "pages allocated %ld\n" 169 "pages allocated %lu\n"
170 "pages resident %ld\n" 170 "pages resident %lu\n"
171 "pages swapped %ld\n" 171 "pages swapped %lu\n"
172 "Swap performance: %ld attempts\t%ld successes\n", 172 "Swap performance: %lu attempts\t%lu successes\n",
173 shm_info.used_ids, 173 shm_info.used_ids,
174 shm_info.shm_tot, 174 shm_info.shm_tot,
175 shm_info.shm_rss, 175 shm_info.shm_rss,
@@ -569,7 +569,7 @@ static void print_sem(int semid)
569 if (val < 0 || ncnt < 0 || zcnt < 0 || pid < 0) { 569 if (val < 0 || ncnt < 0 || zcnt < 0 || pid < 0) {
570 bb_perror_msg_and_die("semctl"); 570 bb_perror_msg_and_die("semctl");
571 } 571 }
572 printf("%-10d %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid); 572 printf("%-10u %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid);
573 } 573 }
574 bb_putchar('\n'); 574 bb_putchar('\n');
575} 575}
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index 49afd1176..d65a5161c 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -505,7 +505,7 @@ static void get_list_blocks(char *filename)
505 505
506 listfile = xfopen_for_read(filename); 506 listfile = xfopen_for_read(filename);
507 while (!feof(listfile)) { 507 while (!feof(listfile)) {
508 fscanf(listfile, "%ld\n", &blockno); 508 fscanf(listfile, "%lu\n", &blockno);
509 mark_zone(blockno); 509 mark_zone(blockno);
510 G.badblocks++; 510 G.badblocks++;
511 } 511 }
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c
index 974fe89c4..a64540464 100644
--- a/util-linux/readprofile.c
+++ b/util-linux/readprofile.c
@@ -152,7 +152,7 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
152 152
153 step = buf[0]; 153 step = buf[0];
154 if (optInfo) { 154 if (optInfo) {
155 printf("Sampling_step: %i\n", step); 155 printf("Sampling_step: %u\n", step);
156 return EXIT_SUCCESS; 156 return EXIT_SUCCESS;
157 } 157 }
158 158
@@ -219,10 +219,10 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
219 && (fn_len = next_add-fn_add) != 0 219 && (fn_len = next_add-fn_add) != 0
220 ) { 220 ) {
221 if (optVerbose) 221 if (optVerbose)
222 printf("%016llx %-40s %6i %8.4f\n", fn_add, 222 printf("%016llx %-40s %6u %8.4f\n", fn_add,
223 fn_name, this, this/(double)fn_len); 223 fn_name, this, this/(double)fn_len);
224 else 224 else
225 printf("%6i %-40s %8.4f\n", 225 printf("%6u %-40s %8.4f\n",
226 this, fn_name, this/(double)fn_len); 226 this, fn_name, this/(double)fn_len);
227 if (optSub) { 227 if (optSub) {
228 unsigned long long scan; 228 unsigned long long scan;
@@ -246,14 +246,14 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
246 } 246 }
247 247
248 /* clock ticks, out of kernel text - probably modules */ 248 /* clock ticks, out of kernel text - probably modules */
249 printf("%6i %s\n", buf[len/sizeof(*buf)-1], "*unknown*"); 249 printf("%6u %s\n", buf[len/sizeof(*buf)-1], "*unknown*");
250 250
251 /* trailer */ 251 /* trailer */
252 if (optVerbose) 252 if (optVerbose)
253 printf("%016x %-40s %6i %8.4f\n", 253 printf("%016x %-40s %6u %8.4f\n",
254 0, "total", total, total/(double)(fn_add-add0)); 254 0, "total", total, total/(double)(fn_add-add0));
255 else 255 else
256 printf("%6i %-40s %8.4f\n", 256 printf("%6u %-40s %8.4f\n",
257 total, "total", total/(double)(fn_add-add0)); 257 total, "total", total/(double)(fn_add-add0));
258 258
259 fclose(map); 259 fclose(map);