fix shadow warnings

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15673 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-07-19 18:19:33 +00:00
parent 30cb2f9c22
commit 8c7c8ea323

View File

@@ -574,28 +574,28 @@ reget(int argc, char **argv)
void void
get(int argc, char **argv) get(int argc, char **argv)
{ {
char *mode; char *filemode;
if (restart_point) { if (restart_point) {
if (curtype == TYPE_I) if (curtype == TYPE_I)
mode = "r+wb"; filemode = "r+wb";
else else
mode = "r+w"; filemode = "r+w";
} else { } else {
if (curtype == TYPE_I) if (curtype == TYPE_I)
mode = "wb"; filemode = "wb";
else else
mode = "w"; filemode = "w";
} }
getit(argc, argv, 0, mode); getit(argc, argv, 0, filemode);
} }
/* /*
* Receive one file. * Receive one file.
*/ */
int int
getit(int argc, char **argv, int restartit, char *mode) getit(int argc, char **argv, int restartit, char *filemode)
{ {
int loc = 0; int loc = 0;
int local_given = 1; int local_given = 1;
@@ -696,7 +696,7 @@ getit(int argc, char **argv, int restartit, char *mode)
} }
} }
recvrequest("RETR", argv[2], argv[1], mode, recvrequest("RETR", argv[2], argv[1], filemode,
argv[1] != oldargv1 || argv[2] != oldargv2, local_given); argv[1] != oldargv1 || argv[2] != oldargv2, local_given);
restart_point = 0; restart_point = 0;
return (0); return (0);
@@ -773,7 +773,7 @@ remglob(char **argv, int doswitch)
static FILE *ftemp = NULL; static FILE *ftemp = NULL;
static char **args; static char **args;
int oldverbose, oldhash; int oldverbose, oldhash;
char *cp, *mode; char *cp, *filemode;
if (!mflag) { if (!mflag) {
if (!doglob) { if (!doglob) {
@@ -808,8 +808,8 @@ remglob(char **argv, int doswitch)
if (doswitch) { if (doswitch) {
pswitch(!proxy); pswitch(!proxy);
} }
for (mode = "w"; *++argv != NULL; mode = "a") for (filemode = "w"; *++argv != NULL; filemode = "a")
recvrequest ("NLST", temp, *argv, mode, 0, 0); recvrequest ("NLST", temp, *argv, filemode, 0, 0);
if (doswitch) { if (doswitch) {
pswitch(!proxy); pswitch(!proxy);
} }
@@ -1188,7 +1188,7 @@ mls(int argc, char **argv)
{ {
sighand oldintr; sighand oldintr;
int ointer, i; int ointer, i;
char *cmd, mode[1], *dest; char *cmd, filemode[2], *dest;
if (argc < 2 && !another(&argc, &argv, "remote-files")) if (argc < 2 && !another(&argc, &argv, "remote-files"))
goto usage; goto usage;
@@ -1211,9 +1211,10 @@ usage:
mflag = 1; mflag = 1;
oldintr = signal(SIGINT, mabort); oldintr = signal(SIGINT, mabort);
setjmp(jabort); setjmp(jabort);
filemode[1] = '\0';
for (i = 1; mflag && i < argc-1; ++i) { for (i = 1; mflag && i < argc-1; ++i) {
*mode = (i == 1) ? 'w' : 'a'; *filemode = (i == 1) ? 'w' : 'a';
recvrequest(cmd, dest, argv[i], mode, 0, 1); recvrequest(cmd, dest, argv[i], filemode, 0, 1);
if (!mflag && fromatty) { if (!mflag && fromatty) {
ointer = interactive; ointer = interactive;
interactive = 1; interactive = 1;
@@ -1236,8 +1237,8 @@ shell(int argc, char **argv)
{ {
pid_t pid; pid_t pid;
RETSIGTYPE (*old1)(int), (*old2)(int); RETSIGTYPE (*old1)(int), (*old2)(int);
char shellnam[40], *shell, *namep; char shellnam[40], *shellpath, *namep;
int status; int waitstatus;
old1 = signal (SIGINT, SIG_IGN); old1 = signal (SIGINT, SIG_IGN);
old2 = signal (SIGQUIT, SIG_IGN); old2 = signal (SIGQUIT, SIG_IGN);
@@ -1246,32 +1247,32 @@ shell(int argc, char **argv)
close(pid); close(pid);
signal(SIGINT, SIG_DFL); signal(SIGINT, SIG_DFL);
signal(SIGQUIT, SIG_DFL); signal(SIGQUIT, SIG_DFL);
shell = getenv("SHELL"); shellpath = getenv("SHELL");
if (shell == NULL) if (shellpath == NULL)
shell = _PATH_BSHELL; shellpath = _PATH_BSHELL;
namep = strrchr(shell,'/'); namep = strrchr(shellpath, '/');
if (namep == NULL) if (namep == NULL)
namep = shell; namep = shellpath;
snprintf (shellnam, sizeof(shellnam), snprintf (shellnam, sizeof(shellnam),
"-%s", ++namep); "-%s", ++namep);
if (strcmp(namep, "sh") != 0) if (strcmp(namep, "sh") != 0)
shellnam[0] = '+'; shellnam[0] = '+';
if (debug) { if (debug) {
printf ("%s\n", shell); printf ("%s\n", shellpath);
fflush (stdout); fflush (stdout);
} }
if (argc > 1) { if (argc > 1) {
execl(shell,shellnam,"-c",altarg,(char *)0); execl(shellpath,shellnam,"-c",altarg,(char *)0);
} }
else { else {
execl(shell,shellnam,(char *)0); execl(shellpath,shellnam,(char *)0);
} }
warn("%s", shell); warn("%s", shellpath);
code = -1; code = -1;
exit(1); exit(1);
} }
if (pid > 0) if (pid > 0)
while (waitpid(-1, &status, 0) != pid) while (waitpid(-1, &waitstatus, 0) != pid)
; ;
signal(SIGINT, old1); signal(SIGINT, old1);
signal(SIGQUIT, old2); signal(SIGQUIT, old2);
@@ -1290,7 +1291,7 @@ shell(int argc, char **argv)
void void
user(int argc, char **argv) user(int argc, char **argv)
{ {
char acct[80]; char acctstr[80];
int n, aflag = 0; int n, aflag = 0;
char tmp[256]; char tmp[256];
@@ -1315,9 +1316,9 @@ user(int argc, char **argv)
if (n == CONTINUE) { if (n == CONTINUE) {
if (argc < 4) { if (argc < 4) {
printf("Account: "); fflush(stdout); printf("Account: "); fflush(stdout);
fgets(acct, sizeof(acct) - 1, stdin); fgets(acctstr, sizeof(acctstr) - 1, stdin);
acct[strlen(acct) - 1] = '\0'; acctstr[strcspn(acctstr, "\r\n")] = '\0';
argv[3] = acct; argc++; argv[3] = acctstr; argc++;
} }
n = command("ACCT %s", argv[3]); n = command("ACCT %s", argv[3]);
aflag++; aflag++;
@@ -1533,15 +1534,15 @@ disconnect(int argc, char **argv)
int int
confirm(char *cmd, char *file) confirm(char *cmd, char *file)
{ {
char line[BUFSIZ]; char buf[BUFSIZ];
if (!interactive) if (!interactive)
return (1); return (1);
printf("%s %s? ", cmd, file); printf("%s %s? ", cmd, file);
fflush(stdout); fflush(stdout);
if (fgets(line, sizeof line, stdin) == NULL) if (fgets(buf, sizeof buf, stdin) == NULL)
return (0); return (0);
return (*line == 'y' || *line == 'Y'); return (*buf == 'y' || *buf == 'Y');
} }
void void
@@ -1582,22 +1583,22 @@ globulize(char **cpp)
void void
account(int argc, char **argv) account(int argc, char **argv)
{ {
char acct[50]; char acctstr[50];
if (argc > 1) { if (argc > 1) {
++argv; ++argv;
--argc; --argc;
strlcpy (acct, *argv, sizeof(acct)); strlcpy (acctstr, *argv, sizeof(acctstr));
while (argc > 1) { while (argc > 1) {
--argc; --argc;
++argv; ++argv;
strlcat(acct, *argv, sizeof(acct)); strlcat(acctstr, *argv, sizeof(acctstr));
} }
} }
else { else {
UI_UTIL_read_pw_string(acct, sizeof(acct), "Account:", 0); UI_UTIL_read_pw_string(acctstr, sizeof(acctstr), "Account:", 0);
} }
command("ACCT %s", acct); command("ACCT %s", acctstr);
} }
jmp_buf abortprox; jmp_buf abortprox;