X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fnew.c;h=a43a710fe6fc392d7ef6a6158add3356f96435a2;hb=e40f90484354303f9ff03878f3b15b3c72b215c2;hp=dab17adab4d63ab81e71b29d9d906b8b230e5bea;hpb=0dc43cbf916830e524ee705664bc9d1e1addaee2;p=mmh diff --git a/uip/new.c b/uip/new.c index dab17ad..a43a710 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 } }; @@ -311,7 +311,11 @@ doit(char *cur, char *folders, char *sequences[]) struct node *first, *cur_node, *node, *last = NULL, *prev; size_t folder_len; int count, total = 0; - char *command = NULL, *sequences_s = NULL; + char *sequences_s = NULL; + int argc = 0; + char *argv[MAXARGS]; + char *cp; + char buf[BUFSIZ]; if (cur == NULL || cur[0] == '\0') { cur = "inbox"; @@ -383,14 +387,15 @@ doit(char *cur, char *folders, char *sequences[]) } fflush(stdout); - /* - ** TODO: Split enough of scan.c out so that we can - ** call it here. - */ - command = concat("scan +", node->n_name, " ", - sequences_s, (void *)NULL); - system(command); - free(command); + argc = 0; + argv[argc++] = "scan"; + snprintf(buf, sizeof buf, "+%s", node->n_name); + argv[argc++] = buf; + for (cp=*sequences; *cp; cp++) { + argv[argc++] = cp; + } + argv[argc] = (char *)NULL; + execprog(*argv, argv); } else { if (node->n_field == NULL) { continue; @@ -435,9 +440,7 @@ main(int argc, char **argv) sequences[0] = NULL; sequences[1] = NULL; -#ifdef LOCALE setlocale(LC_ALL, ""); -#endif invo_name = mhbasename(argv[0]); /* read user profile/context */