nmh-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-commits] nmh h/mh.h h/prototypes.h sbr/done.c uip/inc.c ...


From: Joel Reicher
Subject: [Nmh-commits] nmh h/mh.h h/prototypes.h sbr/done.c uip/inc.c ...
Date: Sun, 04 Nov 2007 04:47:19 +0000

CVSROOT:        /sources/nmh
Module name:    nmh
Changes by:     Joel Reicher <jjr>      07/11/04 04:47:18

Modified files:
        h              : mh.h prototypes.h 
        sbr            : done.c 
        uip            : inc.c mhbuild.c mhlist.c mhn.c mhshow.c 
                         mhstore.c mhtest.c packf.c pick.c rcvdist.c 
                         rcvstore.c sendsbr.c 

Log message:
        Change link-time overriding of done() to run-time reassigning of 
equivalent
        (*done)(). This should make changing the return type of done and the
        rationalisation of exit code easier.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/nmh/h/mh.h?cvsroot=nmh&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/nmh/h/prototypes.h?cvsroot=nmh&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/nmh/sbr/done.c?cvsroot=nmh&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/inc.c?cvsroot=nmh&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/mhbuild.c?cvsroot=nmh&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/mhlist.c?cvsroot=nmh&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/mhn.c?cvsroot=nmh&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/mhshow.c?cvsroot=nmh&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/mhstore.c?cvsroot=nmh&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/mhtest.c?cvsroot=nmh&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/packf.c?cvsroot=nmh&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/pick.c?cvsroot=nmh&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/rcvdist.c?cvsroot=nmh&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/rcvstore.c?cvsroot=nmh&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/nmh/uip/sendsbr.c?cvsroot=nmh&r1=1.15&r2=1.16

Patches:
Index: h/mh.h
===================================================================
RCS file: /sources/nmh/nmh/h/mh.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- h/mh.h      21 Feb 2006 03:58:31 -0000      1.6
+++ h/mh.h      4 Nov 2007 04:47:17 -0000       1.7
@@ -2,7 +2,7 @@
 /*
  * mh.h -- main header file for all of nmh
  *
- * $Id: mh.h,v 1.6 2006/02/21 03:58:31 levine Exp $
+ * $Id: mh.h,v 1.7 2007/11/04 04:47:17 jjr Exp $
  */
 
 #include <h/nmh.h>
@@ -336,5 +336,7 @@
 extern char *whatnowproc;
 extern char *whomproc;
 
+extern int (*done) (int);
+
 #include <h/prototypes.h>
 

Index: h/prototypes.h
===================================================================
RCS file: /sources/nmh/nmh/h/prototypes.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- h/prototypes.h      13 Apr 2007 11:53:08 -0000      1.18
+++ h/prototypes.h      4 Nov 2007 04:47:17 -0000       1.19
@@ -2,7 +2,7 @@
 /*
  * prototypes.h -- various prototypes
  *
- * $Id: prototypes.h,v 1.18 2007/04/13 11:53:08 jjr Exp $
+ * $Id: prototypes.h,v 1.19 2007/11/04 04:47:17 jjr Exp $
  */
 
 /*
@@ -47,7 +47,7 @@
 void cpydgst (int, int, char *, char *);
 int decode_rfc2047 (char *, char *, size_t);
 void discard (FILE *);
-int done (int);
+int default_done (int);
 int ext_hook(char *, char *, char *);
 int fdcompare (int, int);
 int folder_addmsg (struct msgs **, char *, int, int, int, int, char *);

Index: sbr/done.c
===================================================================
RCS file: /sources/nmh/nmh/sbr/done.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- sbr/done.c  2 Jul 2002 22:09:14 -0000       1.3
+++ sbr/done.c  4 Nov 2007 04:47:17 -0000       1.4
@@ -2,7 +2,7 @@
 /*
  * done.c -- terminate the program
  *
- * $Id: done.c,v 1.3 2002/07/02 22:09:14 kenh Exp $
+ * $Id: done.c,v 1.4 2007/11/04 04:47:17 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -11,8 +11,10 @@
 
 #include <h/mh.h>
 
+int (*done) (int) = default_done;
+
 int
-done (int status)
+default_done (int status)
 {
     exit (status);
     return 1;  /* dead code to satisfy the compiler */

Index: uip/inc.c
===================================================================
RCS file: /sources/nmh/nmh/uip/inc.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- uip/inc.c   21 Aug 2007 21:19:39 -0000      1.24
+++ uip/inc.c   4 Nov 2007 04:47:18 -0000       1.25
@@ -2,7 +2,7 @@
 /*
  * inc.c -- incorporate messages from a maildrop into a folder
  *
- * $Id: inc.c,v 1.24 2007/08/21 21:19:39 bress Exp $
+ * $Id: inc.c,v 1.25 2007/11/04 04:47:18 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -223,8 +223,8 @@
  */
 char *map_name(char *);
 
