From 9e7d4c53d80b6ebb9598610ab706faf2218c8a7b Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 4 Sep 2022 10:54:34 +0100 Subject: [PATCH] Rename confusing variables in psftp_main(). Another of this weekend's warnings pointed out that this function contained a pattern I now regard as a cardinal sin: variables called 'ret' that aren't clear whether they've _been_ returned from a subroutine, or whether they're _planned_ to be returned from the containing function. Worse, psftp_main had both: two of the former kind shadowing a case of the latter in sub-scopes. --- psftp.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/psftp.c b/psftp.c index db57d89d..d8b5c400 100644 --- a/psftp.c +++ b/psftp.c @@ -2790,7 +2790,7 @@ const unsigned cmdline_tooltype = TOOLTYPE_FILETRANSFER; */ int psftp_main(int argc, char *argv[]) { - int i, ret; + int i, toret; int portnumber = 0; char *userhost, *user; int mode = 0; @@ -2807,7 +2807,7 @@ int psftp_main(int argc, char *argv[]) do_defaults(NULL, conf); for (i = 1; i < argc; i++) { - int ret; + int retd; if (argv[i][0] != '-') { if (userhost) usage(); @@ -2815,12 +2815,13 @@ int psftp_main(int argc, char *argv[]) userhost = dupstr(argv[i]); continue; } - ret = cmdline_process_param(argv[i], i+1