Folded fileproc to constant `refile'.
authormarkus schnalke <meillo@marmaro.de>
Thu, 29 Mar 2012 16:18:21 +0000 (18:18 +0200)
committermarkus schnalke <meillo@marmaro.de>
Thu, 29 Mar 2012 16:18:21 +0000 (18:18 +0200)
Also moved sbr/refile.c into uip/whatnow.c

14 files changed:
config/config.c
h/mh.h
h/prototypes.h
man/comp.man1
man/forw.man1
man/mh-profile.man5
man/repl.man1
man/whatnow.man1
sbr/Makefile.in
sbr/readconfig.c
sbr/refile.c [deleted file]
uip/mhparam.c
uip/spost.c
uip/whatnow.c

index 31acdbb..f38866b 100644 (file)
@@ -113,13 +113,6 @@ char *mimetypequeryproc = "file -b --mime";
 */
 
 /*
 */
 
 /*
-** This program is usually called directly by users, but it is
-** also invoked by the spost program to process an "Fcc", or by
-** comp/repl/forw/dist to refile a draft message.
-*/
-char *fileproc = "refile";
-
-/*
 ** This is the default program invoked by a "list" or "display" response
 ** at the "What now?" prompt. It will be given the absolute pathname of
 ** the message to show. The string ``show -file'' is most likely what you
 ** This is the default program invoked by a "list" or "display" response
 ** at the "What now?" prompt. It will be given the absolute pathname of
 ** the message to show. The string ``show -file'' is most likely what you
diff --git a/h/mh.h b/h/mh.h
index ac8e665..0530051 100644 (file)
--- a/h/mh.h
+++ b/h/mh.h
@@ -284,7 +284,6 @@ extern char *defaultfolder;
 extern char *digestcomps;
 extern char *distcomps;
 extern char *draftfolder;
 extern char *digestcomps;
 extern char *distcomps;
 extern char *draftfolder;
-extern char *fileproc;
 extern char *foldprot;
 extern char *forwcomps;
 extern char *inbox;
 extern char *foldprot;
 extern char *forwcomps;
 extern char *inbox;
index 973da67..ba33a03 100644 (file)
@@ -85,7 +85,6 @@ void push(void);
 char *pwd(void);
 char *mhbasename(char *);
 void readconfig(struct node **, FILE *, char *, int);
 char *pwd(void);
 char *mhbasename(char *);
 void readconfig(struct node **, FILE *, char *, int);
-int refile(char **, char *);
 void ruserpass(char *, char **, char **);
 int seq_addmsg(struct msgs *, char *, int, int, int);
 int seq_addsel(struct msgs *, char *, int, int);
 void ruserpass(char *, char **, char **);
 int seq_addmsg(struct msgs *, char *, int, int, int);
 int seq_addsel(struct msgs *, char *, int, int);
index 5c39a50..6258d20 100644 (file)
@@ -161,7 +161,6 @@ will prevent any edit from occurring.)
 ^Draft\-Folder:~^To set the default draft folder
 ^Editor:~^To override the default editor
 ^Msg\-Protect:~^To set mode when creating a new message (draft)
 ^Draft\-Folder:~^To set the default draft folder
 ^Editor:~^To override the default editor
 ^Msg\-Protect:~^To set mode when creating a new message (draft)
-^fileproc:~^Program to refile the message
 ^whatnowproc:~^Program to ask the \*(lqWhat now?\*(rq questions
 .fi
 
 ^whatnowproc:~^Program to ask the \*(lqWhat now?\*(rq questions
 .fi
 
index 7f9f952..628942d 100644 (file)
@@ -195,7 +195,6 @@ User's Manual for more information on making digests.
 ^Draft\-Folder:~^To set the default draft\-folder
 ^Editor:~^To override the default editor
 ^Msg\-Protect:~^To set mode when creating a new message (draft)
 ^Draft\-Folder:~^To set the default draft\-folder
 ^Editor:~^To override the default editor
 ^Msg\-Protect:~^To set mode when creating a new message (draft)
-^fileproc:~^Program to refile the message
 ^whatnowproc:~^Program to ask the \*(lqWhat now?\*(rq questions
 .fi
 
 ^whatnowproc:~^Program to ask the \*(lqWhat now?\*(rq questions
 .fi
 
index 65a2d6f..083222b 100644 (file)
@@ -405,26 +405,6 @@ The profile can be used to select alternate programs if the
 user wishes.  The default values are given in the examples.
 .RE
 .PP
 user wishes.  The default values are given in the examples.
 .RE
 .PP
-.BR fileproc :
-%bindir%/refile
-.RS 5
-This program is used to refile or link a message to another folder.
-It is used by
-.B post
-to file a copy of a message into a folder given
-by a \*(lqFcc:\*(rq field.  It is used by the draft folder facility in
-.BR comp ,
-.BR dist ,
-.BR forw ,
-and
-.B repl
-to refile a draft
-message into another folder.  It is used to refile a draft message in
-response to the
-.B refile
-directive at the \*(lqWhat now?\*(rq prompt.
-.RE
-.PP
 .BR listproc :
 show \-file
 .RS 5
 .BR listproc :
 show \-file
 .RS 5
index 5643286..26a2cdd 100644 (file)
@@ -390,7 +390,6 @@ switch.
 ^Draft\-Folder:~^To set the default draft\-folder
 ^Editor:~^To override the default editor
 ^Msg\-Protect:~^To set mode when creating a new message (draft)
 ^Draft\-Folder:~^To set the default draft\-folder
 ^Editor:~^To override the default editor
 ^Msg\-Protect:~^To set mode when creating a new message (draft)
-^fileproc:~^Program to refile the message
 ^whatnowproc:~^Program to ask the \*(lqWhat now?\*(rq questions
 .fi
 
 ^whatnowproc:~^Program to ask the \*(lqWhat now?\*(rq questions
 .fi
 
index 36844a0..0406e45 100644 (file)
@@ -115,8 +115,8 @@ option).
 .PP
 For the
 .B refile
 .PP
 For the
 .B refile
-response, any valid switch to the
-.I fileproc
+response, any valid switch to
+.B refile
 is valid.
 .PP
 See
 is valid.
 .PP
 See
@@ -158,7 +158,6 @@ information.
 ^Editor:~^To override the default editor
 ^<lasteditor>\-next:~^To name an editor to be used after exit
 ^~^from <lasteditor>
 ^Editor:~^To override the default editor
 ^<lasteditor>\-next:~^To name an editor to be used after exit
 ^~^from <lasteditor>
-^fileproc:~^Program to refile the message
 ^listproc:~^Program to list the contents of a message
 .fi
 
 ^listproc:~^Program to list the contents of a message
 .fi
 
index f2f1a9e..1f1b79b 100644 (file)
@@ -60,7 +60,7 @@ SRCS = addrsbr.c ambigsw.c brkstring.c  \
        makedir.c mts.c norm_charmap.c  \
        path.c pidwait.c pidstatus.c  \
        print_help.c print_sw.c print_version.c \
        makedir.c mts.c norm_charmap.c  \
        path.c pidwait.c pidstatus.c  \
        print_help.c print_sw.c print_version.c \
-       putenv.c refile.c mhbasename.c  \
+       putenv.c mhbasename.c  \
        readconfig.c ruserpass.c seq_add.c seq_bits.c  \
        seq_del.c seq_getnum.c seq_list.c seq_nameok.c  \
        seq_print.c seq_read.c seq_save.c seq_setcur.c  \
        readconfig.c ruserpass.c seq_add.c seq_bits.c  \
        seq_del.c seq_getnum.c seq_list.c seq_nameok.c  \
        seq_print.c seq_read.c seq_save.c seq_setcur.c  \
index 280d25b..c238a26 100644 (file)
@@ -22,7 +22,6 @@ static struct procstr procs[] = {
        { "backup-prefix", &backup_prefix },
        { "draft-folder",  &draftfolder },
        { "altmsg-link",   &altmsglink },
        { "backup-prefix", &backup_prefix },
        { "draft-folder",  &draftfolder },
        { "altmsg-link",   &altmsglink },
-       { "fileproc",      &fileproc },
        { "listproc",      &listproc },
        { "sendmail",      &sendmail },
        { "trash-folder",  &trashfolder },
        { "listproc",      &listproc },
        { "sendmail",      &sendmail },
        { "trash-folder",  &trashfolder },
diff --git a/sbr/refile.c b/sbr/refile.c
deleted file mode 100644 (file)
index 55ba754..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-** refile.c -- call the "fileproc" to refile the
-**          -- msg or draft into another folder
-**
-** This code is Copyright (c) 2002, by the authors of nmh.  See the
-** COPYRIGHT file in the root directory of the nmh distribution for
-** complete copyright information.
-*/
-
-#include <h/mh.h>
-
-
-int
-refile(char **arg, char *file)
-{
-       pid_t pid;
-       register int vecp;
-       char *vec[MAXARGS];
-
-       vecp = 0;
-       vec[vecp++] = mhbasename(fileproc);
-       vec[vecp++] = "-nolink";  /* override bad .mh_profile defaults */
-       vec[vecp++] = "-nopreserve";
-       vec[vecp++] = "-file";
-       vec[vecp++] = file;
-
-       if (arg) {
-               while (*arg)
-                       vec[vecp++] = *arg++;
-       }
-       vec[vecp] = NULL;
-
-       context_save();  /* save the context file */
-       fflush(stdout);
-
-       switch (pid = fork()) {
-       case -1:
-               advise("fork", "unable to");
-               return -1;
-
-       case 0:
-               execvp(fileproc, vec);
-               fprintf(stderr, "unable to exec ");
-               perror(fileproc);
-               _exit(-1);
-
-       default:
-               return (pidwait(pid, -1));
-       }
-}
index 7a1c512..664e5d0 100644 (file)
@@ -37,7 +37,6 @@ static struct proc procs [] = {
        { "context",       &context },
        { "mh-sequences",  &mh_seq },
        { "editor",        &defaulteditor },
        { "context",       &context },
        { "mh-sequences",  &mh_seq },
        { "editor",        &defaulteditor },
-       { "fileproc",      &fileproc },
        { "foldprot",      &foldprot },
        { "listproc",      &listproc },
        { "mimetypequeryproc", &mimetypequeryproc },
        { "foldprot",      &foldprot },
        { "listproc",      &listproc },
        { "mimetypequeryproc", &mimetypequeryproc },
index 93283cc..369f03e 100644 (file)
@@ -654,12 +654,12 @@ fcc(char *file, char *folders)
                                folders);
                fflush(stdout);
        }
                                folders);
                fflush(stdout);
        }
-       if (strlen(fileproc)+strlen(file)+strlen(folders)+100 > sizeof cmd) {
+       if (100+strlen(file)+strlen(folders) > sizeof cmd) {
                adios(NULL, "Too much Fcc data");
        }
        /* hack: read from /dev/null and refile(1) won't question us */
                adios(NULL, "Too much Fcc data");
        }
        /* hack: read from /dev/null and refile(1) won't question us */
-       snprintf(cmd, sizeof cmd, "</dev/null %s -link -file %s %s",
-                       fileproc, file, folders);
+       snprintf(cmd, sizeof cmd, "</dev/null refile -link -file '%s' %s",
+                       file, folders);
        status = system(cmd);
        if (status == -1) {
                fprintf(stderr, "Skipped %sFcc %s: unable to system().\n",
        status = system(cmd);
        if (status == -1) {
                fprintf(stderr, "Skipped %sFcc %s: unable to system().\n",
index 6e58052..0576ff8 100644 (file)
@@ -99,6 +99,7 @@ static char *myprompt = "\nWhat now? ";
 static int editfile(char **, char **, char *, int, struct msgs *,
        char *, char *, int);
 static int sendfile(char **, char *, int);
 static int editfile(char **, char **, char *, int, struct msgs *,
        char *, char *, int);
 static int sendfile(char **, char *, int);
+static int refile(char **, char *);
 static int removefile(char *);
 static void writelscmd(char *, int, char **);
 static void writesomecmd(char *buf, int bufsz, char *cmd, char *trailcmd, char **argp);
 static int removefile(char *);
 static void writelscmd(char *, int, char **);
 static void writesomecmd(char *buf, int bufsz, char *cmd, char *trailcmd, char **argp);
@@ -265,8 +266,9 @@ main(int argc, char **argv)
 
                case REFILEOPT:
                        /* Refile the draft */
 
                case REFILEOPT:
                        /* Refile the draft */
-                       if (refile(++argp, drft) == 0)
+                       if (refile(++argp, drft) == 0) {
                                done(0);
                                done(0);
+                       }
                        break;
 
                case CDCMDSW:
                        break;
 
                case CDCMDSW:
@@ -788,6 +790,47 @@ sendfile(char **arg, char *file, int pushsw)
 
 
 /*
 
 
 /*
+** refile msg into another folder
+*/
+static int
+refile(char **arg, char *file)
+{
+       pid_t pid;
+       register int vecp;
+       char *vec[MAXARGS];
+
+       vecp = 0;
+       vec[vecp++] = "refile";
+       vec[vecp++] = "-nolink";  /* override bad .mh_profile defaults */
+       vec[vecp++] = "-file";
+       vec[vecp++] = file;
+
+       while (arg && *arg) {
+               vec[vecp++] = *arg++;
+       }
+       vec[vecp] = NULL;
+
+       context_save();  /* save the context file */
+       fflush(stdout);
+
+       switch (pid = fork()) {
+       case -1:
+               advise("fork", "unable to");
+               return -1;
+
+       case 0:
+               execvp(*vec, vec);
+               fprintf(stderr, "unable to exec ");
+               perror(*vec);
+               _exit(-1);
+
+       default:
+               return (pidwait(pid, -1));
+       }
+}
+
+
+/*
 ** Remove the draft file
 */
 
 ** Remove the draft file
 */