** Inspired by Luke Mewburn's new: http://www.mewburn.net/luke/src/new
*/
+#include <h/mh.h>
+#include <h/crawl_folders.h>
+#include <h/utils.h>
#include <sys/types.h>
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
-#include <h/mh.h>
-#include <h/crawl_folders.h>
-#include <h/utils.h>
+#include <unistd.h>
+#include <locale.h>
static struct swit switches[] = {
#define MODESW 0
char *sequences_s = NULL;
int argc = 0;
char *argv[MAXARGS];
- char *cp;
+ char **seqp;
char buf[BUFSIZ];
if (cur == NULL || cur[0] == '\0') {
argv[argc++] = "scan";
snprintf(buf, sizeof buf, "+%s", node->n_name);
argv[argc++] = buf;
- for (cp=*sequences; *cp; cp++) {
- argv[argc++] = cp;
+ for (seqp=sequences; *seqp; seqp++) {
+ argv[argc++] = *seqp;
}
argv[argc] = (char *)NULL;
execprog(*argv, argv);
switch (smatch(++cp, switches)) {
case AMBIGSW:
ambigsw(cp, switches);
- done(1);
+ exit(1);
case UNKWNSW:
adios(NULL, "-%s unknown", cp);
"%s [switches] [sequences]",
invo_name);
print_help(help, switches, 1);
- done(1);
+ exit(0);
case VERSIONSW:
print_version(invo_name);
- done(1);
+ exit(0);
case FOLDERSSW:
if (!(folders = *argp++) || *folders == '-')
folder = doit(context_find(curfolder), folders, sequences);
if (folder == NULL) {
- done(0);
+ exit(0);
return 1;
}
context_save();
- done(0);
- return 1;
+ return 0;
}