X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fnew.c;h=a79845c000b83a574c54e4c30709f5bc9adb7757;hb=10e03b3fba3e01052baf92c963c46a2a5529b4e0;hp=7a5a06b6a5e83592285e85ef5bd992a6a30a574d;hpb=5b792c4424571f05bc2008e3109797d18d7d00d1;p=mmh diff --git a/uip/new.c b/uip/new.c index 7a5a06b..a79845c 100644 --- a/uip/new.c +++ b/uip/new.c @@ -22,13 +22,13 @@ static struct swit switches[] = { #define MODESW 0 - { "mode", 1 }, + { "mode", 0 }, #define FOLDERSSW 1 - { "folders", 1 }, + { "folders", 0 }, #define VERSIONSW 2 - { "version", 1 }, + { "Version", 0 }, #define HELPSW 3 - { "help", 1 }, + { "help", 0 }, { NULL, 0 } }; @@ -308,7 +308,7 @@ join_sequences(char *sequences[]) static struct node * doit(char *cur, char *folders, char *sequences[]) { - struct node *first, *cur_node, *node, *last, *prev; + struct node *first, *cur_node, *node, *last = NULL, *prev; size_t folder_len; int count, total = 0; char *command = NULL, *sequences_s = NULL; @@ -432,9 +432,10 @@ main(int argc, char **argv) char *unseen; struct node *folder; -#ifdef LOCALE + sequences[0] = NULL; + sequences[1] = NULL; + setlocale(LC_ALL, ""); -#endif invo_name = mhbasename(argv[0]); /* read user profile/context */ @@ -481,6 +482,7 @@ main(int argc, char **argv) /* have a sequence argument */ if (!seq_in_list(cp, sequences)) { sequences[i++] = cp; + sequences[i] = NULL; } } @@ -501,12 +503,17 @@ main(int argc, char **argv) } if (i == 0) { + char *dp; /* no sequence arguments; use unseen */ - unseen = context_find(usequence); - if (unseen == NULL || unseen[0] == '\0') { - adios(NULL, "must specify sequences or set %s", usequence); + if ((unseen = context_find(usequence))) { + if (!*unseen) { + adios(NULL, "profile entry %s set, but empty, and no sequences given", usequence); + } + } else { + unseen = seq_unseen; /* use default */ } - for (ap = brkstring(unseen, " ", "\n"); *ap; ap++) { + dp = getcpy(unseen); + for (ap = brkstring(dp, " ", "\n"); *ap; ap++) { sequences[i++] = *ap; } }