diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-05-16 23:43:17 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-05-16 23:43:17 +0000 |
commit | f4dfdccff84af7995e86eea1e1bf46ec71b40e31 (patch) | |
tree | d60105d5e19a0928dcb88be3892985c5901c1400 /usr.bin/ftp | |
parent | d4ddb0f8b9056c225122f6e03d9d974fda3eb45d (diff) |
Remove shadowing variables and properly use /* FALLTHROUGH */
comments. No binary change.
Found by lint.
OK beck@, deraadt@
Diffstat (limited to 'usr.bin/ftp')
-rw-r--r-- | usr.bin/ftp/cmds.c | 41 | ||||
-rw-r--r-- | usr.bin/ftp/domacro.c | 6 | ||||
-rw-r--r-- | usr.bin/ftp/fetch.c | 100 | ||||
-rw-r--r-- | usr.bin/ftp/ftp.c | 16 | ||||
-rw-r--r-- | usr.bin/ftp/ruserpass.c | 6 | ||||
-rw-r--r-- | usr.bin/ftp/util.c | 32 |
6 files changed, 101 insertions, 100 deletions
diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c index 49a62bea422..e41ec4f322e 100644 --- a/usr.bin/ftp/cmds.c +++ b/usr.bin/ftp/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.50 2006/04/25 05:45:20 tedu Exp $ */ +/* $OpenBSD: cmds.c,v 1.51 2006/05/16 23:43:16 ray Exp $ */ /* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */ /* @@ -60,7 +60,7 @@ */ #if !defined(lint) && !defined(SMALL) -static const char rcsid[] = "$OpenBSD: cmds.c,v 1.50 2006/04/25 05:45:20 tedu Exp $"; +static const char rcsid[] = "$OpenBSD: cmds.c,v 1.51 2006/05/16 23:43:16 ray Exp $"; #endif /* not lint and not SMALL */ /* @@ -1149,7 +1149,7 @@ mls(int argc, char *argv[]) { sig_t oldintr; int ointer, i; - char mode[1], *dest, *odest; + char lmode[1], *dest, *odest; if (argc < 2 && !another(&argc, &argv, "remote-files")) goto usage; @@ -1172,8 +1172,8 @@ usage: oldintr = signal(SIGINT, mabort); (void)setjmp(jabort); for (i = 1; mflag && i < argc-1; ++i) { - *mode = (i == 1) ? 'w' : 'a'; - recvrequest("LIST", dest, argv[i], mode, 0, 0); + *lmode = (i == 1) ? 'w' : 'a'; + recvrequest("LIST", dest, argv[i], lmode, 0, 0); if (!mflag && fromatty) { ointer = interactive; interactive = 1; @@ -1198,7 +1198,7 @@ shell(int argc, char *argv[]) { pid_t pid; sig_t old1, old2; - char shellnam[MAXPATHLEN], *shell, *namep; + char shellnam[MAXPATHLEN], *shellp, *namep; int wait_status; old1 = signal (SIGINT, SIG_IGN); @@ -1208,28 +1208,28 @@ shell(int argc, char *argv[]) (void)close(pid); (void)signal(SIGINT, SIG_DFL); (void)signal(SIGQUIT, SIG_DFL); - shell = getenv("SHELL"); - if (shell == NULL || *shell == '\0') - shell = _PATH_BSHELL; - namep = strrchr(shell, '/'); + shellp = getenv("SHELL"); + if (shellp == NULL || *shellp == '\0') + shellp = _PATH_BSHELL; + namep = strrchr(shellp, '/'); if (namep == NULL) - namep = shell; + namep = shellp; shellnam[0] = '-'; (void)strlcpy(shellnam + 1, ++namep, sizeof(shellnam) - 1); if (strcmp(namep, "sh") != 0) shellnam[0] = '+'; if (debug) { - fputs(shell, ttyout); + fputs(shellp, ttyout); fputc('\n', ttyout); (void)fflush(ttyout); } if (argc > 1) { - execl(shell, shellnam, "-c", altarg, (char *)0); + execl(shellp, shellnam, "-c", altarg, (char *)0); } else { - execl(shell, shellnam, (char *)0); + execl(shellp, shellnam, (char *)0); } - warn("%s", shell); + warn("%s", shellp); code = -1; exit(1); } @@ -1253,7 +1253,7 @@ shell(int argc, char *argv[]) void user(int argc, char *argv[]) { - char acct[80]; + char acctname[80]; int n, aflag = 0; if (argc < 2) @@ -1273,9 +1273,10 @@ user(int argc, char *argv[]) if (argc < 4) { (void)fputs("Account: ", ttyout); (void)fflush(ttyout); - (void)fgets(acct, sizeof(acct) - 1, stdin); - acct[strlen(acct) - 1] = '\0'; - argv[3] = acct; argc++; + (void)fgets(acctname, sizeof(acctname) - 1, stdin); + acctname[strlen(acctname) - 1] = '\0'; + argv[3] = acctname; + argc++; } n = command("ACCT %s", argv[3]); aflag++; @@ -1875,7 +1876,7 @@ LOOP: } break; } - /* intentional drop through */ + /* FALLTHROUGH */ default: *cp1++ = *cp2; break; diff --git a/usr.bin/ftp/domacro.c b/usr.bin/ftp/domacro.c index 669b9f1b3fc..b2dbf192a58 100644 --- a/usr.bin/ftp/domacro.c +++ b/usr.bin/ftp/domacro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: domacro.c,v 1.12 2006/04/25 05:45:20 tedu Exp $ */ +/* $OpenBSD: domacro.c,v 1.13 2006/05/16 23:43:16 ray Exp $ */ /* $NetBSD: domacro.c,v 1.10 1997/07/20 09:45:45 lukem Exp $ */ /* @@ -31,7 +31,7 @@ */ #if !defined(lint) && !defined(SMALL) -static const char rcsid[] = "$OpenBSD: domacro.c,v 1.12 2006/04/25 05:45:20 tedu Exp $"; +static const char rcsid[] = "$OpenBSD: domacro.c,v 1.13 2006/05/16 23:43:16 ray Exp $"; #endif /* not lint and not SMALL */ #include <ctype.h> @@ -100,7 +100,7 @@ TOP: } break; } - /* intentional drop through */ + /* FALLTHROUGH */ default: *cp2++ = *cp1; break; diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c index a628822aa93..c9b806e9f3e 100644 --- a/usr.bin/ftp/fetch.c +++ b/usr.bin/ftp/fetch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fetch.c,v 1.61 2006/05/16 16:20:42 deraadt Exp $ */ +/* $OpenBSD: fetch.c,v 1.62 2006/05/16 23:43:16 ray Exp $ */ /* $NetBSD: fetch.c,v 1.14 1997/08/18 10:20:20 lukem Exp $ */ /*- @@ -38,7 +38,7 @@ */ #if !defined(lint) && !defined(SMALL) -static const char rcsid[] = "$OpenBSD: fetch.c,v 1.61 2006/05/16 16:20:42 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: fetch.c,v 1.62 2006/05/16 23:43:16 ray Exp $"; #endif /* not lint and not SMALL */ /* @@ -119,11 +119,11 @@ static int url_get(const char *origline, const char *proxyenv, const char *outfile) { char pbuf[NI_MAXSERV], hbuf[NI_MAXHOST], *cp, *portnum, *path; - char *hosttail, *cause = "unknown", *line, *host, *port, *buf = NULL; + char *hosttail, *cause = "unknown", *newline, *host, *port, *buf = NULL; int error, i, isftpurl = 0, isfileurl = 0, isredirect = 0, rval = -1; struct addrinfo hints, *res0, *res; const char * volatile savefile; - char * volatile proxy = NULL; + char * volatile proxyurl = NULL; volatile int s = -1, out; volatile sig_t oldintr; FILE *fin = NULL; @@ -137,24 +137,24 @@ url_get(const char *origline, const char *proxyenv, const char *outfile) #endif SSL *ssl = NULL; - line = strdup(origline); - if (line == NULL) + newline = strdup(origline); + if (newline == NULL) errx(1, "Can't allocate memory to parse URL"); - if (strncasecmp(line, HTTP_URL, sizeof(HTTP_URL) - 1) == 0) - host = line + sizeof(HTTP_URL) - 1; - else if (strncasecmp(line, FTP_URL, sizeof(FTP_URL) - 1) == 0) { - host = line + sizeof(FTP_URL) - 1; + if (strncasecmp(newline, HTTP_URL, sizeof(HTTP_URL) - 1) == 0) + host = newline + sizeof(HTTP_URL) - 1; + else if (strncasecmp(newline, FTP_URL, sizeof(FTP_URL) - 1) == 0) { + host = newline + sizeof(FTP_URL) - 1; isftpurl = 1; - } else if (strncasecmp(line, FILE_URL, sizeof(FILE_URL) - 1) == 0) { - host = line + sizeof(FILE_URL) - 1; + } else if (strncasecmp(newline, FILE_URL, sizeof(FILE_URL) - 1) == 0) { + host = newline + sizeof(FILE_URL) - 1; isfileurl = 1; #ifndef SMALL - } else if (strncasecmp(line, HTTPS_URL, sizeof(HTTPS_URL) - 1) == 0) { - host = line + sizeof(HTTPS_URL) - 1; + } else if (strncasecmp(newline, HTTPS_URL, sizeof(HTTPS_URL) - 1) == 0) { + host = newline + sizeof(HTTPS_URL) - 1; ishttpsurl = 1; #endif } else - errx(1, "url_get: Invalid URL '%s'", line); + errx(1, "url_get: Invalid URL '%s'", newline); if (isfileurl) { path = host; @@ -196,13 +196,13 @@ url_get(const char *origline, const char *proxyenv, const char *outfile) errx(1, "Can't allocate memory for https path/host."); } #endif - proxy = strdup(proxyenv); - if (proxy == NULL) + proxyurl = strdup(proxyenv); + if (proxyurl == NULL) errx(1, "Can't allocate memory for proxy URL."); - if (strncasecmp(proxy, HTTP_URL, sizeof(HTTP_URL) - 1) == 0) - host = proxy + sizeof(HTTP_URL) - 1; - else if (strncasecmp(proxy, FTP_URL, sizeof(FTP_URL) - 1) == 0) - host = proxy + sizeof(FTP_URL) - 1; + if (strncasecmp(proxyurl, HTTP_URL, sizeof(HTTP_URL) - 1) == 0) + host = proxyurl + sizeof(HTTP_URL) - 1; + else if (strncasecmp(proxyurl, FTP_URL, sizeof(FTP_URL) - 1) == 0) + host = proxyurl + sizeof(FTP_URL) - 1; else { warnx("Malformed proxy URL: %s", proxyenv); goto cleanup_url_get; @@ -215,7 +215,7 @@ url_get(const char *origline, const char *proxyenv, const char *outfile) path = strchr(host, '/'); /* remove trailing / on host */ if (!EMPTYSTRING(path)) *path++ = '\0'; - path = line; + path = newline; } if (isfileurl) { @@ -391,7 +391,7 @@ again: if (ishttpsurl) { if (proxyenv && sslpath) { ishttpsurl = 0; - proxy = NULL; + proxyurl = NULL; path = sslpath; } SSL_library_init(); @@ -423,7 +423,7 @@ again: /* * Construct and send the request. Proxy requests don't want leading /. */ - if (proxy) { + if (proxyurl) { if (verbose) fprintf(ttyout, " (via %s)\n", proxyenv); /* @@ -503,7 +503,7 @@ again: free(buf); filesize = -1; - while (1) { + for (;;) { if ((buf = ftp_readline(fin, ssl, &len)) == NULL) { warn("Receiving HTTP reply"); goto cleanup_url_get; @@ -534,9 +534,9 @@ again: fclose(fin); else if (s != -1) close(s); - if (proxy) - free(proxy); - free(line); + if (proxyurl) + free(proxyurl); + free(newline); rval = url_get(cp, proxyenv, outfile); if (buf) free(buf); @@ -638,9 +638,9 @@ cleanup_url_get: close(s); if (buf) free(buf); - if (proxy) - free(proxy); - free(line); + if (proxyurl) + free(proxyurl); + free(newline); return (rval); } @@ -690,8 +690,8 @@ int auto_fetch(int argc, char *argv[], char *outfile) { char *xargv[5]; - char *cp, *line, *host, *dir, *file, *portnum; - char *user, *pass, *pathstart; + char *cp, *url, *host, *dir, *file, *portnum; + char *username, *pass, *pathstart; char *ftpproxy, *httpproxy; int rval, xargc; volatile int argpos; @@ -716,29 +716,29 @@ auto_fetch(int argc, char *argv[], char *outfile) /* * Loop through as long as there's files to fetch. */ - for (rval = 0; (rval == 0) && (argpos < argc); free(line), argpos++) { + for (rval = 0; (rval == 0) && (argpos < argc); free(url), argpos++) { if (strchr(argv[argpos], ':') == NULL) break; - host = dir = file = portnum = user = pass = NULL; + host = dir = file = portnum = username = pass = NULL; /* * We muck with the string, so we make a copy. */ - line = strdup(argv[argpos]); - if (line == NULL) + url = strdup(argv[argpos]); + if (url == NULL) errx(1, "Can't allocate memory for auto-fetch."); /* * Try HTTP URL-style arguments first. */ - if (strncasecmp(line, HTTP_URL, sizeof(HTTP_URL) - 1) == 0 || + if (strncasecmp(url, HTTP_URL, sizeof(HTTP_URL) - 1) == 0 || #ifndef SMALL /* even if we compiled without SSL, url_get will check */ - strncasecmp(line, HTTPS_URL, sizeof(HTTPS_URL) -1) == 0 || + strncasecmp(url, HTTPS_URL, sizeof(HTTPS_URL) -1) == 0 || #endif - strncasecmp(line, FILE_URL, sizeof(FILE_URL) - 1) == 0) { + strncasecmp(url, FILE_URL, sizeof(FILE_URL) - 1) == 0) { redirect_loop = 0; - if (url_get(line, httpproxy, outfile) == -1) + if (url_get(url, httpproxy, outfile) == -1) rval = argpos + 1; continue; } @@ -748,12 +748,12 @@ auto_fetch(int argc, char *argv[], char *outfile) * set, use url_get() instead of standard ftp. * Finally, try host:file. */ - host = line; - if (strncasecmp(line, FTP_URL, sizeof(FTP_URL) - 1) == 0) { + host = url; + if (strncasecmp(url, FTP_URL, sizeof(FTP_URL) - 1) == 0) { char *passend, *passagain, *userend; if (ftpproxy) { - if (url_get(line, ftpproxy, outfile) == -1) + if (url_get(url, ftpproxy, outfile) == -1) rval = argpos + 1; continue; } @@ -767,7 +767,7 @@ auto_fetch(int argc, char *argv[], char *outfile) passend = strchr(host, '@'); if (passend && userend && userend < passend && (!dir || passend < dir)) { - user = host; + username = host; pass = userend + 1; host = passend + 1; *userend = *passend = '\0'; @@ -778,13 +778,13 @@ auto_fetch(int argc, char *argv[], char *outfile) goto bad_ftp_url; } - if (EMPTYSTRING(user) || EMPTYSTRING(pass)) { + if (EMPTYSTRING(username) || EMPTYSTRING(pass)) { bad_ftp_url: warnx("Invalid URL: %s", argv[argpos]); rval = argpos + 1; continue; } - user = urldecode(user); + username = urldecode(username); pass = urldecode(pass); } @@ -864,7 +864,7 @@ bad_ftp_url: if (debug) fprintf(ttyout, "user %s:%s host %s port %s dir %s file %s\n", - user, pass, host, portnum, dir, file); + username, pass, host, portnum, dir, file); /* * Set up the connection. @@ -881,12 +881,12 @@ bad_ftp_url: xargc = 3; } oautologin = autologin; - if (user != NULL) + if (username != NULL) autologin = 0; setpeer(xargc, xargv); autologin = oautologin; if ((connected == 0) || - ((connected == 1) && !ftp_login(host, user, pass))) { + ((connected == 1) && !ftp_login(host, username, pass))) { warnx("Can't connect or login to host `%s'", host); rval = argpos + 1; continue; diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c index 55b96df447b..da02f9d09ea 100644 --- a/usr.bin/ftp/ftp.c +++ b/usr.bin/ftp/ftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftp.c,v 1.63 2006/05/16 16:20:42 deraadt Exp $ */ +/* $OpenBSD: ftp.c,v 1.64 2006/05/16 23:43:16 ray Exp $ */ /* $NetBSD: ftp.c,v 1.27 1997/08/18 10:20:23 lukem Exp $ */ /* @@ -60,7 +60,7 @@ */ #if !defined(lint) && !defined(SMALL) -static const char rcsid[] = "$OpenBSD: ftp.c,v 1.63 2006/05/16 16:20:42 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: ftp.c,v 1.64 2006/05/16 23:43:16 ray Exp $"; #endif /* not lint and not SMALL */ #include <sys/types.h> @@ -331,7 +331,7 @@ int getreply(int expecteof) { char current_line[BUFSIZ]; /* last line of previous reply */ - int c, n, line; + int c, n, lineno; int dig; int originalcode = 0, continuation = 0; sig_t oldintr; @@ -340,7 +340,7 @@ getreply(int expecteof) memset(current_line, 0, sizeof(current_line)); oldintr = signal(SIGINT, cmdabort); - for (line = 0 ;; line++) { + for (lineno = 0 ;; lineno++) { dig = n = code = 0; cp = current_line; while ((c = fgetc(cin)) != '\n') { @@ -422,7 +422,7 @@ getreply(int expecteof) (void)putc(c, ttyout); (void)fflush (ttyout); } - if (line == 0) { + if (lineno == 0) { size_t len = cp - current_line; if (len > sizeof(reply_string)) @@ -1433,7 +1433,7 @@ noport: if (sendport) { char hname[NI_MAXHOST], pbuf[NI_MAXSERV]; - int af; + int af_tmp; union sockunion tmp; tmp = data_addr; @@ -1447,14 +1447,14 @@ noport: case AF_INET6: if (tmp.su_family == AF_INET6) tmp.su_sin6.sin6_scope_id = 0; - af = (tmp.su_family == AF_INET) ? 1 : 2; + af_tmp = (tmp.su_family == AF_INET) ? 1 : 2; if (getnameinfo((struct sockaddr *)&tmp, tmp.su_len, hname, sizeof(hname), pbuf, sizeof(pbuf), NI_NUMERICHOST | NI_NUMERICSERV)) { result = ERROR; } else { result = command("EPRT |%d|%s|%s|", - af, hname, pbuf); + af_tmp, hname, pbuf); if (result != COMPLETE) { epsv4bad = 1; if (debug) { diff --git a/usr.bin/ftp/ruserpass.c b/usr.bin/ftp/ruserpass.c index 511f65d9973..8e28a0dcaf5 100644 --- a/usr.bin/ftp/ruserpass.c +++ b/usr.bin/ftp/ruserpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ruserpass.c,v 1.19 2006/04/25 05:45:20 tedu Exp $ */ +/* $OpenBSD: ruserpass.c,v 1.20 2006/05/16 23:43:16 ray Exp $ */ /* $NetBSD: ruserpass.c,v 1.14 1997/07/20 09:46:01 lukem Exp $ */ /* @@ -35,7 +35,7 @@ static char sccsid[] = "@(#)ruserpass.c 8.4 (Berkeley) 4/27/95"; #else #ifndef SMALL -static const char rcsid[] = "$OpenBSD: ruserpass.c,v 1.19 2006/04/25 05:45:20 tedu Exp $"; +static const char rcsid[] = "$OpenBSD: ruserpass.c,v 1.20 2006/05/16 23:43:16 ray Exp $"; #endif /* SMALL */ #endif #endif /* not lint */ @@ -112,7 +112,7 @@ next: case DEFAULT: usedefault = 1; - /* FALL THROUGH */ + /* FALLTHROUGH */ case MACH: if (!usedefault) { diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c index cb37ac7ddcc..12d1be4f7f6 100644 --- a/usr.bin/ftp/util.c +++ b/usr.bin/ftp/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.42 2006/04/25 05:45:20 tedu Exp $ */ +/* $OpenBSD: util.c,v 1.43 2006/05/16 23:43:16 ray Exp $ */ /* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */ /*- @@ -71,7 +71,7 @@ */ #if !defined(lint) && !defined(SMALL) -static const char rcsid[] = "$OpenBSD: util.c,v 1.42 2006/04/25 05:45:20 tedu Exp $"; +static const char rcsid[] = "$OpenBSD: util.c,v 1.43 2006/05/16 23:43:16 ray Exp $"; #endif /* not lint and not SMALL */ /* @@ -248,13 +248,13 @@ setpeer(int argc, char *argv[]) int ftp_login(const char *host, char *user, char *pass) { - char tmp[80], *acct = NULL, hostname[MAXHOSTNAMELEN]; + char tmp[80], *acctname = NULL, host_name[MAXHOSTNAMELEN]; char anonpass[MAXLOGNAME + 1 + MAXHOSTNAMELEN]; /* "user@hostname" */ int n, aflag = 0, retry = 0; struct passwd *pw; if (user == NULL) { - if (ruserpass(host, &user, &pass, &acct) < 0) { + if (ruserpass(host, &user, &pass, &acctname) < 0) { code = -1; return (0); } @@ -265,7 +265,7 @@ ftp_login(const char *host, char *user, char *pass) */ if ((user == NULL || pass == NULL) && anonftp) { memset(anonpass, 0, sizeof(anonpass)); - memset(hostname, 0, sizeof(hostname)); + memset(host_name, 0, sizeof(host_name)); /* * Set up anonymous login password. @@ -276,7 +276,7 @@ ftp_login(const char *host, char *user, char *pass) else user = pw->pw_name; } - gethostname(hostname, sizeof(hostname)); + gethostname(host_name, sizeof(host_name)); #ifndef DONT_CHEAT_ANONPASS /* * Every anonymous FTP server I've encountered @@ -324,12 +324,12 @@ tryagain: } if (n == CONTINUE) { aflag++; - if (acct == NULL) - acct = getpass("Account:"); - n = command("ACCT %s", acct); + if (acctname == NULL) + acctname = getpass("Account:"); + n = command("ACCT %s", acctname); } if ((n != COMPLETE) || - (!aflag && acct != NULL && command("ACCT %s", acct) != COMPLETE)) { + (!aflag && acctname != NULL && command("ACCT %s", acctname) != COMPLETE)) { warnx("Login failed."); if (retry || !anonftp) return (0); @@ -388,7 +388,7 @@ another(int *pargc, char ***pargv, const char *prompt) char * remglob(char *argv[], int doswitch, char **errbuf) { - char temp[MAXPATHLEN], *cp, *mode; + char temp[MAXPATHLEN], *cp, *lmode; static char buf[MAXPATHLEN], **args; static FILE *ftemp = NULL; int oldverbose, oldhash, fd; @@ -438,8 +438,8 @@ remglob(char *argv[], int doswitch, char **errbuf) hash = 0; if (doswitch) pswitch(!proxy); - for (mode = "w"; *++argv != NULL; mode = "a") - recvrequest("NLST", temp, *argv, mode, 0, 0); + for (lmode = "w"; *++argv != NULL; lmode = "a") + recvrequest("NLST", temp, *argv, lmode, 0, 0); if ((code / 100) != COMPLETE) { if (errbuf != NULL) *errbuf = reply_string; @@ -473,16 +473,16 @@ remglob(char *argv[], int doswitch, char **errbuf) int confirm(const char *cmd, const char *file) { - char line[BUFSIZ]; + char str[BUFSIZ]; if (!interactive || confirmrest) return (1); top: fprintf(ttyout, "%s %s? ", cmd, file); (void)fflush(ttyout); - if (fgets(line, sizeof(line), stdin) == NULL) + if (fgets(str, sizeof(str), stdin) == NULL) return (0); - switch (tolower(*line)) { + switch (tolower(*str)) { case 'n': return (0); case 'p': |