simplify whatnow.c/main() function
[mmh] / sbr / folder_addmsg.c
index 391f5c8..e14c709 100644 (file)
@@ -6,9 +6,11 @@
 ** complete copyright information.
 */
 
+#include <unistd.h>
 #include <h/mh.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <sys/stat.h>
 
 /*
 ** Link message into a folder.  Return the new number
@@ -85,20 +87,6 @@ folder_addmsg(struct msgs **mpp, char *msgfile, int selected,
                /* should we set the SELECTED bit? */
                if (selected) {
                        set_selected(mp, msgnum);
-
-                       /* check if highest or lowest selected */
-                       if (mp->numsel == 0) {
-                               mp->lowsel = msgnum;
-                               mp->hghsel = msgnum;
-                       } else {
-                               if (msgnum < mp->lowsel)
-                                       mp->lowsel = msgnum;
-                               if (msgnum > mp->hghsel)
-                                       mp->hghsel = msgnum;
-                       }
-
-                       /* increment number selected */
-                       mp->numsel++;
                }
 
                /*
@@ -136,17 +124,12 @@ folder_addmsg(struct msgs **mpp, char *msgfile, int selected,
                                                from_dir, msgfile);
                                ext_hook("ref-hook", oldmsg, newmsg);
                        } else
-                               ext_hook("add-hook", newmsg, (char *)0);
+                               ext_hook("add-hook", newmsg, NULL);
 
                        return msgnum;
                } else {
                        linkerr = errno;
 
-#ifdef EISREMOTE
-                       if (linkerr == EISREMOTE)
-                               linkerr = EXDEV;
-#endif /* EISREMOTE */
-
                        /*
                        ** Check if the file in our desired location is
                        ** the same as the source file.  If so, then just
@@ -195,7 +178,7 @@ folder_addmsg(struct msgs **mpp, char *msgfile, int selected,
                                                                msgfile);
                                                ext_hook("ref-hook", oldmsg, newmsg);
                                        } else
-                                               ext_hook("add-hook", newmsg, (char *)0);
+                                               ext_hook("add-hook", newmsg, NULL);
 
                                        return msgnum;
                                }