From ab784567291b1925d616ea9b9d2577f42d2699a5 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 5 Jun 2011 14:08:26 +0000 Subject: More FTP bug fixes git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3669 42af7a65-404d-4744-a932-0658087f49c3 --- apps/nshlib/nsh_netcmds.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'apps/nshlib/nsh_netcmds.c') diff --git a/apps/nshlib/nsh_netcmds.c b/apps/nshlib/nsh_netcmds.c index 6e210c020..8285da295 100644 --- a/apps/nshlib/nsh_netcmds.c +++ b/apps/nshlib/nsh_netcmds.c @@ -331,20 +331,28 @@ int tftpc_parseargs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv, return ERROR; } - /* There should be exactly on parameter left on the command-line */ + /* There should be exactly one parameter left on the command-line */ if (optind == argc-1) { args->srcpath = argv[optind]; } + + /* optind == argc means that there is nothing left on the command-line */ + else if (optind >= argc) { - fmt = g_fmttoomanyargs; + fmt = g_fmtargrequired; goto errout; } + + /* optind < argc-1 means that there are too many arguments on the + * command-line + */ + else { - fmt = g_fmtargrequired; + fmt = g_fmttoomanyargs; goto errout; } -- cgit v1.2.3