diff options
author | jkh <jkh@FreeBSD.org> | 1994-09-28 14:53:20 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1994-09-28 14:53:20 +0000 |
commit | ecee3a20ff01b3919059cc0362277de08546ef6f (patch) | |
tree | 9a9aa16f8a6915608786dee9d7fd63baee01ec4e /usr.bin/ncftp/main.c | |
parent | 0a36b6fcaa35545c0ca52c5a3c36e9880b82cdc2 (diff) | |
download | FreeBSD-src-ecee3a20ff01b3919059cc0362277de08546ef6f.zip FreeBSD-src-ecee3a20ff01b3919059cc0362277de08546ef6f.tar.gz |
Ye GODS! What I had to go through to make this thing exit with a non-zero
return status when a transfer failed! Hopefully, the next release will
do this more elegantly and make these changes short-lived.
Diffstat (limited to 'usr.bin/ncftp/main.c')
-rw-r--r-- | usr.bin/ncftp/main.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/ncftp/main.c b/usr.bin/ncftp/main.c index 446c1c3..e2f620a 100644 --- a/usr.bin/ncftp/main.c +++ b/usr.bin/ncftp/main.c @@ -390,7 +390,8 @@ For testing purposes only. Do not re-distribute or subject to novice users." (void) Signal(SIGPIPE, lostpeer); } for (;;) { - (void) cmdscanner(top); + if (cmdscanner(top)) + exit(1); top = 1; } } /* main */ @@ -569,9 +570,10 @@ void lostpeer SIG_PARAMS /* * Command parser. */ -void cmdscanner(int top) +int cmdscanner(int top) { register struct cmd *c; + int cmd_status, rcode = 0; if (!top) (void) putchar('\n'); @@ -601,13 +603,17 @@ void cmdscanner(int top) (void) printf ("Not connected.\n"); continue; } - if ((*c->c_handler)(margc, margv) == USAGE) + cmd_status = (*c->c_handler)(margc, margv); + if (cmd_status == USAGE) cmd_usage(c); + else if (cmd_status == CMDERR) + rcode = 1; if (c->c_handler != help) break; } (void) Signal(SIGINT, intr); (void) Signal(SIGPIPE, lostpeer); + return rcode; } /* cmdscanner */ |