X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lib-src%2Ffakemail.c;h=13976ba1e74b474aaf7c0d7d5f0fd1545643c78c;hb=de7caee5f47b0888cb3895ce8c09d745f2fc35aa;hp=8467c022ea2c28a6861d8df94af9378b2f8434bc;hpb=716cfba952c1dc0d2cf5c968971f3780ba728a89;p=chise%2Fxemacs-chise.git.1 diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c index 8467c02..13976ba 100644 --- a/lib-src/fakemail.c +++ b/lib-src/fakemail.c @@ -46,14 +46,6 @@ main (int argc, char *argv[]) return 1; } #else /* not BSD 4.2 (or newer) */ -#ifdef MSDOS -int -main (int argc, char *argv[]) -{ - return 0; -} -#else /* not MSDOS */ -/* This conditional contains all the rest of the file. */ /* These are defined in config in some versions. */ @@ -144,7 +136,7 @@ struct linebuffer lb; #define MAIL_PROGRAM_NAME "/bin/mail" #endif -static CONST char *my_name; +static const char *my_name; static char *the_date; static char *the_user; static line_list file_preface; @@ -157,9 +149,17 @@ extern int fclose (), pclose (); extern char *malloc (), *realloc (); #endif +#if defined(__FreeBSD_version) && __FreeBSD_version >= 400000 +#define CURRENT_USER +#endif + #ifdef CURRENT_USER extern struct passwd *getpwuid (); +#if defined(__FreeBSD_version) && __FreeBSD_version >= 400000 +extern uid_t geteuid (); +#else extern unsigned short geteuid (); +#endif static struct passwd *my_entry; #define cuserid(s) \ (my_entry = getpwuid ((int) geteuid ()), \ @@ -171,7 +171,7 @@ static struct passwd *my_entry; /* Print error message. `s1' is printf control string, `s2' is arg for it. */ static void -error (CONST char *s1, CONST char *s2) +error (const char *s1, const char *s2) { printf ("%s: ", my_name); printf (s1, s2); @@ -182,7 +182,7 @@ error (CONST char *s1, CONST char *s2) /* Print error message and exit. */ static void -fatal (CONST char *s1, CONST char *s2) +fatal (const char *s1, const char *s2) { error (s1, s2); exit (1); @@ -310,7 +310,7 @@ static line_list make_file_preface (void) { char *the_string, *temp; - long idiotic_interface; + time_t idiotic_interface; long prefix_length; long user_length; long date_length; @@ -321,8 +321,9 @@ make_file_preface (void) the_date = ctime (&idiotic_interface); /* the_date has an unwanted newline at the end */ date_length = strlen (the_date) - 1; - the_date[date_length] = '\0'; -#ifdef WINDOWSNT + if (the_date[date_length] == '\n') + the_date[date_length] = '\0'; +#ifdef WIN32_NATIVE temp = "(null)"; #else temp = cuserid ((char *) NULL); @@ -419,20 +420,20 @@ put_string (char *s) } static void -put_line (CONST char *string) +put_line (const char *string) { register stream_list rem; for (rem = the_streams; rem != ((stream_list) NULL); rem = rem->rest_streams) { - CONST char *s = string; + const char *s = string; int column = 0; /* Divide STRING into lines. */ while (*s != 0) { - CONST char *breakpos; + const char *breakpos; /* Find the last char that fits. */ for (breakpos = s; *breakpos && column < 78; ++breakpos) @@ -673,5 +674,4 @@ main (int argc, char *argv[]) return close_the_streams (); } -#endif /* not MSDOS */ #endif /* not BSD 4.2 (or newer) */