Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/ftp convert to new knf



details:   https://anonhg.NetBSD.org/src/rev/fd31fab13738
branches:  trunk
changeset: 494939:fd31fab13738
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Jul 18 06:45:03 2000 +0000

description:
convert to new knf

diffstat:

 usr.bin/ftp/domacro.c   |  78 +++++++++++++++++++++---------------------------
 usr.bin/ftp/ruserpass.c |  10 +++---
 2 files changed, 39 insertions(+), 49 deletions(-)

diffs (184 lines):

diff -r 3d9d6af637dc -r fd31fab13738 usr.bin/ftp/domacro.c
--- a/usr.bin/ftp/domacro.c     Tue Jul 18 06:25:32 2000 +0000
+++ b/usr.bin/ftp/domacro.c     Tue Jul 18 06:45:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: domacro.c,v 1.16 2000/05/01 10:35:17 lukem Exp $       */
+/*     $NetBSD: domacro.c,v 1.17 2000/07/18 06:45:03 lukem Exp $       */
 
 /*
  * Copyright (c) 1985, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)domacro.c  8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: domacro.c,v 1.16 2000/05/01 10:35:17 lukem Exp $");
+__RCSID("$NetBSD: domacro.c,v 1.17 2000/07/18 06:45:03 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -62,9 +62,8 @@
                return;
        }
        for (i = 0; i < macnum; ++i) {
-               if (!strncmp(argv[1], macros[i].mac_name, 9)) {
+               if (!strncmp(argv[1], macros[i].mac_name, 9))
                        break;
-               }
        }
        if (i == macnum) {
                fprintf(ttyout, "'%s' macro not found.\n", argv[1]);
@@ -72,48 +71,45 @@
                return;
        }
        (void)strcpy(line2, line);
-TOP:
+ TOP:
        cp1 = macros[i].mac_start;
        while (cp1 != macros[i].mac_end) {
-               while (isspace((unsigned char)*cp1)) {
+               while (isspace((unsigned char)*cp1))
                        cp1++;
-               }
                cp2 = line;
                while (*cp1 != '\0') {
-                     switch(*cp1) {
-                           case '\\':
-                                *cp2++ = *++cp1;
-                                break;
-                           case '$':
-                                if (isdigit((unsigned char)*(cp1+1))) {
-                                   j = 0;
-                                   while (isdigit((unsigned char)*++cp1)) {
-                                         j = 10*j +  *cp1 - '0';
-                                   }
-                                   cp1--;
-                                   if (argc - 2 >= j) {
-                                       (void)strcpy(cp2, argv[j+1]);
-                                       cp2 += strlen(argv[j+1]);
-                                   }
-                                   break;
-                                }
-                                if (*(cp1+1) == 'i') {
+                       switch(*cp1) {
+                       case '\\':
+                               *cp2++ = *++cp1;
+                               break;
+                       case '$':
+                               if (isdigit((unsigned char)*(cp1+1))) {
+                                       j = 0;
+                                       while (isdigit((unsigned char)*++cp1))
+                                               j = 10*j +  *cp1 - '0';
+                                       cp1--;
+                                       if (argc - 2 >= j) {
+                                               (void)strcpy(cp2, argv[j+1]);
+                                               cp2 += strlen(argv[j+1]);
+                                       }
+                                       break;
+                               }
+                               if (*(cp1+1) == 'i') {
                                        loopflg = 1;
                                        cp1++;
                                        if (count < argc) {
-                                          (void)strcpy(cp2, argv[count]);
-                                          cp2 += strlen(argv[count]);
+                                               (void)strcpy(cp2, argv[count]);
+                                               cp2 += strlen(argv[count]);
                                        }
                                        break;
                                }
                                /* intentional drop through */
-                           default:
+                       default:
                                *cp2++ = *cp1;
                                break;
-                     }
-                     if (*cp1 != '\0') {
-                        cp1++;
-                     }
+                       }
+                       if (*cp1 != '\0')
+                               cp1++;
                }
                *cp2 = '\0';
                makeargv();
@@ -121,34 +117,28 @@
                if (c == (struct cmd *)-1) {
                        fputs("?Ambiguous command.\n", ttyout);
                        code = -1;
-               }
-               else if (c == 0) {
+               } else if (c == 0) {
                        fputs("?Invalid command.\n", ttyout);
                        code = -1;
-               }
-               else if (c->c_conn && !connected) {
+               } else if (c->c_conn && !connected) {
                        fputs("Not connected.\n", ttyout);
                        code = -1;
-               }
-               else {
+               } else {
                        if (verbose) {
                                fputs(line, ttyout);
                                putc('\n', ttyout);
                        }
                        (*c->c_handler)(margc, margv);
-                       if (bell && c->c_bell) {
+                       if (bell && c->c_bell)
                                (void)putc('\007', ttyout);
-                       }
                        (void)strcpy(line, line2);
                        makeargv();
                        argc = margc;
                        argv = margv;
                }
-               if (cp1 != macros[i].mac_end) {
+               if (cp1 != macros[i].mac_end)
                        cp1++;
-               }
        }
-       if (loopflg && ++count < argc) {
+       if (loopflg && ++count < argc)
                goto TOP;
-       }
 }
diff -r 3d9d6af637dc -r fd31fab13738 usr.bin/ftp/ruserpass.c
--- a/usr.bin/ftp/ruserpass.c   Tue Jul 18 06:25:32 2000 +0000
+++ b/usr.bin/ftp/ruserpass.c   Tue Jul 18 06:45:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ruserpass.c,v 1.26 2000/05/01 10:35:19 lukem Exp $     */
+/*     $NetBSD: ruserpass.c,v 1.27 2000/07/18 06:47:02 lukem Exp $     */
 
 /*
  * Copyright (c) 1985, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)ruserpass.c        8.4 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: ruserpass.c,v 1.26 2000/05/01 10:35:19 lukem Exp $");
+__RCSID("$NetBSD: ruserpass.c,v 1.27 2000/07/18 06:47:02 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -111,7 +111,7 @@
        myname[sizeof(myname) - 1] = '\0';
        if ((mydomain = strchr(myname, '.')) == NULL)
                mydomain = "";
-next:
+ next:
        while ((t = token())) switch(t) {
 
        case DEFAULT:
@@ -255,10 +255,10 @@
                }
                goto done;
        }
-done:
+ done:
        (void)fclose(cfile);
        return (0);
-bad:
+ bad:
        (void)fclose(cfile);
        return (-1);
 }



Home | Main Index | Thread Index | Old Index