+static int inc_done(int);
 #ifdef POP
-int done(int);
 static int pop_action(char *);
 static int pop_pack(char *);
 static int map_count(void);
@@ -263,6 +263,8 @@
     struct hes_postoffice *po;
 #endif
 
+    done=inc_done;
+
 /* absolutely the first thing we do is save our privileges,
  * and drop them if we can.
  */
@@ -987,8 +989,8 @@
 #endif /* if 0 */
 
 
-int
-done (int status)
+static int
+inc_done (int status)
 {
 #ifdef POP
     if (packfile && pd != NOTOK)

Index: uip/mhbuild.c
===================================================================
RCS file: /sources/nmh/nmh/uip/mhbuild.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- uip/mhbuild.c       31 Jan 2006 02:50:57 -0000      1.10
+++ uip/mhbuild.c       4 Nov 2007 04:47:18 -0000       1.11
@@ -2,7 +2,7 @@
 /*
  * mhbuild.c -- expand/translate MIME composition files
  *
- * $Id: mhbuild.c,v 1.10 2006/01/31 02:50:57 levine Exp $
+ * $Id: mhbuild.c,v 1.11 2007/11/04 04:47:18 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -100,6 +100,7 @@
 static char outfile[BUFSIZ];
 static int unlink_outfile = 0;
 
+static int unlink_done (int);
 
 /* mhbuildsbr.c */
 CT build_mime (char *);
@@ -126,6 +127,8 @@
     CT ct, cts[2];
     FILE *fp;
 
+    done=unlink_done;
+
 #ifdef LOCALE
     setlocale(LC_ALL, "");
 #endif
@@ -382,8 +385,8 @@
 }
 
 
-int
-done (int status)
+static int
+unlink_done (int status)
 {
     /*
      * Check if we need to remove stray

Index: uip/mhlist.c
===================================================================
RCS file: /sources/nmh/nmh/uip/mhlist.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- uip/mhlist.c        27 Apr 2006 12:00:28 -0000      1.12
+++ uip/mhlist.c        4 Nov 2007 04:47:18 -0000       1.13
@@ -2,7 +2,7 @@
 /*
  * mhlist.c -- list the contents of MIME messages
  *
- * $Id: mhlist.c,v 1.12 2006/04/27 12:00:28 jjr Exp $
+ * $Id: mhlist.c,v 1.13 2007/11/04 04:47:18 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -117,6 +117,7 @@
  * static prototypes
  */
 static RETSIGTYPE pipeser (int);
+static int freectp_done (int);
 
 
 int
@@ -131,6 +132,8 @@
     struct msgs *mp = NULL;
     CT ct, *ctp;
 
+    done=freectp_done;
+
 #ifdef LOCALE
     setlocale(LC_ALL, "");
 #endif
@@ -391,8 +394,8 @@
 }
 
 
-int
-done (int status)
+static int
+freectp_done (int status)
 {
     CT *ctp;
 

Index: uip/mhn.c
===================================================================
RCS file: /sources/nmh/nmh/uip/mhn.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- uip/mhn.c   27 Apr 2006 12:00:28 -0000      1.12
+++ uip/mhn.c   4 Nov 2007 04:47:18 -0000       1.13
@@ -2,7 +2,7 @@
 /*
  * mhn.c -- display, list, cache, or store the contents of MIME messages
  *
- * $Id: mhn.c,v 1.12 2006/04/27 12:00:28 jjr Exp $
+ * $Id: mhn.c,v 1.13 2007/11/04 04:47:18 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -205,6 +205,7 @@
  * static prototypes
  */
 static RETSIGTYPE pipeser (int);
+static int freectp_done (int);
 
 
 int
@@ -220,6 +221,8 @@
     CT ct, *ctp;
     FILE *fp;
 
+    done=freectp_done;
+
 #ifdef LOCALE
     setlocale(LC_ALL, "");
 #endif
@@ -704,8 +707,8 @@
 }
 
 
-int
-done (int status)
+static int
+freectp_done (int status)
 {
     CT *ctp;
 

Index: uip/mhshow.c
===================================================================
RCS file: /sources/nmh/nmh/uip/mhshow.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- uip/mhshow.c        27 Apr 2006 12:00:28 -0000      1.12
+++ uip/mhshow.c        4 Nov 2007 04:47:18 -0000       1.13
@@ -2,7 +2,7 @@
 /*
  * mhshow.c -- display the contents of MIME messages
  *
- * $Id: mhshow.c,v 1.12 2006/04/27 12:00:28 jjr Exp $
+ * $Id: mhshow.c,v 1.13 2007/11/04 04:47:18 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -133,6 +133,7 @@
  * static prototypes
  */
 static RETSIGTYPE pipeser (int);
+static int freectp_done (int);
 
 
 int
@@ -147,6 +148,8 @@
     CT ct, *ctp;
     FILE *fp;
 
+    done=freectp_done;
+
 #ifdef LOCALE
     setlocale(LC_ALL, "");
 #endif
@@ -471,8 +474,8 @@
 }
 
 
