]> git.marmaro.de Git - mmh/commitdiff
Renamed r1bindex() to mhbasename(), to make its function becomes clear.
authormarkus schnalke <meillo@marmaro.de>
Sat, 5 Nov 2011 13:04:02 +0000 (14:04 +0100)
committermarkus schnalke <meillo@marmaro.de>
Sat, 5 Nov 2011 13:04:02 +0000 (14:04 +0100)
All calls to r1bindex() had '/' as second argument. For everything else
one can use strrchr(3) instead of r1bindex().

63 files changed:
h/prototypes.h
sbr/Makefile.in
sbr/ext_hook.c
sbr/folder_delmsgs.c
sbr/m_backup.c
sbr/m_mktemp.c
sbr/mhbasename.c [new file with mode: 0644]
sbr/r1bindex.c [deleted file]
sbr/refile.c
sbr/showfile.c
uip/ali.c
uip/anno.c
uip/ap.c
uip/burst.c
uip/comp.c
uip/conflict.c
uip/dist.c
uip/dp.c
uip/dropsbr.c
uip/flist.c
uip/fmtdump.c
uip/folder.c
uip/forw.c
uip/inc.c
uip/install-mh.c
uip/mark.c
uip/mhbuild.c
uip/mhlist.c
uip/mhlistsbr.c
uip/mhlsbr.c
uip/mhmail.c
uip/mhparam.c
uip/mhparse.c
uip/mhpath.c
uip/mhshow.c
uip/mhshowsbr.c
uip/mhstore.c
uip/mhstoresbr.c
uip/mhtest.c
uip/msgchk.c
uip/new.c
uip/packf.c
uip/pick.c
uip/prompter.c
uip/rcvdist.c
uip/rcvpack.c
uip/rcvstore.c
uip/rcvtty.c
uip/refile.c
uip/repl.c
uip/replsbr.c
uip/rmf.c
uip/rmm.c
uip/scan.c
uip/send.c
uip/sendsbr.c
uip/show.c
uip/slocal.c
uip/sortm.c
uip/spost.c
uip/viamail.c
uip/whatnowproc.c
uip/whatnowsbr.c

index 6200ea66234f495d63bc806a7640e8e946b9b791..15031eab56f32ceed5aa8742f5f2ab10b210de0d 100644 (file)
@@ -91,7 +91,7 @@ void print_sw(char *, struct swit *, char *, FILE *);
 void print_version(char *);
 void push(void);
 char *pwd(void);
-char *r1bindex(char *, int);
+char *mhbasename(char *);
 void readconfig(struct node **, FILE *, char *, int);
 int refile(char **, char *);
 void ruserpass(char *, char **, char **);
index 0cb7488a19cdd09e8a2a4c4431351388cc79de71..ad54a951c235b7de7ca2745e602ea66b00bc7160 100644 (file)
@@ -67,7 +67,7 @@ SRCS = addrsbr.c ambigsw.c atooi.c brkstring.c  \
        makedir.c mts.c norm_charmap.c  \
        path.c peekc.c pidwait.c pidstatus.c  \
        print_help.c print_sw.c print_version.c push.c  \
-       putenv.c refile.c r1bindex.c  \
+       putenv.c refile.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  \
index db7bcec8101340e2a397dc8efadd2dc4e5c26a29..a4b093431271038fe10aa6fb1b8de4e705cd58e1 100644 (file)
@@ -29,7 +29,7 @@ ext_hook(char *hook_name, char *message_file_name_1, char *message_file_name_2)
                break;
 
        case 0:
-               vec[0] = r1bindex(hook, '/');
+               vec[0] = mhbasename(hook);
                vec[1] = message_file_name_1;
                vec[2] = message_file_name_2;
                vec[3] = (char *)0;
index 77131b127a6210fee69e2fd829b3682da2787ded..ac93068d4313e6f8f54b790bc68e6cf6b43ec53e 100644 (file)
@@ -54,7 +54,7 @@ folder_delmsgs(struct msgs *mp, int unlink_msgs, int nohook)
                vec[vecp] = NULL;
 
                fflush(stdout);
