]> diplodocus.org Git - nmh/commitdiff
Replace copy(s, d) with POSIX-1.2008's stpcpy(d, s).
authorRalph Corderoy <ralph@inputplus.co.uk>
Sat, 12 Nov 2016 00:55:17 +0000 (00:55 +0000)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sat, 12 Nov 2016 00:55:17 +0000 (00:55 +0000)
Makefile.am
h/prototypes.h
sbr/concat.c
sbr/copy.c [deleted file]
sbr/m_maildir.c
uip/rmf.c

index da04273..5580571 100644 (file)
@@ -582,7 +582,7 @@ sbr_libmh_a_SOURCES = sbr/addrsbr.c sbr/ambigsw.c sbr/atooi.c sbr/arglist.c \
                      sbr/closefds.c sbr/concat.c sbr/context_del.c \
                      sbr/context_find.c sbr/context_foil.c sbr/context_read.c \
                      sbr/context_replace.c sbr/context_save.c \
-                     sbr/copy.c sbr/copyip.c sbr/cpydata.c \
+                     sbr/copyip.c sbr/cpydata.c \
                      sbr/cpydgst.c sbr/crawl_folders.c sbr/credentials.c \
                      sbr/discard.c sbr/done.c sbr/dtimep.l sbr/dtime.c \
                      sbr/encode_rfc2047.c \
index 6c4fdcf..5103143 100644 (file)
@@ -53,7 +53,6 @@ int context_foil (char *);
 void context_read (void);
 void context_replace (char *, char *);
 void context_save (void);
-char *copy (const char *, char *);
 char **copyip (char **, char **, int);
 void cpydata (int, int, const char *, const char *);
 void cpydgst (int, int, char *, char *);
index 234d175..afe4820 100644 (file)
@@ -32,11 +32,11 @@ concat (const char *s1, ...)
 
     dp = sp = mh_xmalloc(len);
 
-    sp = copy(s1, sp);
+    sp = stpcpy(sp, s1);
 
     va_start(list, s1); 
     while ((cp = va_arg (list, char *)))
-       sp = copy(cp, sp);
+       sp = stpcpy(sp, cp);
     va_end(list);
 
     return dp;
diff --git a/sbr/copy.c b/sbr/copy.c
deleted file mode 100644 (file)
index 5447440..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-
-/*
- * copy.c -- copy a string and return pointer to NULL terminator
- *
- * 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>
-
-char *
-copy(const char *from, char *to)
-{
-    while ((*to = *from)) {
-       to++;
-       from++;
-    }
-    return (to);
-}
index a4f2af5..2947c9b 100644 (file)
@@ -83,9 +83,9 @@ exmaildir (char *folder)
            snprintf(cp, sizeof mailfold, "%s/", mypath);
            cp += strlen (cp);
        }
-       cp = copy (pp, cp);
+       cp = stpcpy(cp, pp);
     } else {
-       cp = copy (path ("./", TFOLDER), cp);
+       cp = stpcpy(cp, path("./", TFOLDER));
     }
     if (cp[-1] != '/')
        *cp++ = '/';
index 4684e7e..493510a 100644 (file)
--- a/uip/rmf.c
+++ b/uip/rmf.c
@@ -92,7 +92,7 @@ main (int argc, char **argv)
        interactive = defolder;
 
     if (strchr (folder, '/') && (*folder != '/') && (*folder != '.')) {
-       for (cp = copy (folder, newfolder); cp > newfolder && *cp != '/'; cp--)
+       for (cp = stpcpy(newfolder, folder); cp > newfolder && *cp != '/'; cp--)
            continue;
        if (cp > newfolder)
            *cp = '\0';