Added a tags file. I dunno if this is something that's really supposed to
be in a CVS repository, but for now, it is, so there. :)
This commit is contained in:
+14
-13
@@ -5,30 +5,31 @@
|
||||
#include "debug.h"
|
||||
#include "str.h"
|
||||
|
||||
int get_args(char **argv, char *str, int max_args)
|
||||
int
|
||||
get_args (char **argv, char *str, int max_args)
|
||||
{
|
||||
char *delimiters = " \n\0";
|
||||
char *item;
|
||||
int i=0;
|
||||
int i = 0;
|
||||
|
||||
if(!argv) return -1;
|
||||
if(!str) return 0;
|
||||
if(max_args < 1) return 0;
|
||||
if (!argv)
|
||||
return -1;
|
||||
if (!str)
|
||||
return 0;
|
||||
if (max_args < 1)
|
||||
return 0;
|
||||
|
||||
//debug("get_args(%i): string=%s\n", max_args, str);
|
||||
|
||||
|
||||
// Parse the command line...
|
||||
for(item = strtok(str, delimiters); item; item=strtok(NULL, delimiters))
|
||||
{
|
||||
for (item = strtok (str, delimiters); item; item = strtok (NULL, delimiters)) {
|
||||
//debug("get_args: item=%s\n", item);
|
||||
if(i < max_args)
|
||||
{
|
||||
if (i < max_args) {
|
||||
argv[i] = item;
|
||||
i++;
|
||||
}
|
||||
else return i;
|
||||
} else
|
||||
return i;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user