-               vec[0] = r1bindex(rmmproc, '/');
+               vec[0] = mhbasename(rmmproc);
 
                switch (pid = vfork()) {
                case -1:
index 17f7ad59d7e0d9b2d41fdae4b33c3e0968cb27e5..3749452b1e3128f6bbde2b6201b346203db246da 100644 (file)
@@ -15,7 +15,7 @@ m_backup(char *file)
        char *cp;
        static char buffer[BUFSIZ];
 
-       if ((cp = r1bindex(file, '/')) == file)
+       if ((cp = mhbasename(file)) == file)
                snprintf(buffer, sizeof(buffer), "%s%s", backup_prefix, cp);
        else
                snprintf(buffer, sizeof(buffer), "%.*s%s%s", (int)(cp - file),
index c0c1a9c7525e1e14c6b75355c16962f429a1209a..68f1a54e6146fcefb641f3a19b85bcb9b28e9d46 100644 (file)
@@ -119,7 +119,7 @@ m_mktemp2(
                return m_mktemp(buffer, fd_ret, fp_ret);
        }
 
-       if ((cp = r1bindex((char *)dir_in, '/')) == dir_in) {
+       if ((cp = mhbasename((char *)dir_in)) == dir_in) {
                /* No directory component */
                return m_mktemp(pfx_in, fd_ret, fp_ret);
        }
diff --git a/sbr/mhbasename.c b/sbr/mhbasename.c
new file mode 100644 (file)
index 0000000..038e506
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+** mhbasename.c -- Given a path name, return a pointer to the character
+**              -- after the last slash. If none present, return the the
+**              -- beginning of the path.
+**
+** 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>
+
+
+/*
+**  Note: In contrast to POSIX basename(), we don't handle trailing
+**  slashes special. If path has a trailing slash, we return a pointer
+**  to a null byte (i.e. to an empty string). Also different: We don't
+**  modify the original string neither do we return a pointer to static
+**  memory.
+*/
+char *
+mhbasename(char *path)
+{
+       char *cp;
+
+       if (!path) {
+               return NULL;
+       }
+       cp = strrchr(path, '/');
+       return (!cp) ? path : ++cp;
+       
+}
diff --git a/sbr/r1bindex.c b/sbr/r1bindex.c
deleted file mode 100644 (file)
index 49ac0f5..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-** r1bindex.c -- Given a string and a character, return a pointer
-**            -- to the right of the rightmost occurrence of the
-**            -- character.  If the character doesn't occur, the
-**            -- pointer will be at the beginning of the string.
-**
-** 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 *
-r1bindex(char *str, int chr)
-{
-       char *cp;
-
-       /* find null at the end of the string */
-       for (cp = str; *cp; cp++)
-               continue;
-
-       /* backup to the rightmost character */
-       --cp;
-
-       /* now search for the rightmost occurrence of the character */
-       while (cp >= str && *cp != chr)
-               --cp;
-
-       /* now move one to the right */
-       return (++cp);
-}
index 21d933c5444a6371707e413a930c7e3140047aa3..00647ddd1463dbda1d0ce388e1f930b59b755361 100644 (file)
@@ -18,7 +18,7 @@ refile(char **arg, char *file)
        char *vec[MAXARGS];
 
        vecp = 0;
-       vec[vecp++] = r1bindex(fileproc, '/');
+       vec[vecp++] = mhbasename(fileproc);
        vec[vecp++] = "-nolink";  /* override bad .mh_profile defaults */
        vec[vecp++] = "-nopreserve";
        vec[vecp++] = "-file";
index c0d3608bee79afa819c4f0530695a88440081715..3f23801f076f16aac3e6c6f5504beb46107e4e7d 100644 (file)
@@ -24,7 +24,7 @@ showfile(char **arg, char *file)
        ** then really invoked the mhlproc instead
        ** (which is usually mhl anyway).
        */
-       if (!strcmp(r1bindex(lproc, '/'), "mhl"))
+       if (!strcmp(mhbasename(lproc), "mhl"))
                lproc = mhlproc;
 
        switch (pid = vfork()) {
@@ -36,7 +36,7 @@ showfile(char **arg, char *file)
        case 0:
                /* child */
                vecp = 0;
-               vec[vecp++] = r1bindex(lproc, '/');
+               vec[vecp++] = mhbasename(lproc);
                isdraft = 1;
                if (arg) {
                        while (*arg) {
index 6b9dbf5f718f030687219ce2982b18a9cf9b142e..a4ab2950650960e599fde1c25233786d43d5e171 100644 (file)
--- a/uip/ali.c
+++ b/uip/ali.c
@@ -64,7 +64,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index a2cfc849b87cf83af5107939e9e5dedeedcbbafc..b7c15636777fd1bbbcc41e8e636898fea18937ec 100644 (file)
@@ -99,7 +99,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 41e990a1824a475bc8abf7244669bc866c811b61..b835acb9491793dd3e53fb4f1c92f41b9de23459 100644 (file)
--- a/uip/ap.c
+++ b/uip/ap.c
@@ -63,7 +63,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 374eff52c823b4b95aafc9f99c978cc371649dcf..a8f42d0cf3c56c5a80a92fafd32a5b825d53967b 100644 (file)
@@ -56,7 +56,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 83b002a3e08439dd08809f4b31e38ea059f5a745..7a4936296e6ac5da9e0e7d8dcac9b184b02383e2 100644 (file)
@@ -64,7 +64,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 909bbc8fd9aa5bc5321f6248560ea855353e632e..5710aab8cb7f45703df1bef489cc35b1e9dab10c 100644 (file)
@@ -68,7 +68,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* foil search of user profile/context */
        if (context_foil(NULL) == -1)
@@ -360,7 +360,7 @@ setup(void)
                                                dup2(fd, 1);
                                                close(fd);
                                        }
-                               execlp(mailproc, r1bindex (mailproc, '/'),
+                               execlp(mailproc, mhbasename(mailproc),
                                                mail, "-subject", invo_name,
                                                NULL);
                                adios(mailproc, "unable to exec ");
index 89315c2cbbd8abe5a41fca824bf86136d9355ad2..5ff0d6cf90ccb8af90446d1237e15f15fc883adc 100644 (file)
@@ -53,7 +53,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 878e2c1c64c7f0f69a3a9bb9a602586e0b8f617b..a5accf53f19031c9b68f8b48ac753221155f8fc2 100644 (file)
--- a/uip/dp.c
+++ b/uip/dp.c
@@ -57,7 +57,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index a857a1a86d5b2e3e42077327103fbe20c46046a0..15cee8fb3d16abb9c8edb8852eaea7747b44b812 100644 (file)
@@ -486,7 +486,7 @@ map_name(char *file)
        register char *cp, *dp;
        static char buffer[BUFSIZ];
 
-       if ((dp = strchr(cp = r1bindex(file, '/'), '.')) == NULL)
+       if ((dp = strchr(cp = mhbasename(file), '.')) == NULL)
                dp = cp + strlen(cp);
        if (cp == file)
                snprintf(buffer, sizeof(buffer), ".%.*s%s",
index a86d226c8430ad3dc592a341bad879f3b4e7b662..4bf3f82ccbf6d73a03215eb9b0f72c8c949ba5ed 100644 (file)
@@ -128,7 +128,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 2096c64454a469f0de3338b4f4e7a42dbec0cd15..adda2944933b402a9bf23d7aeeba8d94b103353b 100644 (file)
@@ -52,7 +52,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index ac931ce349592456c7d4b95aa2666292daf08b10..25ab068c4d26c02e52ec5c2131bf178ec3e7a4d6 100644 (file)
@@ -122,7 +122,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 9ad2877119e9105686f07c350952fa539fb5bfb1..13aaaa9992e03a085f3c415b448a0317482e3271 100644 (file)
@@ -109,7 +109,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
@@ -385,7 +385,7 @@ mhl_draft(int out, char *digest, int volume, int issue,
        if (pipe(pd) == NOTOK)
                adios("pipe", "unable to create");
 
-       vec[0] = r1bindex(mhlproc, '/');
+       vec[0] = mhbasename(mhlproc);
 
        for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
                sleep(5);
index 186312ed681306b01ba12287f6e0b1170c9f61ff..c06c57c827727a348252440501e270ce61a3b7da 100644 (file)
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -163,7 +163,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 50854f0c3b3bc68a2e76bb5a21147c192a799611..11f7bc566858af8b37493041d23b001a424ff04b 100644 (file)
@@ -43,7 +43,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
        arguments = getarguments(invo_name, argc, argv, 0);
        argp = arguments;
 
index bdd02ade9fe1ec188a915585ba7dd6090d54ad0a..fa5c2cba64d77246c17f440b27b7ad9ac29db5e9 100644 (file)
@@ -59,7 +59,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index e1ca05fbb5147453a767075ee534c33d58be0dde..735a77e1b59d3a09623cb7aa7fd48345b27a7d55 100644 (file)
@@ -130,7 +130,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 9ec8f5d9983f8a5dbb8d20dc91632e7dac6924c9..f33e39b0470fc844acca676af60e8f1fc204c61c 100644 (file)
@@ -131,7 +131,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 2b32b643c348cf4439ac732a73796dadd370498c..7830173be9830d4d21e18f5631a6221102804181 100644 (file)
@@ -171,7 +171,7 @@ list_content(CT ct, int toplevel, int realsize, int verbose, int debug)
        CI ci = &ct->c_ctinfo;
 
        printf(toplevel > 0 ? LSTFMT2a : toplevel < 0 ? "part " : "     ",
-                       atoi(r1bindex(empty(ct->c_file), '/')));
+                       atoi(mhbasename(empty(ct->c_file))));
        snprintf(buffer, sizeof(buffer), "%s/%s", empty(ci->ci_type),
                        empty(ci->ci_subtype));
        printf(LSTFMT2b, empty(ct->c_partno), buffer);
index c4e822b364fa61fc347b68e93b204508d3e27ad4..ded61947260973d8b15792e1ab1abe666dfa13a3 100644 (file)
@@ -300,7 +300,7 @@ mhl(int argc, char **argv)
        char buf[BUFSIZ], *files[MAXARGS];
        char **argp, **arguments;
 
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
@@ -1622,7 +1622,7 @@ doface(struct mcomp *c1)
                                close(pdo[1]);
                        }
                        vecp = 0;
-                       vec[vecp++] = r1bindex(faceproc, '/');
+                       vec[vecp++] = mhbasename(faceproc);
                        vec[vecp++] = "-e";
                        if (sleepsw != NOTOK) {
                                vec[vecp++] = "-s";
@@ -1790,7 +1790,7 @@ m_popen(char *name)
                                dup2(pd[0], fileno(stdin));
                                close(pd[0]);
                        }
-                       execlp(name, r1bindex(name, '/'), NULL);
+                       execlp(name, mhbasename(name), NULL);
                        fprintf(stderr, "unable to exec ");
                        perror(name);
                        _exit(-1);
index c7a7afafc53b341f72b488a5ed91ab5f18c62732..037246ddeb68c60c4919832b3d8f627011a19f41 100644 (file)
@@ -54,7 +54,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* foil search of user profile/context */
        if (context_foil(NULL) == -1)
@@ -62,7 +62,7 @@ main(int argc, char **argv)
 
        /* If no arguments, just incorporate new mail */
        if (argc == 1) {
-               execlp(incproc, r1bindex(incproc, '/'), NULL);
+               execlp(incproc, mhbasename(incproc), NULL);
                adios(incproc, "unable to exec");
        }
 
@@ -160,7 +160,7 @@ main(int argc, char **argv)
        fclose(out);
 
        nvec = 0;
-       vec[nvec++] = r1bindex(postproc, '/');
+       vec[nvec++] = mhbasename(postproc);
        vec[nvec++] = tmpfil;
        if (resent)
                vec[nvec++] = "-dist";
index 575c7a7a8a1ef8dda45a0375809a6b9a645b97cd..5bbd9fcdc7a0eecbfc145198f3cb227bb9bb073e 100644 (file)
@@ -84,7 +84,7 @@ main(int argc, char **argv)
        char *cp, buf[BUFSIZ], **argp;
        char **arguments, *comps[MAXARGS];
 
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index db6f0ad92449f5427601c51aceaa885c3ff04252..6553ac35ff8c6f83055544310bb0b2abfb805062 100644 (file)
@@ -946,11 +946,11 @@ bad_quote:
                        /*
                        ** If there is a Content-Disposition header and
                        ** it doesn't have a *filename=, extract it from
-                       ** the magic contents.  The r1bindex call skips
+                       ** the magic contents.  The mhbasename call skips
                        ** any leading directory components.
                        */
                        if (ct->c_dispo)
-                               ct->c_dispo = incl_name_value(ct->c_dispo, "filename", r1bindex(extract_name_value("name", ci->ci_magic), '/'));
+                               ct->c_dispo = incl_name_value(ct->c_dispo, "filename", mhbasename(extract_name_value("name", ci->ci_magic)));
                        } else
                                advise(NULL, "extraneous information in message %s's %s: field\n%*.*s(%s)", ct->c_file, TYPE_FIELD, i, i, "", cp);
        }
@@ -2603,7 +2603,7 @@ openFTP(CT ct, char **file)
                char *vec[9];
 
                vecp = 0;
-               vec[vecp++] = r1bindex(ftp, '/');
+               vec[vecp++] = mhbasename(ftp);
                vec[vecp++] = e->eb_site;
                vec[vecp++] = user;
                vec[vecp++] = pass;
@@ -2757,7 +2757,7 @@ openMail(CT ct, char **file)
                return NOTOK;
 
        vecp = 0;
-       vec[vecp++] = r1bindex(mailproc, '/');
+       vec[vecp++] = mhbasename(mailproc);
        vec[vecp++] = e->eb_server;
        vec[vecp++] = "-subject";
        vec[vecp++] = e->eb_subject ? e->eb_subject : "mail-server request";
index 6f53aba6a4c4ac82ad9fe59b0509d6b418106a30..bce976ddeda8ebaba48e74a48c128188e39dcbf5 100644 (file)
@@ -30,7 +30,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index ea66f32a8a3a4048cc9382d057bc9e856d99c0af..ba5c037e18ab8403a230b73733fd5af17c6ec1e2 100644 (file)
@@ -147,7 +147,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index f79d42e6bdcccc91f7656ff6423ae89d2ce0610a..0a527ad7122ce0f9d5be2f0bac4ac647c96376d1 100644 (file)
@@ -200,7 +200,7 @@ DisplayMsgHeader(CT ct, char *form)
        char *vec[8];
 
        vecp = 0;
-       vec[vecp++] = r1bindex(mhlproc, '/');
+       vec[vecp++] = mhbasename(mhlproc);
        vec[vecp++] = "-form";
        vec[vecp++] = form;
        vec[vecp++] = "-nobody";
index dd5f51788989a7bdf511d905a96830aff13a5e1d..7be916328f9628e8a8077fb14344f2c30e2b47c3 100644 (file)
@@ -125,7 +125,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 8b2dc00ae246e04bbc77ffcc8f7e7fd05c2981de..027dac659f9e08daa09b166a75ecacd32c286674 100644 (file)
@@ -952,7 +952,7 @@ parse_format_string(CT ct, char *cp, char *buffer, int buflen, char *dir)
 
                                case 'm':
                                        /* insert message number */
-                                       snprintf(bp, buflen, "%s", r1bindex(ct->c_file, '/'));
+                                       snprintf(bp, buflen, "%s", mhbasename(ct->c_file));
                                        break;
 
                                case 'P':
index 621c701dabf3c50eda1222ae8ea7402002deb98d..17ca1ab78b5e330e4dcfb1c71d6254ed22fe632b 100644 (file)
@@ -127,7 +127,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index ffde2b49ea07c29a9bf72838a403ed2463efd04f..7b29b54c6a5e6ee8a6311db55822ed6c1b9b3eb6 100644 (file)
@@ -68,7 +68,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 92366623e2d69fcc66549d2eee71ae2299cf0ac7..c1ae0cc5663556fd86e7e876fd9579862a2fe4a9 100644 (file)
--- a/uip/new.c
+++ b/uip/new.c
@@ -436,7 +436,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
@@ -475,7 +475,7 @@ main(int argc, char **argv)
                                if (!(invo_name = *argp++) || *invo_name == '-')
                                        adios(NULL, "missing argument to %s",
                                                        argp[-2]);
-                               invo_name = r1bindex(invo_name, '/');
+                               invo_name = mhbasename(invo_name);
                                continue;
                        }
                }
index 14ecdaaf4fa9e997c43a8028da52e32776fcfa0b..d4df05cf949243efceaa07eaac4c82c485b7dcec 100644 (file)
@@ -50,7 +50,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 040ebecdc2bd31c87dacb897989c0c861de6f65a..93a240068b4044069aee161b1ad1f608e35b1f16 100644 (file)
@@ -84,7 +84,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index a75c563313d5c2b954a62dc03053bdd08dad5eeb..5b2131ce00fc3ab2587d32ec7394ae0937b6ba91 100644 (file)
@@ -110,7 +110,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 62ae2a85cac3d070f9068a90f565e2d291bc3dfb..24cf48b718a5b99b00e99e4da2cba23b6cdddffc 100644 (file)
@@ -49,7 +49,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
@@ -107,7 +107,7 @@ main(int argc, char **argv)
        if (distout(drft, tmpfil, backup) == NOTOK)
                done(1);
 
-       vec[0] = r1bindex(postproc, '/');
+       vec[0] = mhbasename(postproc);
        vec[vecp++] = "-dist";
        vec[vecp++] = drft;
        vec[vecp] = NULL;
index e8934ca2d23300dc7c574aa0e799f6c4d49d4935..84fcc26d5689e0ce124f6c9dab916004f3d88603 100644 (file)
@@ -40,7 +40,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 868ed47b111702875102385647599aec9dc071d8..06b8b694d69049fcc08800e101fbe05a9b89b793 100644 (file)
@@ -63,7 +63,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 1e2a3efcc0ffc33d44a601428b913aff07fbdf8d..20274e76b4e10e406c85fb88efbefc76f479fb97 100644 (file)
@@ -99,7 +99,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index b24e42ebf12b777cd3aa49f9e6ea628a10d095d4..a79e8be8128f195742e40e703a587adc9cfff4c3 100644 (file)
@@ -73,7 +73,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
@@ -335,7 +335,7 @@ remove_files(int filep, char **files)
                files[filep] = NULL;  /* NULL terminate list */
 
                fflush(stdout);
-               vec[0] = r1bindex(rmmproc, '/');
+               vec[0] = mhbasename(rmmproc);
                execvp(rmmproc, vec);
                adios(rmmproc, "unable to exec");
        }
index 6893f56986879f7eb60d1167a15bb013e6f7febe..61ba08cfe50a71954c74f3091dc452dafc25531d 100644 (file)
@@ -121,7 +121,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index e26badd112fffca4fae68e29400de5f04e00272f..1bdab9e92be631660525f0b52a9f922a14872a37 100644 (file)
@@ -436,7 +436,7 @@ replfilter(FILE *in, FILE *out, char *filter)
        if (access(filter, R_OK) == NOTOK)
                adios(filter, "unable to read");
 
-       mhl = r1bindex(mhlproc, '/');
+       mhl = mhbasename(mhlproc);
 
        rewind(in);
        lseek(fileno(in), (off_t) 0, SEEK_SET);
index fff4abb72aea33b27fcc4d581d0968cc8d78f46b..71fd017ff3e83f0d017c5da3ed8e6e8515f3cf6b 100644 (file)
--- a/uip/rmf.c
+++ b/uip/rmf.c
@@ -37,7 +37,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index f8a1d236ace03b57b058cffa5580ee2f1205f8c9..7f773401009120fb8624d475f9def18ecc7621c1 100644 (file)
--- a/uip/rmm.c
+++ b/uip/rmm.c
@@ -35,7 +35,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 03a260bdb8a35ec330dc9184807e213a9a147675..b42d8a2671f3454a0d82254a2ecb4d0fe5a52512 100644 (file)
@@ -73,7 +73,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index 2416baf99f487e3dfa05b43669f18ccc1ab0769f..f7771558cf71c966a2215ea209dd0a8a6e0eb634 100644 (file)
@@ -118,7 +118,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
@@ -361,7 +361,7 @@ main(int argc, char **argv)
                push();
 
        status = 0;
-       vec[0] = r1bindex(postproc, '/');
+       vec[0] = mhbasename(postproc);
        closefds(3);
 
        for (msgnum = 0; msgnum < msgp; msgnum++) {
index c7f4d447238ea7fc1c530607bdd55c98af742fd6..4670345c7bb95d28bb7e283350032afa356fc49f 100644 (file)
@@ -709,7 +709,7 @@ alert(char *file, int out)
                        snprintf(buf, sizeof(buf), "send failed on %s",
                                        forwsw ? "enclosed draft" : file);
 
-                       execlp(mailproc, r1bindex(mailproc, '/'),
+                       execlp(mailproc, mhbasename(mailproc),
                                        getusername(), "-subject", buf, NULL);
                        fprintf(stderr, "unable to exec ");
                        perror(mailproc);
index f536af7cfb02da047558b7993a9966a04de96530..b19f7627092d6ba009aacb8f3ff5028f9be14acf 100644 (file)
@@ -71,7 +71,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
@@ -301,7 +301,7 @@ go_to_it: ;
        ** then add "-show" option.  Add "-file" if showing
        ** file.
        */
-       if (strcmp(r1bindex(proc, '/'), "mhn") == 0) {
+       if (strcmp(mhbasename(proc), "mhn") == 0) {
                if (file) {
                        vec[vecp] = vec[vecp - 1];
                        vec[vecp - 1] = "-file";
@@ -312,7 +312,7 @@ go_to_it: ;
        }
 
        /* If the "proc" is "mhshow", add "-file" if showing file.  */
-       if (strcmp(r1bindex(proc, '/'), "mhshow") == 0 && file ) {
+       if (strcmp(mhbasename(proc), "mhshow") == 0 && file ) {
           vec[vecp] = vec[vecp - 1];
           vec[vecp - 1] = "-file";
           vec[++vecp] = NULL;
@@ -322,7 +322,7 @@ go_to_it: ;
        ** If "proc" is mhl, then run it internally
        ** rather than exec'ing it.
        */
-       if (strcmp(r1bindex(proc, '/'), "mhl") == 0) {
+       if (strcmp(mhbasename(proc), "mhl") == 0) {
                vec[0] = "mhl";
                mhl(vecp, vec);
                done(0);
@@ -333,7 +333,7 @@ go_to_it: ;
        ** add the path to the message names.  Currently, we are just
        ** checking for mhn here, since we've already taken care of mhl.
        */
-       if (!strcmp(r1bindex(proc, '/'), "mhl")
+       if (!strcmp(mhbasename(proc), "mhl")
                        && !file
                        && chdir(maildir =
                        concat(m_maildir(""), "/", NULL)) != NOTOK) {
@@ -345,7 +345,7 @@ go_to_it: ;
                        vec[msgnum] = concat(cp, vec[msgnum], NULL);
        }
 
-       vec[0] = r1bindex(proc, '/');
+       vec[0] = mhbasename(proc);
        execvp(proc, vec);
        adios(proc, "unable to exec");
        return 0;  /* dead code to satisfy the compiler */
index 2e7c257c7b7979c6c4af6eee4f8f4287777cace3..8b8d554cfb2ee0be7947d757eef6c28a058f9f6c 100644 (file)
@@ -214,7 +214,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(*argv, '/');
+       invo_name = mhbasename(*argv);
 
        /* foil search of user profile/context */
        if (context_foil(NULL) == -1)
index a5d0e118cb164fb8fac30aa06ea75f5a74294c03..ffe14f864b207a4109aef09e137a06ec2f5f0305 100644 (file)
@@ -78,7 +78,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
index e87fcf1c26f80104a9526bc57917bc6253df8915..0679ac6bb6fa20a637d4cdfad1c68dc85376ca66 100644 (file)
@@ -202,7 +202,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* foil search of user profile/context */
        if (context_foil(NULL) == -1)
@@ -795,7 +795,7 @@ make_bcc_file(void)
                cpydgst(fd, fileno(out), tmpfil, bccfil);
                close(fd);
        } else {
-               vec[0] = r1bindex(mhlproc, '/');
+               vec[0] = mhbasename(mhlproc);
 
                for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
                        sleep(5);
@@ -871,7 +871,7 @@ fcc(char *file, char *folder)
                case OK:
                        snprintf(fold, sizeof(fold), "%s%s",
                                *folder == '+' || *folder == '@' ? "" : "+", folder);
-                       execlp(fileproc, r1bindex(fileproc, '/'),
+                       execlp(fileproc, mhbasename(fileproc),
                                "-link", "-file", file, fold, NULL);
                        _exit(-1);
 
index bbae08b4bb71d113166f683d3a0cdb9d2f81db4d..3fff44a49023ab9d8246fa22dd81348c4fe54865 100644 (file)
@@ -75,7 +75,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* foil search of user profile/context */
        if (context_foil(NULL) == -1)
@@ -218,7 +218,7 @@ via_mail(char *mailsw, char *subjsw, char *parmsw, char *descsw,
                adios("failed", "fstat of %s", tmpfil);
 
        status = 0;
-       vec[0] = r1bindex(postproc, '/');
+       vec[0] = mhbasename(postproc);
        if (verbsw)
                vec[vecp++] = "-verbose";
 
index 583f133c87725874593f5b931ec43e0a8d4dca87..8d6830e4c9aecae73c8b16d0c9261613b95e2f34 100644 (file)
@@ -32,7 +32,7 @@ what_now(char *ed, int nedit, int use, char *file, char *altmsg, int dist,
        char buffer[BUFSIZ], *vec[MAXARGS];
 
        vecp = 0;
-       vec[vecp++] = r1bindex(whatnowproc, '/');
+       vec[vecp++] = mhbasename(whatnowproc);
        vec[vecp] = NULL;
 
        m_putenv("mhdraft", file);
index 5a31a903ee05d2907dd6817185bc99faa342a0c9..a5f8839906f20742134f1998ad00b6ecfa56a20b 100644 (file)
@@ -136,7 +136,7 @@ WhatNow(int argc, char **argv)
        char *l;  /* set on -l to alist  command */
        int n;  /* set on -n to alist command */
 
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
@@ -651,7 +651,7 @@ editfile(char **ed, char **arg, char *file, int use, struct msgs *mp,
        if (reedit) {
                if (!*ed) {  /* no explicit editor */
                        *ed = edsave;  /* so use the previous one */
-                       if ((cp = r1bindex(*ed, '/')) == NULL)
+                       if ((cp = mhbasename(*ed)) == NULL)
                                cp = *ed;
 
                        /* unless we've specified it via "editor-next" */
@@ -719,7 +719,7 @@ editfile(char **ed, char **arg, char *file, int use, struct msgs *mp,
                        }
 
                        vecp = 0;
-                       vec[vecp++] = r1bindex(*ed, '/');
+                       vec[vecp++] = mhbasename(*ed);
                        if (arg)
                                while (*arg)
                                        vec[vecp++] = *arg++;
@@ -734,7 +734,7 @@ editfile(char **ed, char **arg, char *file, int use, struct msgs *mp,
                default:
                        if ((status = pidwait(pid, NOTOK))) {
 #ifdef ATTVIBUG
-                               if ((cp = r1bindex(*ed, '/')) &&
+                               if ((cp = mhbasename(*ed)) &&
                                                strcmp(cp, "vi") == 0 &&
                                                (status & 0x00ff) == 0)
                                        status = 0;
@@ -845,7 +845,7 @@ sendfile(char **arg, char *file, int pushsw)
        ** If the sendproc is the nmh command `send', then we call
        ** those routines directly rather than exec'ing the command.
        */
-       if (strcmp(sp = r1bindex(sendproc, '/'), "send") == 0) {
+       if (strcmp(sp = mhbasename(sendproc), "send") == 0) {
                cp = invo_name;
                sendit(invo_name = sp, arg, file, pushsw);
                invo_name = cp;
@@ -909,7 +909,7 @@ buildfile(char **argp, char *file)
        ** if we are using mhn as buildmimeproc
        */
        i = 0;
-       if (strcmp(r1bindex(ed, '/'), "mhn") == 0)
+       if (strcmp(mhbasename(ed), "mhn") == 0)
                args[i++] = "-build";
 
        /* copy any other arguments */
@@ -1292,7 +1292,7 @@ sendit(char *sp, char **arg, char *file, int pushed)
        if ((pushsw = pushed))
                push();
 
-       vec[0] = r1bindex(postproc, '/');
+       vec[0] = mhbasename(postproc);
        closefds(3);
 
        if (sendsbr(vec, vecp, file, &st, 1, attach, attachformat) == OK)