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 6200ea6..15031ea 100644 (file)
@@ -91,7 +91,7 @@ void print_sw(char *, struct swit *, char *, FILE *);
 void print_version(char *);
 void push(void);
 char *pwd(void);
 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 **);
 void readconfig(struct node **, FILE *, char *, int);
 int refile(char **, char *);
 void ruserpass(char *, char **, char **);
index 0cb7488..ad54a95 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  \
        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  \
        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 db7bcec..a4b0934 100644 (file)
@@ -29,7 +29,7 @@ ext_hook(char *hook_name, char *message_file_name_1, char *message_file_name_2)
                break;
 
        case 0:
                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;
                vec[1] = message_file_name_1;
                vec[2] = message_file_name_2;
                vec[3] = (char *)0;
index 77131b1..ac93068 100644 (file)
@@ -54,7 +54,7 @@ folder_delmsgs(struct msgs *mp, int unlink_msgs, int nohook)
                vec[vecp] = NULL;
 
                fflush(stdout);
                vec[vecp] = NULL;
 
                fflush(stdout);
-               vec[0] = r1bindex(rmmproc, '/');
+               vec[0] = mhbasename(rmmproc);
 
                switch (pid = vfork()) {
                case -1:
 
                switch (pid = vfork()) {
                case -1:
index 17f7ad5..3749452 100644 (file)
@@ -15,7 +15,7 @@ m_backup(char *file)
        char *cp;
        static char buffer[BUFSIZ];
 
        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),
                snprintf(buffer, sizeof(buffer), "%s%s", backup_prefix, cp);
        else
                snprintf(buffer, sizeof(buffer), "%.*s%s%s", (int)(cp - file),
index c0c1a9c..68f1a54 100644 (file)
@@ -119,7 +119,7 @@ m_mktemp2(
                return m_mktemp(buffer, fd_ret, fp_ret);
        }
 
                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);
        }
                /* 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 21d933c..00647dd 100644 (file)
@@ -18,7 +18,7 @@ refile(char **arg, char *file)
        char *vec[MAXARGS];
 
        vecp = 0;
        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";
        vec[vecp++] = "-nolink";  /* override bad .mh_profile defaults */
        vec[vecp++] = "-nopreserve";
        vec[vecp++] = "-file";