-int
-done (int status)
+static int
+freectp_done (int status)
 {
     CT *ctp;
 

Index: uip/mhstore.c
===================================================================
RCS file: /sources/nmh/nmh/uip/mhstore.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- uip/mhstore.c       27 Apr 2006 12:00:28 -0000      1.12
+++ uip/mhstore.c       4 Nov 2007 04:47:18 -0000       1.13
@@ -2,7 +2,7 @@
 /*
  * mhstore.c -- store the contents of MIME messages
  *
- * $Id: mhstore.c,v 1.12 2006/04/27 12:00:28 jjr Exp $
+ * $Id: mhstore.c,v 1.13 2007/11/04 04:47:18 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -111,6 +111,7 @@
  * static prototypes
  */
 static RETSIGTYPE pipeser (int);
+static int freectp_done (int);
 
 
 int
@@ -125,6 +126,8 @@
     CT ct, *ctp;
     FILE *fp;
 
+    done=freectp_done;
+
 #ifdef LOCALE
     setlocale(LC_ALL, "");
 #endif
@@ -403,8 +406,8 @@
 }
 
 
-int
-done (int status)
+static int
+freectp_done (int status)
 {
     CT *ctp;
 

Index: uip/mhtest.c
===================================================================
RCS file: /sources/nmh/nmh/uip/mhtest.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- uip/mhtest.c        27 Apr 2006 12:00:28 -0000      1.12
+++ uip/mhtest.c        4 Nov 2007 04:47:18 -0000       1.13
@@ -2,7 +2,7 @@
 /*
  * mhtest.c -- test harness for MIME routines
  *
- * $Id: mhtest.c,v 1.12 2006/04/27 12:00:28 jjr Exp $
+ * $Id: mhtest.c,v 1.13 2007/11/04 04:47:18 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -114,6 +114,7 @@
  */
 static int write_content (CT *, char *);
 static RETSIGTYPE pipeser (int);
+static int freectp_done (int);
 
 
 int
@@ -127,6 +128,8 @@
     struct msgs *mp = NULL;
     CT ct, *ctp;
 
+    done=freectp_done;
+
 #ifdef LOCALE
     setlocale(LC_ALL, "");
 #endif
@@ -397,8 +400,8 @@
 }
 
 
-int
-done (int status)
+static int
+freectp_done (int status)
 {
     CT *ctp;
 

Index: uip/packf.c
===================================================================
RCS file: /sources/nmh/nmh/uip/packf.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- uip/packf.c 27 Apr 2006 12:00:28 -0000      1.9
+++ uip/packf.c 4 Nov 2007 04:47:18 -0000       1.10
@@ -2,7 +2,7 @@
 /*
  * packf.c -- pack a nmh folder into a file
  *
- * $Id: packf.c,v 1.9 2006/04/27 12:00:28 jjr Exp $
+ * $Id: packf.c,v 1.10 2007/11/04 04:47:18 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -33,6 +33,8 @@
 static int mbx_style = MBOX_FORMAT;
 static int mapping = 0;
 
+static int mbxclose_done(int);
+
 char *file = NULL;
 
 
@@ -46,6 +48,8 @@
     struct msgs *mp;
     struct stat st;
 
+    done=mbxclose_done;
+
 #ifdef LOCALE
     setlocale(LC_ALL, "");
 #endif
@@ -178,8 +182,8 @@
     return done (0);
 }
 
-int
-done (int status)
+static int
+mbxclose_done (int status)
 {
     mbx_close (file, md);
     exit (status);

Index: uip/pick.c
===================================================================
RCS file: /sources/nmh/nmh/uip/pick.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- uip/pick.c  27 Apr 2006 12:00:28 -0000      1.10
+++ uip/pick.c  4 Nov 2007 04:47:18 -0000       1.11
@@ -2,7 +2,7 @@
 /*
  * pick.c -- search for messages by content
  *
- * $Id: pick.c,v 1.10 2006/04/27 12:00:28 jjr Exp $
+ * $Id: pick.c,v 1.11 2007/11/04 04:47:18 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -68,6 +68,7 @@
 
 static int listsw = -1;
 
+static int putzero_done (int);
 
 int
 main (int argc, char **argv)
@@ -81,6 +82,8 @@
     struct msgs *mp;
     register FILE *fp;
 
+    done=putzero_done;
+
 #ifdef LOCALE
     setlocale(LC_ALL, "");
 #endif
@@ -287,8 +290,8 @@
 }
 
 
-int
-done (int status)
+static int
+putzero_done (int status)
 {
     if (listsw && status && !isatty (fileno (stdout)))
        printf ("0\n");

Index: uip/rcvdist.c
===================================================================
RCS file: /sources/nmh/nmh/uip/rcvdist.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- uip/rcvdist.c       8 Mar 2006 12:14:16 -0000       1.10
+++ uip/rcvdist.c       4 Nov 2007 04:47:18 -0000       1.11
@@ -2,7 +2,7 @@
 /*
  * rcvdist.c -- asynchronously redistribute messages
  *
- * $Id: rcvdist.c,v 1.10 2006/03/08 12:14:16 bress Exp $
+ * $Id: rcvdist.c,v 1.11 2007/11/04 04:47:18 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -34,7 +34,7 @@
  * prototypes
  */
 static void rcvdistout (FILE *, char *, char *);
-int done (int);
+static int unlink_done (int);
 
 
 int
@@ -46,6 +46,8 @@
     char **argp, **arguments, *vec[MAXARGS];
     register FILE *fp;
 
+    done=unlink_done;
+
 #ifdef LOCALE
     setlocale(LC_ALL, "");
 #endif
@@ -268,8 +270,8 @@
 }
 
 
