+2006-01-06 Josh Bressers <josh@bress.net>
+
+ * patch #3968: Move the add() function from its own file (add.c) and
+ into utils.c. There was also a duplicate add() function in mf.c which
+ has been removed.
+
2006-01-02 Josh Bressers <josh@bress.net>
* Remove sbr/pwd.c file, moving the pwd() function into sbr/utils.c.
/*
* prototypes from the nmh subroutine library
*/
-char *add (char *, char *);
void adios (char *, char *, ...);
void admonish (char *, char *, ...);
void advertise (char *, char *, char *, va_list);
void *mh_xmalloc(size_t);
void *mh_xrealloc(void *, size_t);
char *pwd(void);
+char *add(char *, char *);
SIGNAL_H = @SIGNAL_H@
# source for library functions
-SRCS = add.c addrsbr.c ambigsw.c atooi.c brkstring.c \
+SRCS = addrsbr.c ambigsw.c atooi.c brkstring.c \
check_charset.c client.c closefds.c concat.c context_del.c \
context_find.c context_foil.c context_read.c \
context_replace.c context_save.c copy.c \
+++ /dev/null
-
-/*
- * add.c -- If "s1" is NULL, this routine just creates a
- * -- copy of "s2" into newly malloc'ed memory.
- * --
- * -- If "s1" is not NULL, then copy the concatenation
- * -- of "s1" and "s2" (note the order) into newly
- * -- malloc'ed memory. Then free "s1".
- *
- * $Id$
- *
- * 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>
-#include <h/utils.h>
-
-char *
-add (char *s2, char *s1)
-{
- char *cp;
- size_t len1 = 0, len2 = 0;
-
- if (s1)
- len1 = strlen (s1);
- if (s2)
- len2 = strlen (s2);
-
-
- cp = mh_xmalloc (len1 + len2 + 1);
-
- /* Copy s1 and free it */
- if (s1) {
- memcpy (cp, s1, len1);
- free (s1);
- }
-
- /* Copy s2 */
- if (s2)
- memcpy (cp + len1, s2, len2);
-
- /* Now NULL terminate the string */
- cp[len1 + len2] = '\0';
-
- return cp;
-}
* static prototypes
*/
static char *getcpy (char *);
-static char *add (char *, char *);
static void compress (char *, char *);
static int isat (char *);
static int parse_address (void);
}
-static char *
-add (char *s1, char *s2)
-{
- register char *p;
-
- if (!s2)
- return getcpy (s1);
-
- p = mh_xmalloc ((size_t) (strlen (s1) + strlen (s2) + 2));
- sprintf (p, "%s%s", s2, s1);
- free (s2);
- return p;
-}
-
int
isfrom(char *string)
{
*/
#include <h/mh.h>
+#include <h/utils.h>
/*
* static prototypes
return curwd;
}
+
+/*
+ * add -- If "s1" is NULL, this routine just creates a
+ * -- copy of "s2" into newly malloc'ed memory.
+ * --
+ * -- If "s1" is not NULL, then copy the concatenation
+ * -- of "s1" and "s2" (note the order) into newly
+ * -- malloc'ed memory. Then free "s1".
+ */
+char *
+add (char *s2, char *s1)
+{
+ char *cp;
+ size_t len1 = 0, len2 = 0;
+
+ if (s1)
+ len1 = strlen (s1);
+ if (s2)
+ len2 = strlen (s2);
+
+ cp = mh_xmalloc (len1 + len2 + 1);
+
+ /* Copy s1 and free it */
+ if (s1) {
+ memcpy (cp, s1, len1);
+ free (s1);
+ }
+
+ /* Copy s2 */
+ if (s2)
+ memcpy (cp + len1, s2, len2);
+
+ /* Now NULL terminate the string */
+ cp[len1 + len2] = '\0';
+
+ return cp;
+}
#include <h/addrsbr.h>
#include <h/aliasbr.h>
#include <h/mts.h>
+#include <h/utils.h>
/*
* maximum number of names
#include <h/mh.h>
#include <fcntl.h>
+#include <h/utils.h>
static int hdrfd = NOTOK;
static int txtfd = NOTOK;
#include <h/mime.h>
#include <h/mhparse.h>
#include <h/mhcachesbr.h>
+#include <h/utils.h>
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#include <h/mime.h>
#include <h/mhparse.h>
#include <h/mhcachesbr.h>
+#include <h/utils.h>
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
#include <h/tws.h>
#include <h/mime.h>
#include <h/mhparse.h>
+#include <h/utils.h>
/* mhmisc.c */
int part_ok (CT, int);
#include <h/mh.h>
#include <h/signals.h>
+#include <h/utils.h>
#include <signal.h>
static struct swit switches[] = {
#include <errno.h>
#include <h/mime.h>
#include <h/mhparse.h>
+#include <h/utils.h>
extern int debugsw;
#include <h/tws.h>
#include <h/mime.h>
#include <h/mhparse.h>
+#include <h/utils.h>
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#include <h/tws.h>
#include <h/mime.h>
#include <h/mhparse.h>
+#include <h/utils.h>
/*
#include <h/mh.h>
#include <h/tws.h>
#include <h/picksbr.h>
+#include <h/utils.h>
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
#include <h/aliasbr.h>
#include <h/dropsbr.h>
#include <h/mime.h>
+#include <h/utils.h>
#include <h/tws.h>
#include <h/mts.h>
*/
#include <h/mh.h>
+#include <h/utils.h>
static struct swit switches[] = {
#include <h/mh.h>
#include <h/mime.h>
+#include <h/utils.h>
static struct swit switches[] = {
#define CHECKMIMESW 0
#include <h/signals.h>
#include <h/tws.h>
#include <h/mts.h>
+#include <h/utils.h>
#include <pwd.h>
#include <signal.h>
#include <h/dropsbr.h>
#include <h/tws.h>
#include <h/mts.h>
+#include <h/utils.h>
#define uptolow(c) ((isalpha(c) && isupper (c)) ? tolower (c) : c)