Mercurial > hg > toybox
changeset 1714:0c8ef714cf03 draft
Patches from Elliott Hughes to fix various printf() format strings.
(Don't specify the space flag when it's the default behavior. The ifconfig
stuff was actual bugs.)
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 01 Mar 2015 16:08:51 -0600 |
parents | 58d9f1b61f0a |
children | a471f338b055 |
files | toys/other/ifconfig.c toys/posix/cp.c toys/posix/df.c toys/posix/ls.c |
diffstat | 4 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/toys/other/ifconfig.c Sun Mar 01 15:58:40 2015 -0600 +++ b/toys/other/ifconfig.c Sun Mar 01 16:08:51 2015 -0600 @@ -254,7 +254,7 @@ xprintf("%10c", ' '); if(ifre.ifr_map.irq) xprintf("Interrupt:%d ", ifre.ifr_map.irq); if(ifre.ifr_map.base_addr >= 0x100) // IO_MAP_INDEX - xprintf("Base address:0x%lx ", ifre.ifr_map.base_addr); + xprintf("Base address:0x%x ", ifre.ifr_map.base_addr); if(ifre.ifr_map.mem_start) xprintf("Memory:%lx-%lx ", ifre.ifr_map.mem_start, ifre.ifr_map.mem_end); if(ifre.ifr_map.dma) xprintf("DMA chan:%x ", ifre.ifr_map.dma); @@ -449,7 +449,7 @@ if (!argv[1]) { toys.exithelp++; - error_exit(*argv); + error_exit("%s", *argv); } plen = get_addrinfo(argv[1], AF_INET6, &ifre6.addr);
--- a/toys/posix/cp.c Sun Mar 01 15:58:40 2015 -0600 +++ b/toys/posix/cp.c Sun Mar 01 16:08:51 2015 -0600 @@ -208,7 +208,7 @@ if (*or->name == '/') dotdots = 0; if (dotdots) { - char *s2 = xmprintf("% *c%s", 3*dotdots, ' ', s); + char *s2 = xmprintf("%*c%s", 3*dotdots, ' ', s); free(s); s = s2; while(dotdots--) {
--- a/toys/posix/df.c Sun Mar 01 15:58:40 2015 -0600 +++ b/toys/posix/df.c Sun Mar 01 16:08:51 2015 -0600 @@ -86,7 +86,7 @@ // Units are 512 bytes if you select "pedantic" without "kilobytes". TT.units = p ? 512 : 1024; - xprintf("Filesystem% 8s-blocks\tUsed Available %s Mounted on\n", + xprintf("Filesystem%8s-blocks\tUsed Available %s Mounted on\n", p ? "512" : "1K", p ? "Capacity" : "Use%"); if (!(mtstart = xgetmountlist(0))) return;
--- a/toys/posix/ls.c Sun Mar 01 15:58:40 2015 -0600 +++ b/toys/posix/ls.c Sun Mar 01 16:08:51 2015 -0600 @@ -375,8 +375,8 @@ } width += *len; - if (flags & FLAG_i) xprintf("% *lu ", len[1], (unsigned long)st->st_ino); - if (flags & FLAG_s) xprintf("% *lu ", len[6], (unsigned long)st->st_blocks); + if (flags & FLAG_i) xprintf("%*lu ", len[1], (unsigned long)st->st_ino); + if (flags & FLAG_s) xprintf("%*lu ", len[6], (unsigned long)st->st_blocks); if (flags & (FLAG_l|FLAG_o|FLAG_n|FLAG_g)) { struct tm *tm;