index c0d3608..3f23801 100644 (file)
@@ -24,7 +24,7 @@ showfile(char **arg, char *file)
        ** then really invoked the mhlproc instead
        ** (which is usually mhl anyway).
        */
        ** 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()) {
                lproc = mhlproc;
 
        switch (pid = vfork()) {
@@ -36,7 +36,7 @@ showfile(char **arg, char *file)
        case 0:
                /* child */
                vecp = 0;
        case 0:
                /* child */
                vecp = 0;
-               vec[vecp++] = r1bindex(lproc, '/');
+               vec[vecp++] = mhbasename(lproc);
                isdraft = 1;
                if (arg) {
                        while (*arg) {
                isdraft = 1;
                if (arg) {
                        while (*arg) {
index 6b9dbf5..a4ab295 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
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index a2cfc84..b7c1563 100644 (file)
@@ -99,7 +99,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 41e990a..b835acb 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
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 374eff5..a8f42d0 100644 (file)
@@ -56,7 +56,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 83b002a..7a49362 100644 (file)
@@ -64,7 +64,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 909bbc8..5710aab 100644 (file)
@@ -68,7 +68,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #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)
 
        /* foil search of user profile/context */
        if (context_foil(NULL) == -1)
@@ -360,7 +360,7 @@ setup(void)
                                                dup2(fd, 1);
                                                close(fd);
                                        }
                                                dup2(fd, 1);
                                                close(fd);
                                        }
-                               execlp(mailproc, r1bindex (mailproc, '/'),
+                               execlp(mailproc, mhbasename(mailproc),
                                                mail, "-subject", invo_name,
                                                NULL);
                                adios(mailproc, "unable to exec ");
                                                mail, "-subject", invo_name,
                                                NULL);
                                adios(mailproc, "unable to exec ");
index 89315c2..5ff0d6c 100644 (file)
@@ -53,7 +53,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 878e2c1..a5accf5 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
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index a857a1a..15cee8f 100644 (file)
@@ -486,7 +486,7 @@ map_name(char *file)
        register char *cp, *dp;
        static char buffer[BUFSIZ];
 
        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",
                dp = cp + strlen(cp);
        if (cp == file)
                snprintf(buffer, sizeof(buffer), ".%.*s%s",
index a86d226..4bf3f82 100644 (file)
@@ -128,7 +128,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 2096c64..adda294 100644 (file)
@@ -52,7 +52,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index ac931ce..25ab068 100644 (file)
@@ -122,7 +122,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 9ad2877..13aaaa9 100644 (file)
@@ -109,7 +109,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* 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");
 
        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);
 
        for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
                sleep(5);
index 186312e..c06c57c 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
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 50854f0..11f7bc5 100644 (file)
@@ -43,7 +43,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #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;
 
        arguments = getarguments(invo_name, argc, argv, 0);
        argp = arguments;
 
index bdd02ad..fa5c2cb 100644 (file)
@@ -59,7 +59,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index e1ca05f..735a77e 100644 (file)
@@ -130,7 +130,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 9ec8f5d..f33e39b 100644 (file)
@@ -131,7 +131,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 2b32b64..7830173 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 " : "     ",
        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);
        snprintf(buffer, sizeof(buffer), "%s/%s", empty(ci->ci_type),
                        empty(ci->ci_subtype));
        printf(LSTFMT2b, empty(ct->c_partno), buffer);
index c4e822b..ded6194 100644 (file)
@@ -300,7 +300,7 @@ mhl(int argc, char **argv)
        char buf[BUFSIZ], *files[MAXARGS];
        char **argp, **arguments;
 
        char buf[BUFSIZ], *files[MAXARGS];
        char **argp, **arguments;
 
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
@@ -1622,7 +1622,7 @@ doface(struct mcomp *c1)
                                close(pdo[1]);
                        }
                        vecp = 0;
                                close(pdo[1]);
                        }
                        vecp = 0;
-                       vec[vecp++] = r1bindex(faceproc, '/');
+                       vec[vecp++] = mhbasename(faceproc);
                        vec[vecp++] = "-e";
                        if (sleepsw != NOTOK) {
                                vec[vecp++] = "-s";
                        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]);
                        }
                                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);
                        fprintf(stderr, "unable to exec ");
                        perror(name);
                        _exit(-1);
index c7a7afa..037246d 100644 (file)
@@ -54,7 +54,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #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)
 
        /* 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) {
 
        /* 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");
        }
 
                adios(incproc, "unable to exec");
        }
 
@@ -160,7 +160,7 @@ main(int argc, char **argv)
        fclose(out);
 
        nvec = 0;
        fclose(out);
 
        nvec = 0;
-       vec[nvec++] = r1bindex(postproc, '/');
+       vec[nvec++] = mhbasename(postproc);
        vec[nvec++] = tmpfil;
        if (resent)
                vec[nvec++] = "-dist";
        vec[nvec++] = tmpfil;
        if (resent)
                vec[nvec++] = "-dist";
index 575c7a7..5bbd9fc 100644 (file)
@@ -84,7 +84,7 @@ main(int argc, char **argv)
        char *cp, buf[BUFSIZ], **argp;
        char **arguments, *comps[MAXARGS];
 
        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();
 
        /* read user profile/context */
        context_read();
