Move #include from h/mh.h to source files
[mmh] / uip / flist.c
index 2a002a5..c0a056c 100644 (file)
 
 #include <h/mh.h>
 #include <h/utils.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <sys/stat.h>
+#include <locale.h>
 
 /*
 ** We allocate space to record the names of folders
@@ -118,9 +123,7 @@ main(int argc, char **argv)
        char **arguments;
        char buf[BUFSIZ];
 
-#ifdef LOCALE
        setlocale(LC_ALL, "");
-#endif
        invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
@@ -151,17 +154,18 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               /* sysexits.h EX_USAGE */
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [+folder1 [+folder2 ...]][switches]", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case SEQSW:
                                if (!(cp = *argp++) || *cp == '-')
@@ -262,8 +266,7 @@ main(int argc, char **argv)
        qsort(folders, nFolders, sizeof(struct Folder),
                        (qsort_comp) CompareFolders);
        PrintFolders();
-       done(0);
-       return 1;
+       return 0;
 }
 
 /*