Hi tech --

Silence some warnings in tftp(1) found by WARNINGS=yes.

~Brian

Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/tftp/main.c,v
retrieving revision 1.41
diff -u -p -u -p -r1.41 main.c
--- main.c      21 Jan 2017 11:32:04 -0000      1.41
+++ main.c      30 May 2017 01:38:56 -0000
@@ -458,15 +458,15 @@ get(int argc, char *argv[])
                if (src == NULL)
                        src = argv[n];
                else {
-                       char *cp;
+                       char *cpy;
 
                        *src++ = 0;
-                       cp = argv[n];
-                       if (cp[0] == '[' && cp[strlen(cp) - 1] == ']') {
-                               cp[strlen(cp) - 1] = '\0';
-                               cp++;
+                       cpy = argv[n];
+                       if (cpy[0] == '[' && cpy[strlen(cpy) - 1] == ']') {
+                               cpy[strlen(cpy) - 1] = '\0';
+                               cpy++;
                        }
-                       setpeer(cp, NULL);
+                       setpeer(cpy, NULL);
                        if (!connected)
                                continue;
                }
Index: tftp.c
===================================================================
RCS file: /cvs/src/usr.bin/tftp/tftp.c,v
retrieving revision 1.24
diff -u -p -u -p -r1.24 tftp.c
--- tftp.c      21 Oct 2014 06:15:16 -0000      1.24
+++ tftp.c      30 May 2017 01:38:56 -0000
@@ -506,7 +506,7 @@ nak(int error, struct sockaddr *peer)
 static void
 tpacket(const char *s, struct tftphdr *tp, int n)
 {
-       char            *cp, *file;
+       char            *cp, *ofile;
        static char     *opcodes[] =
            { "#0", "RRQ", "WRQ", "DATA", "ACK", "ERROR", "OACK" };
 
@@ -521,9 +521,9 @@ tpacket(const char *s, struct tftphdr *t
        case RRQ:
        case WRQ:
                n -= 2;
-               file = cp = tp->th_stuff;
+               ofile = cp = tp->th_stuff;
                cp = strchr(cp, '\0');
-               printf("<file=%s, mode=%s", file, cp + 1);
+               printf("<file=%s, mode=%s", ofile, cp + 1);
                if (has_options)
                        oack(tp, n, 1);
                printf(">\n");
@@ -579,7 +579,7 @@ printtimeout(void)
 }
 
 static void
-oack(struct tftphdr *tp, int size, int trace)
+oack(struct tftphdr *tp, int size, int trac)
 {
        int      i, len, off;
        char    *opt, *val;
@@ -598,7 +598,7 @@ oack(struct tftphdr *tp, int size, int t
                opt++;
                val = opt;
                off = len;
-               if (trace)
+               if (trac)
                        printf(", ");
        } else
                off = 2;
@@ -610,7 +610,7 @@ oack(struct tftphdr *tp, int size, int t
                }
                /* got option and value */
                val++;
-               if (trace)
+               if (trac)
                        printf("%s=%s", opt, val);
                else
                        if (oack_set(opt, val) == -1)
@@ -619,7 +619,7 @@ oack(struct tftphdr *tp, int size, int t
                val += len;
                opt = val;
                i += len;
-               if (trace && i < size - 1)
+               if (trac && i < size - 1)
                        printf(", ");
        }
 }

Reply via email to