-int
-done (int status)
+static int
+unlink_done (int status)
 {
     if (backup[0])
        unlink (backup);

Index: uip/rcvstore.c
===================================================================
RCS file: /sources/nmh/nmh/uip/rcvstore.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- uip/rcvstore.c      27 Apr 2006 12:00:28 -0000      1.11
+++ uip/rcvstore.c      4 Nov 2007 04:47:18 -0000       1.12
@@ -2,7 +2,7 @@
 /*
  * rcvstore.c -- asynchronously add mail to a folder
  *
- * $Id: rcvstore.c,v 1.11 2006/04/27 12:00:28 jjr Exp $
+ * $Id: rcvstore.c,v 1.12 2007/11/04 04:47:18 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -48,6 +48,7 @@
  */
 static char *tmpfilenam = NULL;
 
+static int unlink_done(int);
 
 int
 main (int argc, char **argv)
@@ -60,6 +61,8 @@
     struct msgs *mp;
     struct stat st;
 
+    done=unlink_done;
+
 #ifdef LOCALE
     setlocale(LC_ALL, "");
 #endif
@@ -228,8 +231,8 @@
 /*
  * Clean up and exit
  */
-int
-done(int status)
+static int
+unlink_done(int status)
 {
     if (tmpfilenam && *tmpfilenam)
        unlink (tmpfilenam);

Index: uip/sendsbr.c
===================================================================
RCS file: /sources/nmh/nmh/uip/sendsbr.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- uip/sendsbr.c       21 Mar 2007 00:21:10 -0000      1.15
+++ uip/sendsbr.c       4 Nov 2007 04:47:18 -0000       1.16
@@ -2,7 +2,7 @@
 /*
  * sendsbr.c -- routines to help WhatNow/Send along
  *
- * $Id: sendsbr.c,v 1.15 2007/03/21 00:21:10 pm215 Exp $
+ * $Id: sendsbr.c,v 1.16 2007/11/04 04:47:18 jjr Exp $
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -41,7 +41,6 @@
 char *annotext = NULL;
 char *distfile = NULL;
 
-static int armed = 0;
 static jmp_buf env;
 
 static char    body_file_name[MAXPATHLEN + 1];         /* name of temporary 
file for body content */
@@ -56,12 +55,12 @@
  * external prototypes
  */
 int sendsbr (char **, int, char *, struct stat *, int, char *, int);
-int done (int);
 char *getusername (void);
 
 /*
  * static prototypes
  */
+static int armed_done (int);
 static void alert (char *, int);
 static int tmp_fd (void);
 static void anno (int, struct stat *);
@@ -118,7 +117,7 @@
        }
     }
 
-    armed++;
+    done=armed_done;
     switch (setjmp (env)) {
     case OK: 
        /*
@@ -154,7 +153,7 @@
        break;
     }
 
-    armed = 0;
+    done=default_done;
     if (distfile)
        unlink (distfile);
 
@@ -1075,10 +1074,9 @@
 }
 
 
-int
-done (int status)
+static int
+armed_done (int status)
 {
-    if (armed)
        longjmp (env, status ? status : NOTOK);
 
     exit (status);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]