X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-tag.c;h=d15f1eda481fe0a6931afbb61de38289249642db;hp=7d186399ba786149d607ca2b45837836a43af802;hb=e0a223d15656a8a8fd6564687425a7e583f29b61;hpb=02cafc84b4540cd0fb878121dcb3551b4ecd9fd1 diff --git a/notmuch-tag.c b/notmuch-tag.c index 7d186399..d15f1eda 100644 --- a/notmuch-tag.c +++ b/notmuch-tag.c @@ -203,6 +203,17 @@ notmuch_tag_command (void *ctx, int argc, char *argv[]) break; } if (argv[i][0] == '+' || argv[i][0] == '-') { + if (argv[i][0] == '+' && argv[i][1] == '\0') { + fprintf(stderr, "Error: tag names cannot be empty.\n"); + return 1; + } + if (argv[i][0] == '+' && argv[i][1] == '-') { + /* This disallows adding the non-removable tag "-" and + * enables notmuch tag to take long options in the + * future. */ + fprintf(stderr, "Error: tag names must not start with '-'.\n"); + return 1; + } tag_ops[tag_ops_count].tag = argv[i] + 1; tag_ops[tag_ops_count].remove = (argv[i][0] == '-'); tag_ops_count++;