X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fgetarguments.c;h=d133e0680d152df88ddf2c983cce44e4b4c123be;hp=0f8834b7bdacd0c9d2b3fd1117f8c02b25d2ab56;hb=a485ed478abbd599d8c9aab48934e7a26733ecb1;hpb=f480c03187724e54e5391ee61b810827da319a6c diff --git a/sbr/getarguments.c b/sbr/getarguments.c index 0f8834b..d133e06 100644 --- a/sbr/getarguments.c +++ b/sbr/getarguments.c @@ -1,4 +1,3 @@ - /* * getarguments.c -- Get the argument vector ready to go. * @@ -13,38 +12,38 @@ char ** getarguments (char *invo_name, int argc, char **argv, int check_context) { - char *cp = NULL, **ap = NULL, **bp = NULL, **arguments = NULL; - int n = 0; - - /* - * Check if profile/context specifies any arguments - */ - if (check_context && (cp = context_find (invo_name))) { - cp = getcpy (cp); /* make copy */ - ap = brkstring (cp, " ", "\n"); /* split string */ - - /* Count number of arguments split */ - bp = ap; - while (*bp++) - n++; - } - - arguments = (char **) mh_xmalloc ((argc + n) * sizeof(*arguments)); - bp = arguments; - - /* Copy any arguments from profile/context */ - if (ap != NULL && n > 0) { - while (*ap) - *bp++ = *ap++; - } - - /* Copy arguments from command line */ - argv++; - while (*argv) - *bp++ = *argv++; - - /* Now NULL terminate the array */ - *bp = NULL; - - return arguments; + char *cp = NULL, **ap = NULL, **bp = NULL, **arguments = NULL; + int n = 0; + + /* + * Check if profile/context specifies any arguments + */ + if (check_context && (cp = context_find (invo_name))) { + cp = getcpy (cp); /* make copy */ + ap = brkstring (cp, " ", "\n"); /* split string */ + + /* Count number of arguments split */ + bp = ap; + while (*bp++) + n++; + } + + arguments = (char **) mh_xmalloc ((argc + n) * sizeof(*arguments)); + bp = arguments; + + /* Copy any arguments from profile/context */ + if (ap != NULL && n > 0) { + while (*ap) + *bp++ = *ap++; + } + + /* Copy arguments from command line */ + argv++; + while (*argv) + *bp++ = *argv++; + + /* Now NULL terminate the array */ + *bp = NULL; + + return arguments; }