(Glossary): Add an index entry leading to "cut and paste".
[bpt/emacs.git] / lib-src / fakemail.c
index d9af25d..588496a 100644 (file)
@@ -1,5 +1,5 @@
 /* sendmail-like interface to /bin/mail for system V,
-   Copyright (C) 1985, 1994 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1994, 1999 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -19,10 +19,13 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
 
+/* This is needed to get the declaration of cuserid in GNU libc.  */
+#define _XOPEN_SOURCE 1
+
 #define NO_SHORTNAMES
 #include <../src/config.h>
 
-#if defined (BSD) && !defined (BSD4_1) && !defined (USE_FAKEMAIL)
+#if defined (BSD_SYSTEM) && !defined (BSD4_1) && !defined (USE_FAKEMAIL)
 /* This program isnot used in BSD, so just avoid loader complaints.  */
 int
 main ()
@@ -45,13 +48,6 @@ main ()
 #undef static
 #endif
 
-#ifdef read
-#undef read
-#undef write
-#undef open
-#undef close
-#endif
-
 #ifdef WINDOWSNT
 #include "ntlib.h"
 #endif
@@ -61,6 +57,11 @@ main ()
 #include <ctype.h>
 #include <time.h>
 #include <pwd.h>
+
+/* This is to declare cuserid.  */
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 \f
 /* Type definitions */
 
@@ -223,7 +224,7 @@ readline (linebuffer, stream)
       if (p == end)
        {
          linebuffer->size *= 2;
-         buffer = ((char *) xrealloc (buffer, linebuffer->size));
+         buffer = ((char *) xrealloc ((long *)buffer, linebuffer->size));
          p = buffer + (p - linebuffer->buffer);
          end = buffer + linebuffer->size;
          linebuffer->buffer = buffer;
@@ -252,18 +253,18 @@ get_keyword (field, rest)
 {
   static char keyword[KEYWORD_SIZE];
   register char *ptr;
-  register char c;
+  register int c;
 
   ptr = &keyword[0];
-  c = *field++;
+  c = (unsigned char) *field++;
   if (isspace (c) || c == ':')
     return ((char *) NULL);
   *ptr++ = (islower (c) ? toupper (c) : c);
-  while (((c = *field++) != ':') && ! isspace (c))
+  while (((c = (unsigned char) *field++) != ':') && ! isspace (c))
     *ptr++ = (islower (c) ? toupper (c) : c);
   *ptr++ = '\0';
   while (isspace (c))
-    c = *field++;
+    c = (unsigned char) *field++;
   if (c != ':')
     return ((char *) NULL);
   *rest = field;
@@ -368,9 +369,9 @@ make_file_preface ()
   user_length = strlen (temp);
   the_user = alloc_string (user_length + 1);
   strcpy (the_user, temp);
-  the_string = alloc_string (3 + prefix_length +
-                            user_length +
-                            date_length);
+  the_string = alloc_string (3 + prefix_length
+                            + user_length
+                            date_length);
   temp = the_string;
   strcpy (temp, FROM_PREFIX);
   temp = &temp[prefix_length];
@@ -594,6 +595,7 @@ args_size (the_header)
 
    Also, if the header has any FCC fields, call setup_files for each one.  */
 
+void
 parse_header (the_header, where)
      header the_header;
      register char *where;