index db6f0ad..6553ac3 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
                        /*
                        ** 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)
                        ** 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);
        }
                        } 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;
                char *vec[9];
 
                vecp = 0;
-               vec[vecp++] = r1bindex(ftp, '/');
+               vec[vecp++] = mhbasename(ftp);
                vec[vecp++] = e->eb_site;
                vec[vecp++] = user;
                vec[vecp++] = pass;
                vec[vecp++] = e->eb_site;
                vec[vecp++] = user;
                vec[vecp++] = pass;
@@ -2757,7 +2757,7 @@ openMail(CT ct, char **file)
                return NOTOK;
 
        vecp = 0;
                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";
        vec[vecp++] = e->eb_server;
        vec[vecp++] = "-subject";
        vec[vecp++] = e->eb_subject ? e->eb_subject : "mail-server request";
index 6f53aba..bce976d 100644 (file)
@@ -30,7 +30,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index ea66f32..ba5c037 100644 (file)
@@ -147,7 +147,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index f79d42e..0a527ad 100644 (file)
@@ -200,7 +200,7 @@ DisplayMsgHeader(CT ct, char *form)
        char *vec[8];
 
        vecp = 0;
        char *vec[8];
 
        vecp = 0;
-       vec[vecp++] = r1bindex(mhlproc, '/');
+       vec[vecp++] = mhbasename(mhlproc);
        vec[vecp++] = "-form";
        vec[vecp++] = form;
        vec[vecp++] = "-nobody";
        vec[vecp++] = "-form";
        vec[vecp++] = form;
        vec[vecp++] = "-nobody";
index dd5f517..7be9163 100644 (file)
@@ -125,7 +125,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 8b2dc00..027dac6 100644 (file)
@@ -952,7 +952,7 @@ parse_format_string(CT ct, char *cp, char *buffer, int buflen, char *dir)
 
                                case 'm':
                                        /* insert message number */
 
                                case 'm':
                                        /* insert message number */
-                                       snprintf(bp, buflen, "%s", r1bindex(ct->c_file, '/'));
+                                       snprintf(bp, buflen, "%s", mhbasename(ct->c_file));
                                        break;
 
                                case 'P':
                                        break;
 
                                case 'P':
index 621c701..17ca1ab 100644 (file)
@@ -127,7 +127,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index ffde2b4..7b29b54 100644 (file)
@@ -68,7 +68,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 9236662..c1ae0cc 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
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* 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]);
                                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;
                        }
                }
                                continue;
                        }
                }
index 14ecdaa..d4df05c 100644 (file)
@@ -50,7 +50,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 040ebec..93a2400 100644 (file)
@@ -84,7 +84,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index a75c563..5b2131c 100644 (file)
@@ -110,7 +110,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 62ae2a8..24cf48b 100644 (file)
@@ -49,7 +49,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
@@ -107,7 +107,7 @@ main(int argc, char **argv)
        if (distout(drft, tmpfil, backup) == NOTOK)
                done(1);
 
        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;
        vec[vecp++] = "-dist";
        vec[vecp++] = drft;
        vec[vecp] = NULL;
index e8934ca..84fcc26 100644 (file)
@@ -40,7 +40,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 868ed47..06b8b69 100644 (file)
@@ -63,7 +63,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 1e2a3ef..20274e7 100644 (file)
@@ -99,7 +99,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index b24e42e..a79e8be 100644 (file)
@@ -73,7 +73,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
@@ -335,7 +335,7 @@ remove_files(int filep, char **files)
                files[filep] = NULL;  /* NULL terminate list */
 
                fflush(stdout);
                files[filep] = NULL;  /* NULL terminate list */
 
                fflush(stdout);
-               vec[0] = r1bindex(rmmproc, '/');
+               vec[0] = mhbasename(rmmproc);
                execvp(rmmproc, vec);
                adios(rmmproc, "unable to exec");
        }
                execvp(rmmproc, vec);
                adios(rmmproc, "unable to exec");
        }
index 6893f56..61ba08c 100644 (file)
@@ -121,7 +121,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index e26badd..1bdab9e 100644 (file)
@@ -436,7 +436,7 @@ replfilter(FILE *in, FILE *out, char *filter)
        if (access(filter, R_OK) == NOTOK)
                adios(filter, "unable to read");
 
        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);
 
        rewind(in);
        lseek(fileno(in), (off_t) 0, SEEK_SET);
index fff4abb..71fd017 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
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index f8a1d23..7f77340 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
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 03a260b..b42d8a2 100644 (file)
@@ -73,7 +73,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index 2416baf..f777155 100644 (file)
@@ -118,7 +118,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
@@ -361,7 +361,7 @@ main(int argc, char **argv)
                push();
 
        status = 0;
                push();
 
        status = 0;
