X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/d3a1a808f65812c591ef0de3e61a94b13aa73160..6f1e7b78af0f9c4c502609392f62771cf2528d8f:/winutils.c diff --git a/winutils.c b/winutils.c index 9d707ff1..00d35dfb 100644 --- a/winutils.c +++ b/winutils.c @@ -11,6 +11,8 @@ #ifdef TESTMODE /* Definitions to allow this module to be compiled standalone for testing. */ #define smalloc malloc +#define srealloc realloc +#define sfree free #endif /* @@ -131,6 +133,18 @@ void split_into_argv(char *cmdline, int *argc, char ***argv, */ /* + * First deal with the simplest of all special cases: if there + * aren't any arguments, return 0,NULL,NULL. + */ + while (*cmdline && isspace(*cmdline)) cmdline++; + if (!*cmdline) { + if (argc) *argc = 0; + if (argv) *argv = NULL; + if (argstart) *argstart = NULL; + return; + } + + /* * This will guaranteeably be big enough; we can realloc it * down later. */ @@ -446,4 +460,4 @@ int main(int argc, char **argv) return 0; } -#endif \ No newline at end of file +#endif