Recognize 'none' or '0' as no flags.

This commit is contained in:
Pawel Jakub Dawidek 2012-07-04 17:31:53 +00:00
parent 66f9aec075
commit 64b0683e23

View File

@ -350,10 +350,10 @@ str2flags(struct flag *tflags, char *sflags)
unsigned int i;
char *f;
for (f = strtok(sflags, ","); f != NULL; f = strtok(NULL, ",")) {
/* Support magic 'none' flag which just reset all flags. */
if (strcmp(f, "none") == 0)
return (0);
/* 'none' or '0' means no flags */
if (strcmp(sflags, "none") == 0 || strcmp(sflags, "0") == 0)
return (0);
for (f = strtok(sflags, ",|"); f != NULL; f = strtok(NULL, ",|")) {
for (i = 0; tflags[i].f_str != NULL; i++) {
if (strcmp(tflags[i].f_str, f) == 0)
break;