-       vec[0] = r1bindex(postproc, '/');
+       vec[0] = mhbasename(postproc);
        closefds(3);
 
        for (msgnum = 0; msgnum < msgp; msgnum++) {
        closefds(3);
 
        for (msgnum = 0; msgnum < msgp; msgnum++) {
index c7f4d44..4670345 100644 (file)
@@ -709,7 +709,7 @@ alert(char *file, int out)
                        snprintf(buf, sizeof(buf), "send failed on %s",
                                        forwsw ? "enclosed draft" : file);
 
                        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);
                                        getusername(), "-subject", buf, NULL);
                        fprintf(stderr, "unable to exec ");
                        perror(mailproc);
index f536af7..b19f762 100644 (file)
@@ -71,7 +71,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
@@ -301,7 +301,7 @@ go_to_it: ;
        ** then add "-show" option.  Add "-file" if showing
        ** file.
        */
        ** 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";
                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 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;
           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 "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);
                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.
        */
        ** 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) {
                        && !file
                        && chdir(maildir =
                        concat(m_maildir(""), "/", NULL)) != NOTOK) {
@@ -345,7 +345,7 @@ go_to_it: ;
                        vec[msgnum] = concat(cp, vec[msgnum], NULL);
        }
 
                        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 */
        execvp(proc, vec);
        adios(proc, "unable to exec");
        return 0;  /* dead code to satisfy the compiler */
index 2e7c257..8b8d554 100644 (file)
@@ -214,7 +214,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #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)
 
        /* foil search of user profile/context */
        if (context_foil(NULL) == -1)
index a5d0e11..ffe14f8 100644 (file)
@@ -78,7 +78,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
-       invo_name = r1bindex(argv[0], '/');
+       invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
        context_read();
 
        /* read user profile/context */
        context_read();
index e87fcf1..0679ac6 100644 (file)
@@ -202,7 +202,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #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)
 
        /* 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 {
                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);
 
                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);
                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);
 
                                "-link", "-file", file, fold, NULL);
                        _exit(-1);
 
index bbae08b..3fff44a 100644 (file)
@@ -75,7 +75,7 @@ main(int argc, char **argv)
 #ifdef LOCALE
        setlocale(LC_ALL, "");
 #endif
 #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)
 
        /* 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;
                adios("failed", "fstat of %s", tmpfil);
 
        status = 0;
-       vec[0] = r1bindex(postproc, '/');
+       vec[0] = mhbasename(postproc);
        if (verbsw)
                vec[vecp++] = "-verbose";
 
        if (verbsw)
                vec[vecp++] = "-verbose";
 
index 583f133..8d6830e 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;
        char buffer[BUFSIZ], *vec[MAXARGS];
 
        vecp = 0;
-       vec[vecp++] = r1bindex(whatnowproc, '/');
+       vec[vecp++] = mhbasename(whatnowproc);
        vec[vecp] = NULL;
 
        m_putenv("mhdraft", file);
        vec[vecp] = NULL;
 
        m_putenv("mhdraft", file);
index 5a31a90..a5f8839 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 */
 
        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();
 
        /* 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 (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" */
                                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;
                        }
 
                        vecp = 0;
-                       vec[vecp++] = r1bindex(*ed, '/');
+                       vec[vecp++] = mhbasename(*ed);
                        if (arg)
                                while (*arg)
                                        vec[vecp++] = *arg++;
                        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
                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;
                                                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 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;
                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 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 */
                args[i++] = "-build";
 
        /* copy any other arguments */
@@ -1292,7 +1292,7 @@ sendit(char *sp, char **arg, char *file, int pushed)
        if ((pushsw = pushed))
                push();
 
        if ((pushsw = pushed))
                push();
 
-       vec[0] = r1bindex(postproc, '/');
+       vec[0] = mhbasename(postproc);
        closefds(3);
 
        if (sendsbr(vec, vecp, file, &st, 1, attach, attachformat) == OK)
        closefds(3);
 
        if (sendsbr(vec, vecp, file, &st, 1, attach, attachformat) == OK)