changed file() to call setfile() with proper arg for isedit;
[unix-history] / usr / src / usr.bin / mail / fio.c
index 75127e8..0f6e602 100644 (file)
@@ -10,7 +10,7 @@
  * File I/O.
  */
 
  * File I/O.
  */
 
-static char *SccsId = "@(#)fio.c       2.5 %G%";
+static char *SccsId = "@(#)fio.c       2.7 %G%";
 
 /*
  * Set up the input pointers while copying the mail file into
 
 /*
  * Set up the input pointers while copying the mail file into
@@ -496,8 +496,8 @@ expand(name)
        int s, pivec[2], (*sigint)();
        struct stat sbuf;
 
        int s, pivec[2], (*sigint)();
        struct stat sbuf;
 
-       if (name[0] == '+' && (cp = value("maildir")) != 0) {
-               sprintf(xname, "%s/%s", cp, name + 1);
+       if (name[0] == '+' && getfold(cmdbuf) >= 0) {
+               sprintf(xname, "%s/%s", cmdbuf, name + 1);
                return(expand(savestr(xname)));
        }
        if (!anyof(name, "~{[*?$`'\"\\"))
                return(expand(savestr(xname)));
        }
        if (!anyof(name, "~{[*?$`'\"\\"))
@@ -561,6 +561,23 @@ err:
        return(NOSTR);
 }
 
        return(NOSTR);
 }
 
+/*
+ * Determine the current folder directory name.
+ */
+getfold(name)
+       char *name;
+{
+       char *folder;
+
+       if ((folder = value("folder")) == NOSTR)
+               return(-1);
+       if (*folder == '/')
+               strcpy(name, folder);
+       else
+               sprintf(name, "%s/%s", homedir, folder);
+       return(0);
+}
+
 /*
  * A nicer version of Fdopen, which allows us to fclose
  * without losing the open file.
 /*
  * A nicer version of Fdopen, which allows us to fclose
  * without losing the open file.