changeset 1718:3ac823675413

Fix several printf_format warnings.
author Rob Landley <rob@landley.net>
date Sun, 01 Mar 2015 16:43:01 -0600
parents 2f2c7ae058d7
children 848969327d77
files toys/other/factor.c toys/other/modinfo.c toys/other/pmap.c toys/other/rfkill.c toys/posix/cut.c
diffstat 5 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/toys/other/factor.c	Sun Mar 01 16:35:05 2015 -0600
+++ b/toys/other/factor.c	Sun Mar 01 16:43:01 2015 -0600
@@ -22,12 +22,15 @@
   long l, ll;
 
   for (;;) {
+    char *err = s;
+
     while(isspace(*s)) s++;
     if (!*s) return;
 
     l = strtol(s, &s, 0);
     if (*s && !isspace(*s)) {
-      error_msg("%s: not integer");
+      error_msg("%s: not integer", err);
+
       return;
     }
 
--- a/toys/other/modinfo.c	Sun Mar 01 16:35:05 2015 -0600
+++ b/toys/other/modinfo.c	Sun Mar 01 16:43:01 2015 -0600
@@ -27,7 +27,7 @@
 
 static void output_field(char *field, char *value)
 {
-  if (!TT.field) xprintf("%s:%*c", field, 15 - strlen(field), ' ');
+  if (!TT.field) xprintf("%s:%*c", field, 15-(int)strlen(field), ' ');
   else if (strcmp(TT.field, field)) return;
   xprintf("%s", value);
   xputc((toys.optflags & FLAG_0) ? 0 : '\n');
--- a/toys/other/pmap.c	Sun Mar 01 16:35:05 2015 -0600
+++ b/toys/other/pmap.c	Sun Mar 01 16:43:01 2015 -0600
@@ -53,7 +53,7 @@
 
     if ((toys.optflags & (FLAG_q|FLAG_x)) == FLAG_x)
       xprintf("Address%*cKbytes     PSS   Dirty    Swap  Mode  Mapping\n",
-        (sizeof(long)*2)-4, ' ');
+        (int)(sizeof(long)*2)-4, ' ');
 
     // Loop through mappings
     for (;;) {
--- a/toys/other/rfkill.c	Sun Mar 01 16:35:05 2015 -0600
+++ b/toys/other/rfkill.c	Sun Mar 01 16:43:01 2015 -0600
@@ -49,7 +49,7 @@
       {"wimax", RFKILL_TYPE_WIMAX}, {"wwan", RFKILL_TYPE_WWAN},
       {"gps", RFKILL_TYPE_GPS}, {"fm", 7}}; // RFKILL_TYPE_FM = 7
 
-    if (!*++optargs) error_exit("'%s' needs IDENTIFIER");
+    if (!*++optargs) error_exit("'%s' needs IDENTIFIER", optargs[-1]);
     for (i = 0; i < ARRAY_LEN(rftypes); i++)
       if (!strcmp(rftypes[i].name, *optargs)) break;
     if (i == ARRAY_LEN(rftypes)) idx = atolx_range(*optargs, 0, INT_MAX);
--- a/toys/posix/cut.c	Sun Mar 01 16:35:05 2015 -0600
+++ b/toys/posix/cut.c	Sun Mar 01 16:43:01 2015 -0600
@@ -111,7 +111,7 @@
       else {
         int fd = open(*argv, O_RDONLY, 0);
         if(fd < 0) {//if file not present then continue with other files.
-          perror_msg(*argv);
+          perror_msg("%s", *argv);
           continue;
         }
         TT.do_cut(fd);