convert to new knf

This commit is contained in:
lukem 2000-07-18 06:45:03 +00:00
parent f7dacc7a8e
commit 144c518689
2 changed files with 39 additions and 49 deletions

View File

@ -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 @@ domacro(int argc, char *argv[])
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 @@ domacro(int argc, char *argv[])
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 @@ TOP:
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;
}
}

View File

@ -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 @@ ruserpass(const char *host, const char **aname, const char **apass,
myname[sizeof(myname) - 1] = '\0';
if ((mydomain = strchr(myname, '.')) == NULL)
mydomain = "";
next:
next:
while ((t = token())) switch(t) {
case DEFAULT:
@ -255,10 +255,10 @@ next:
}
goto done;
}
done:
done:
(void)fclose(cfile);
return (0);
bad:
bad:
(void)fclose(cfile);
return (-1);
}