]>
diplodocus.org Git - nmh/blob - sbr/getarguments.c
3 * getarguments.c -- Get the argument vector ready to go.
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
14 getarguments (char *invo_name
, int argc
, char **argv
, int check_context
)
16 char *cp
= NULL
, **ap
= NULL
, **bp
= NULL
, **arguments
= NULL
;
20 * Check if profile/context specifies any arguments
22 if (check_context
&& (cp
= context_find (invo_name
))) {
23 cp
= getcpy (cp
); /* make copy */
24 ap
= brkstring (cp
, " ", "\n"); /* split string */
26 /* Count number of arguments split */
32 arguments
= (char **) mh_xmalloc ((argc
+ n
) * sizeof(*arguments
));
35 /* Copy any arguments from profile/context */
36 if (ap
!= NULL
&& n
> 0) {
41 /* Copy arguments from command line */
46 /* Now NULL terminate the array */