Completely reworked the path convertion functions
[mmh] / uip / scan.c
index 03a260b..1276d5b 100644 (file)
@@ -73,7 +73,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
@@ -143,8 +143,8 @@ main(int argc, char **argv)
                                case FILESW:
                                        if (!(cp = *argp++) || (cp[0] == '-' && cp[1]))
                                                adios(NULL, "missing argument to %s", argp[-2]);
-                                       if (strcmp(file = cp, "-"))
-                                               file = path(cp, TFILE);
+                                       if (strcmp(file = cp, "-")!=0)
+                                               file = getcpy(expanddir(cp));
                                        continue;
                        }
                }
@@ -152,14 +152,11 @@ main(int argc, char **argv)
                        if (folder)
                                adios(NULL, "only one folder at a time!");
                        else
-                               folder = pluspath(cp);
+                               folder = getcpy(expandfol(cp));
                } else
-                               app_msgarg(&msgs, cp);
+                       app_msgarg(&msgs, cp);
        }
 
-       if (!context_find("path"))
-               free(path("./", TFOLDER));
-
        /*
        ** Get new format string.  Must be before chdir().
        */
@@ -178,9 +175,8 @@ main(int argc, char **argv)
                if (strcmp(file, "-") == 0) {
                        in = stdin;
                        file = "stdin";
-               } else {
-                       if ((in = fopen(file, "r")) == NULL)
-                               adios(file, "unable to open");
+               } else if (!(in = fopen(file, "r"))) {
+                       adios(file, "unable to open");
                }
 
 #ifndef JLR
@@ -207,8 +203,8 @@ main(int argc, char **argv)
        if (!msgs.size)
                app_msgarg(&msgs, "all");
        if (!folder)
-               folder = getfolder(1);
-       maildir = m_maildir(folder);
+               folder = getcurfol();
+       maildir = toabsdir(folder);
 
        if (chdir(maildir) == NOTOK)
                adios(maildir, "unable to change directory to");