Include <unistd.h> unilaterally.
[bpt/emacs.git] / lib-src / movemail.c
index 541edf5..8c6a0dd 100644 (file)
@@ -63,9 +63,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <time.h>
 
 #include <getopt.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
@@ -147,11 +145,11 @@ static char *mail_spool_name ();
 char *strerror (int);
 #endif
 
-static void fatal (char *s1, char *s2, char *s3);
-static void error (char *s1, char *s2, char *s3);
-static void pfatal_with_name (char *name);
-static void pfatal_and_delete (char *name);
-static char *concat (char *s1, char *s2, char *s3);
+static void fatal (const char *s1, const char *s2, const char *s3) NO_RETURN;
+static void error (const char *s1, const char *s2, const char *s3);
+static void pfatal_with_name (char *name) NO_RETURN;
+static void pfatal_and_delete (char *name) NO_RETURN;
+static char *concat (const char *s1, const char *s2, const char *s3);
 static long *xmalloc (unsigned int size);
 #ifdef MAIL_USE_POP
 static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order);
@@ -169,7 +167,7 @@ main (int argc, char **argv)
 {
   char *inname, *outname;
   int indesc, outdesc;
-  int nread;
+  ssize_t nread;
   int status;
   int c, preserve_mail = 0;
 
@@ -551,8 +549,7 @@ main (int argc, char **argv)
    string-comparing the two paths, because one or both of them might
    be symbolic links pointing to some other directory. */
 static char *
-mail_spool_name (inname)
-     char *inname;
+mail_spool_name (char *inname)
 {
   struct stat stat1, stat2;
   char *indir, *fname;
@@ -589,7 +586,7 @@ mail_spool_name (inname)
 /* Print error message and exit.  */
 
 static void
-fatal (char *s1, char *s2, char *s3)
+fatal (const char *s1, const char *s2, const char *s3)
 {
   if (delete_lockname)
     unlink (delete_lockname);
@@ -601,7 +598,7 @@ fatal (char *s1, char *s2, char *s3)
    are args for it or null. */
 
 static void
-error (char *s1, char *s2, char *s3)
+error (const char *s1, const char *s2, const char *s3)
 {
   fprintf (stderr, "movemail: ");
   if (s3)
@@ -630,9 +627,9 @@ pfatal_and_delete (char *name)
 /* Return a newly-allocated string whose contents concatenate those of s1, s2, s3.  */
 
 static char *
-concat (char *s1, char *s2, char *s3)
+concat (const char *s1, const char *s2, const char *s3)
 {
-  int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
+  size_t len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
   char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
 
   strcpy (result, s1);