/IRCNET command.

PARAM_FLAG_NOQUOTES flag for cmd_get_params()


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@290 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-06-04 14:52:47 +00:00 committed by cras
commit a7f5540cba
15 changed files with 173 additions and 68 deletions

View file

@ -352,13 +352,17 @@ char *cmd_get_params(const char *data, int count, ...)
va_start(args, count);
/* get the length of the arguments in string */
old = datad = g_strdup(data);
if (count & PARAM_FLAG_MULTIARGS)
get_multi_args(&datad, TRUE, args);
else if (count & PARAM_FLAG_OPTARGS)
get_opt_args(&datad);
len = (int) (datad-old);
g_free(old);
if ((count & (PARAM_FLAG_MULTIARGS|PARAM_FLAG_OPTARGS)) == 0)
len = 0;
else {
old = datad = g_strdup(data);
if (count & PARAM_FLAG_MULTIARGS)
get_multi_args(&datad, TRUE, args);
else
get_opt_args(&datad);
len = (int) (datad-old);
g_free(old);
}
/* send the text to custom functions to handle - skip arguments */
old = datad = cmd_get_callfuncs(data+len, &count, &args);
@ -392,7 +396,9 @@ char *cmd_get_params(const char *data, int count, ...)
/* get rest */
arg = datad;
} else {
arg = cmd_get_quoted_param(&datad);
arg = (count & PARAM_FLAG_NOQUOTES) ?
cmd_get_param(&datad) :
cmd_get_quoted_param(&datad);
}
str = (char **) va_arg(args, char **);

View file

@ -36,7 +36,9 @@ void command_runsub(const char *cmd, const char *data, void *p1, void *p2);
/* count can have these flags: */
#define PARAM_WITHOUT_FLAGS(a) ((a) & 0x00ffffff)
/* cmd_get_params() */
/* don't check for quotes - "arg1 arg2" is NOT treated as one argument */
#define PARAM_FLAG_NOQUOTES 0x01000000
/* final argument gets all the rest of the arguments */
#define PARAM_FLAG_GETREST 0x02000000
/* optional arguments (-cmd -cmd2 -cmd3) */
#define PARAM_FLAG_OPTARGS 0x04000000