aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorJan D2010-08-11 11:16:35 +0200
committerJan D2010-08-11 11:16:35 +0200
commit5e3b9a89ad0dc6fd34d91798d227ed29a905aa26 (patch)
tree2ba6bdd445ea904f5ac49df8b28aa4fea036ea5a /lib-src
parent9c5bd55ac617d8978b36815eb711f977aee82ace (diff)
downloademacs-5e3b9a89ad0dc6fd34d91798d227ed29a905aa26.tar.gz
emacs-5e3b9a89ad0dc6fd34d91798d227ed29a905aa26.zip
Fix -Wwrite-strings warnings in fakemail.c.
* fakemail.c: Include stdlib.h for getenv. Remove declaration of popen, fclose and pclose. (my_name, fatal, error, put_line): Use const char* (main): Remove extern getenv, mail_program_name is const char*.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog5
-rw-r--r--lib-src/fakemail.c24
2 files changed, 14 insertions, 15 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 44a6fd3ca0c..4f3f386310a 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,5 +1,10 @@
12010-08-11 Jan Djärv <jan.h.d@swipnet.se> 12010-08-11 Jan Djärv <jan.h.d@swipnet.se>
2 2
3 * fakemail.c: Include stdlib.h for getenv. Remove declaration of
4 popen, fclose and pclose.
5 (my_name, fatal, error, put_line): Use const char*
6 (main): Remove extern getenv, mail_program_name is const char*.
7
3 * update-game-score.c (get_prefix, write_scores, main): Use const char*. 8 * update-game-score.c (get_prefix, write_scores, main): Use const char*.
4 9
5 * sorted-doc.c (error, fatal, states): Use const char *. 10 * sorted-doc.c (error, fatal, states): Use const char *.
diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c
index 787dc83a698..16baeb266a8 100644
--- a/lib-src/fakemail.c
+++ b/lib-src/fakemail.c
@@ -59,6 +59,7 @@ main ()
59#include <ctype.h> 59#include <ctype.h>
60#include <time.h> 60#include <time.h>
61#include <pwd.h> 61#include <pwd.h>
62#include <stdlib.h>
62 63
63/* This is to declare cuserid. */ 64/* This is to declare cuserid. */
64#ifdef HAVE_UNISTD_H 65#ifdef HAVE_UNISTD_H
@@ -140,21 +141,16 @@ struct linebuffer lb;
140#define MAIL_PROGRAM_NAME "/bin/mail" 141#define MAIL_PROGRAM_NAME "/bin/mail"
141#endif 142#endif
142 143
143static char *my_name; 144static const char *my_name;
144static char *the_date; 145static char *the_date;
145static char *the_user; 146static char *the_user;
146static line_list file_preface; 147static line_list file_preface;
147static stream_list the_streams; 148static stream_list the_streams;
148static boolean no_problems = true; 149static boolean no_problems = true;
149 150
150static void fatal (char *s1) NO_RETURN; 151static void fatal (const char *s1) NO_RETURN;
151
152extern FILE *popen (const char *, const char *);
153extern int fclose (FILE *), pclose (FILE *);
154 152
155#ifdef CURRENT_USER 153#ifdef CURRENT_USER
156extern struct passwd *getpwuid ();
157extern unsigned short geteuid ();
158static struct passwd *my_entry; 154static struct passwd *my_entry;
159#define cuserid(s) \ 155#define cuserid(s) \
160(my_entry = getpwuid (((int) geteuid ())), \ 156(my_entry = getpwuid (((int) geteuid ())), \
@@ -166,7 +162,7 @@ static struct passwd *my_entry;
166/* Print error message. `s1' is printf control string, `s2' is arg for it. */ 162/* Print error message. `s1' is printf control string, `s2' is arg for it. */
167 163
168static void 164static void
169error (char *s1, char *s2) 165error (const char *s1, const char *s2)
170{ 166{
171 printf ("%s: ", my_name); 167 printf ("%s: ", my_name);
172 printf (s1, s2); 168 printf (s1, s2);
@@ -177,7 +173,7 @@ error (char *s1, char *s2)
177/* Print error message and exit. */ 173/* Print error message and exit. */
178 174
179static void 175static void
180fatal (char *s1) 176fatal (const char *s1)
181{ 177{
182 error ("%s", s1); 178 error ("%s", s1);
183 exit (EXIT_FAILURE); 179 exit (EXIT_FAILURE);
@@ -464,20 +460,20 @@ put_string (char *s)
464} 460}
465 461
466void 462void
467put_line (char *string) 463put_line (const char *string)
468{ 464{
469 register stream_list rem; 465 register stream_list rem;
470 for (rem = the_streams; 466 for (rem = the_streams;
471 rem != ((stream_list) NULL); 467 rem != ((stream_list) NULL);
472 rem = rem->rest_streams) 468 rem = rem->rest_streams)
473 { 469 {
474 char *s = string; 470 const char *s = string;
475 int column = 0; 471 int column = 0;
476 472
477 /* Divide STRING into lines. */ 473 /* Divide STRING into lines. */
478 while (*s != 0) 474 while (*s != 0)
479 { 475 {
480 char *breakpos; 476 const char *breakpos;
481 477
482 /* Find the last char that fits. */ 478 /* Find the last char that fits. */
483 for (breakpos = s; *breakpos && column < 78; ++breakpos) 479 for (breakpos = s; *breakpos && column < 78; ++breakpos)
@@ -699,13 +695,11 @@ main (int argc, char **argv)
699 char *command_line; 695 char *command_line;
700 header the_header; 696 header the_header;
701 long name_length; 697 long name_length;
702 char *mail_program_name; 698 const char *mail_program_name;
703 char buf[BUFLEN + 1]; 699 char buf[BUFLEN + 1];
704 register int size; 700 register int size;
705 FILE *the_pipe; 701 FILE *the_pipe;
706 702
707 extern char *getenv (const char *);
708
709 mail_program_name = getenv ("FAKEMAILER"); 703 mail_program_name = getenv ("FAKEMAILER");
710 if (!(mail_program_name && *mail_program_name)) 704 if (!(mail_program_name && *mail_program_name))
711 mail_program_name = MAIL_PROGRAM_NAME; 705 mail_program_name = MAIL_PROGRAM_NAME;