aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert2011-03-01 17:52:03 -0800
committerPaul Eggert2011-03-01 17:52:03 -0800
commitba46f4d85a6938273f52a8cdf7e09d9afee61d7f (patch)
tree606ec46b703532d463ccddf287f0053430eb1f4a /lib-src
parentd9d0d182da35312ed0d7a9859b9c6a03994d86d8 (diff)
parent0dc3e4109e0c41bbf5fdcae0ff1156162719693e (diff)
downloademacs-ba46f4d85a6938273f52a8cdf7e09d9afee61d7f.tar.gz
emacs-ba46f4d85a6938273f52a8cdf7e09d9afee61d7f.zip
Merge from mainline.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog54
-rw-r--r--lib-src/Makefile.in2
-rw-r--r--lib-src/ebrowse.c71
-rw-r--r--lib-src/emacsclient.c117
-rw-r--r--lib-src/etags.c2
-rw-r--r--lib-src/fakemail.c13
-rw-r--r--lib-src/make-docfile.c15
7 files changed, 173 insertions, 101 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 2c98cdf59a6..f54ad384b13 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,57 @@
12011-02-26 Eli Zaretskii <eliz@gnu.org>
2
3 * Makefile.in (fakemail${EXEEXT}): Depend on lib/ignore-value.h.
4
5 * emacsclient.c (xstrdup) [WINDOWSNT]: Function added back.
6 (w32_getenv): Use xstrdup to return all values in malloc'ed
7 storage.
8
92011-02-26 Paul Eggert <eggert@cs.ucla.edu>
10
11 * ebrowse.c (parse_qualified_param_ident_or_type): Make it clear
12 to reader (and to the compiler) that the loop always executes at
13 least once. This prevents a warning with recent GCC.
14 (BROWSE_STRUCT): Remove unused macro.
15
16 * fakemail.c: Include <ignore-value.h>.
17 (put_line): Explicitly ignore fwrite return value, for benefit of
18 recent glibc + gcc.
19 (close_the_streams): Diagnose output errors instead of merely
20 exiting with nonzero status.
21 (my_fclose, main): Diagnose input errors, and exit with nonzero status.
22 Formerly, input errors were silently ignored.
23
24 * ebrowse.c (putstr): Rename from PUTSTR and turn into a function.
25 All callers changed. This is cleaner, and avoids GCC warnings about
26 passing NULL to fputs.
27 (insert_keyword): Rename parameter to avoid shadowing diagnostic.
28
292011-02-25 Paul Eggert <eggert@cs.ucla.edu>
30
31 * emacsclient.c (main): Avoid dangling 'if'.
32 (xstrdup): Remove; no longer needed.
33 (get_current_dir_name, w32_getenv, get_server_config, find_tty):
34 (set_local_socket, main):
35 Use const char *, not char *, for pointers that are not assigned
36 through.
37 (IF_LINT): New macro.
38 (set_local_socket, main): Use it to suppress warnings with
39 GCC -Wuninitialized.
40
41 * emacsclient.c: Redo local variables to avoid shadowing problems.
42 (message, socket_status, start_daemon_and_retry_set_socket):
43 Rename locals.
44 (main): Move decl of "i".
45
46 * etags.c (ISUPPER): Move to inside the only #ifdef where it's used.
47 This avoids an unused-macro warning with some GCC settings.
48
49 * make-docfile.c (write_globals): Change char * to char const *
50 to avoid a GCC "assignment discards qualifiers" diagnostic
51 in some configurations.
52 (scan_c_file): Refactor local variable decls to make their scope
53 more accurate and to avoid a GCC -Wuninitialized diagnostic.
54
12011-02-22 Eli Zaretskii <eliz@gnu.org> 552011-02-22 Eli Zaretskii <eliz@gnu.org>
2 56
3 * etags.c (canonicalize_filename, ISUPPER): Fix last change. 57 * etags.c (canonicalize_filename, ISUPPER): Fix last change.
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index f671b0844ce..d622233efb4 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -353,7 +353,7 @@ movemail.o: ${srcdir}/movemail.c ../src/config.h
353pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h ../src/config.h 353pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h ../src/config.h
354 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c 354 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
355 355
356fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h 356fakemail${EXEEXT}: ${srcdir}/fakemail.c ${srcdir}/../lib/ignore-value.h ../src/config.h
357 $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail 357 $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail
358 358
359emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h 359emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index f2894d5a0c2..113b6fdfe40 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -77,7 +77,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
77#define TREE_HEADER_STRUCT "[ebrowse-hs " 77#define TREE_HEADER_STRUCT "[ebrowse-hs "
78#define TREE_STRUCT "[ebrowse-ts " 78#define TREE_STRUCT "[ebrowse-ts "
79#define MEMBER_STRUCT "[ebrowse-ms " 79#define MEMBER_STRUCT "[ebrowse-ms "
80#define BROWSE_STRUCT "[ebrowse-bs "
81#define CLASS_STRUCT "[ebrowse-cs " 80#define CLASS_STRUCT "[ebrowse-cs "
82 81
83/* The name of the symbol table entry for global functions, variables, 82/* The name of the symbol table entry for global functions, variables,
@@ -1108,22 +1107,23 @@ leave_namespace (void)
1108/* Write string S to the output file FP in a Lisp-readable form. 1107/* Write string S to the output file FP in a Lisp-readable form.
1109 If S is null, write out `()'. */ 1108 If S is null, write out `()'. */
1110 1109
1111#define PUTSTR(s, fp) \ 1110static inline void
1112 do { \ 1111putstr (const char *s, FILE *fp)
1113 if (!s) \ 1112{
1114 { \ 1113 if (!s)
1115 putc ('(', fp); \ 1114 {
1116 putc (')', fp); \ 1115 putc ('(', fp);
1117 putc (' ', fp); \ 1116 putc (')', fp);
1118 } \ 1117 putc (' ', fp);
1119 else \ 1118 }
1120 { \ 1119 else
1121 putc ('"', fp); \ 1120 {
1122 fputs (s, fp); \ 1121 putc ('"', fp);
1123 putc ('"', fp); \ 1122 fputs (s, fp);
1124 putc (' ', fp); \ 1123 putc ('"', fp);
1125 } \ 1124 putc (' ', fp);
1126 } while (0) 1125 }
1126}
1127 1127
1128/* A dynamically allocated buffer for constructing a scope name. */ 1128/* A dynamically allocated buffer for constructing a scope name. */
1129 1129
@@ -1216,16 +1216,16 @@ dump_members (FILE *fp, struct member *m)
1216 for (n = 0; m; m = m->next, ++n) 1216 for (n = 0; m; m = m->next, ++n)
1217 { 1217 {
1218 fputs (MEMBER_STRUCT, fp); 1218 fputs (MEMBER_STRUCT, fp);
1219 PUTSTR (m->name, fp); 1219 putstr (m->name, fp);
1220 PUTSTR (NULL, fp); /* FIXME? scope for globals */ 1220 putstr (NULL, fp); /* FIXME? scope for globals */
1221 fprintf (fp, "%u ", (unsigned) m->flags); 1221 fprintf (fp, "%u ", (unsigned) m->flags);
1222 PUTSTR (m->filename, fp); 1222 putstr (m->filename, fp);
1223 PUTSTR (m->regexp, fp); 1223 putstr (m->regexp, fp);
1224 fprintf (fp, "%u ", (unsigned) m->pos); 1224 fprintf (fp, "%u ", (unsigned) m->pos);
1225 fprintf (fp, "%u ", (unsigned) m->vis); 1225 fprintf (fp, "%u ", (unsigned) m->vis);
1226 putc (' ', fp); 1226 putc (' ', fp);
1227 PUTSTR (m->def_filename, fp); 1227 putstr (m->def_filename, fp);
1228 PUTSTR (m->def_regexp, fp); 1228 putstr (m->def_regexp, fp);
1229 fprintf (fp, "%u", (unsigned) m->def_pos); 1229 fprintf (fp, "%u", (unsigned) m->def_pos);
1230 putc (']', fp); 1230 putc (']', fp);
1231 putc ('\n', fp); 1231 putc ('\n', fp);
@@ -1243,20 +1243,20 @@ static void
1243dump_sym (FILE *fp, struct sym *root) 1243dump_sym (FILE *fp, struct sym *root)
1244{ 1244{
1245 fputs (CLASS_STRUCT, fp); 1245 fputs (CLASS_STRUCT, fp);
1246 PUTSTR (root->name, fp); 1246 putstr (root->name, fp);
1247 1247
1248 /* Print scope, if any. */ 1248 /* Print scope, if any. */
1249 if (root->namesp) 1249 if (root->namesp)
1250 PUTSTR (sym_scope (root), fp); 1250 putstr (sym_scope (root), fp);
1251 else 1251 else
1252 PUTSTR (NULL, fp); 1252 putstr (NULL, fp);
1253 1253
1254 /* Print flags. */ 1254 /* Print flags. */
1255 fprintf (fp, "%u", root->flags); 1255 fprintf (fp, "%u", root->flags);
1256 PUTSTR (root->filename, fp); 1256 putstr (root->filename, fp);
1257 PUTSTR (root->regexp, fp); 1257 putstr (root->regexp, fp);
1258 fprintf (fp, "%u", (unsigned) root->pos); 1258 fprintf (fp, "%u", (unsigned) root->pos);
1259 PUTSTR (root->sfilename, fp); 1259 putstr (root->sfilename, fp);
1260 putc (']', fp); 1260 putc (']', fp);
1261 putc ('\n', fp); 1261 putc ('\n', fp);
1262} 1262}
@@ -1323,7 +1323,7 @@ dump_roots (FILE *fp)
1323 if (!f_append) 1323 if (!f_append)
1324 { 1324 {
1325 fputs (TREE_HEADER_STRUCT, fp); 1325 fputs (TREE_HEADER_STRUCT, fp);
1326 PUTSTR (EBROWSE_FILE_VERSION, fp); 1326 putstr (EBROWSE_FILE_VERSION, fp);
1327 1327
1328 putc ('\"', fp); 1328 putc ('\"', fp);
1329 if (!f_structs) 1329 if (!f_structs)
@@ -2062,11 +2062,11 @@ re_init_scanner (void)
2062} 2062}
2063 2063
2064 2064
2065/* Insert a keyword NAME with token value TK into the keyword hash 2065/* Insert a keyword NAME with token value TKV into the keyword hash
2066 table. */ 2066 table. */
2067 2067
2068static void 2068static void
2069insert_keyword (const char *name, int tk) 2069insert_keyword (const char *name, int tkv)
2070{ 2070{
2071 const char *s; 2071 const char *s;
2072 unsigned h = 0; 2072 unsigned h = 0;
@@ -2077,7 +2077,7 @@ insert_keyword (const char *name, int tk)
2077 2077
2078 h %= KEYWORD_TABLE_SIZE; 2078 h %= KEYWORD_TABLE_SIZE;
2079 k->name = name; 2079 k->name = name;
2080 k->tk = tk; 2080 k->tk = tkv;
2081 k->next = keyword_table[h]; 2081 k->next = keyword_table[h];
2082 keyword_table[h] = k; 2082 keyword_table[h] = k;
2083} 2083}
@@ -2951,7 +2951,9 @@ parse_qualified_param_ident_or_type (char **last_id)
2951 static char *id = NULL; 2951 static char *id = NULL;
2952 static int id_size = 0; 2952 static int id_size = 0;
2953 2953
2954 while (LOOKING_AT (IDENT)) 2954 assert (LOOKING_AT (IDENT));
2955
2956 do
2955 { 2957 {
2956 int len = strlen (yytext) + 1; 2958 int len = strlen (yytext) + 1;
2957 if (len > id_size) 2959 if (len > id_size)
@@ -2974,6 +2976,7 @@ parse_qualified_param_ident_or_type (char **last_id)
2974 else 2976 else
2975 break; 2977 break;
2976 } 2978 }
2979 while (LOOKING_AT (IDENT));
2977} 2980}
2978 2981
2979 2982
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 8d5f0482637..836891ae6aa 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -112,6 +112,13 @@ char *(getcwd) (char *, size_t);
112/* Additional space when allocating buffers for filenames, etc. */ 112/* Additional space when allocating buffers for filenames, etc. */
113#define EXTRA_SPACE 100 113#define EXTRA_SPACE 100
114 114
115/* Use this to suppress gcc's `...may be used before initialized' warnings. */
116#ifdef lint
117# define IF_LINT(Code) Code
118#else
119# define IF_LINT(Code) /* empty */
120#endif
121
115 122
116/* Name used to invoke this program. */ 123/* Name used to invoke this program. */
117const char *progname; 124const char *progname;
@@ -190,20 +197,6 @@ xmalloc (unsigned int size)
190 return result; 197 return result;
191} 198}
192 199
193/* Like strdup but get a fatal error if memory is exhausted. */
194
195static char *
196xstrdup (const char *s)
197{
198 char *result = strdup (s);
199 if (result == NULL)
200 {
201 perror ("strdup");
202 exit (EXIT_FAILURE);
203 }
204 return result;
205}
206
207/* From sysdep.c */ 200/* From sysdep.c */
208#if !defined (HAVE_GET_CURRENT_DIR_NAME) || defined (BROKEN_GET_CURRENT_DIR_NAME) 201#if !defined (HAVE_GET_CURRENT_DIR_NAME) || defined (BROKEN_GET_CURRENT_DIR_NAME)
209 202
@@ -233,7 +226,7 @@ char*
233get_current_dir_name (void) 226get_current_dir_name (void)
234{ 227{
235 char *buf; 228 char *buf;
236 char *pwd; 229 const char *pwd;
237 struct stat dotstat, pwdstat; 230 struct stat dotstat, pwdstat;
238 /* If PWD is accurate, use it instead of calling getwd. PWD is 231 /* If PWD is accurate, use it instead of calling getwd. PWD is
239 sometimes a nicer name, and using it may avoid a fatal error if a 232 sometimes a nicer name, and using it may avoid a fatal error if a
@@ -300,6 +293,20 @@ get_current_dir_name (void)
300 293
301#ifdef WINDOWSNT 294#ifdef WINDOWSNT
302 295
296/* Like strdup but get a fatal error if memory is exhausted. */
297
298char *
299xstrdup (const char *s)
300{
301 char *result = strdup (s);
302 if (result == NULL)
303 {
304 perror ("strdup");
305 exit (EXIT_FAILURE);
306 }
307 return result;
308}
309
303#define REG_ROOT "SOFTWARE\\GNU\\Emacs" 310#define REG_ROOT "SOFTWARE\\GNU\\Emacs"
304 311
305/* Retrieve an environment variable from the Emacs subkeys of the registry. 312/* Retrieve an environment variable from the Emacs subkeys of the registry.
@@ -335,9 +342,11 @@ w32_get_resource (HKEY predefined, char *key, LPDWORD type)
335/* 342/*
336 getenv wrapper for Windows 343 getenv wrapper for Windows
337 344
338 This is needed to duplicate Emacs's behavior, which is to look for environment 345 Value is allocated on the heap, and can be free'd.
339 variables in the registry if they don't appear in the environment. 346
340*/ 347 This is needed to duplicate Emacs's behavior, which is to look for
348 environment variables in the registry if they don't appear in the
349 environment. */
341char * 350char *
342w32_getenv (char *envvar) 351w32_getenv (char *envvar)
343{ 352{
@@ -345,8 +354,9 @@ w32_getenv (char *envvar)
345 DWORD dwType; 354 DWORD dwType;
346 355
347 if (value = getenv (envvar)) 356 if (value = getenv (envvar))
348 /* Found in the environment. */ 357 /* Found in the environment. strdup it, because values returned
349 return value; 358 by getenv cannot be free'd. */
359 return xstrdup (value);
350 360
351 if (! (value = w32_get_resource (HKEY_CURRENT_USER, envvar, &dwType)) && 361 if (! (value = w32_get_resource (HKEY_CURRENT_USER, envvar, &dwType)) &&
352 ! (value = w32_get_resource (HKEY_LOCAL_MACHINE, envvar, &dwType))) 362 ! (value = w32_get_resource (HKEY_LOCAL_MACHINE, envvar, &dwType)))
@@ -474,13 +484,13 @@ ttyname (int fd)
474/* Display a normal or error message. 484/* Display a normal or error message.
475 On Windows, use a message box if compiled as a Windows app. */ 485 On Windows, use a message box if compiled as a Windows app. */
476static void 486static void
477message (int is_error, const char *message, ...) 487message (int is_error, const char *format, ...)
478{ 488{
479 char msg[2048]; 489 char msg[2048];
480 va_list args; 490 va_list args;
481 491
482 va_start (args, message); 492 va_start (args, format);
483 vsprintf (msg, message, args); 493 vsprintf (msg, format, args);
484 va_end (args); 494 va_end (args);
485 495
486#ifdef WINDOWSNT 496#ifdef WINDOWSNT
@@ -918,7 +928,7 @@ get_server_config (struct sockaddr_in *server, char *authentication)
918 config = fopen (server_file, "rb"); 928 config = fopen (server_file, "rb");
919 else 929 else
920 { 930 {
921 char *home = egetenv ("HOME"); 931 const char *home = egetenv ("HOME");
922 932
923 if (home) 933 if (home)
924 { 934 {
@@ -1025,10 +1035,10 @@ strprefix (const char *prefix, const char *string)
1025 is zero, or return 0 if NOABORT is non-zero. */ 1035 is zero, or return 0 if NOABORT is non-zero. */
1026 1036
1027static int 1037static int
1028find_tty (char **tty_type, char **tty_name, int noabort) 1038find_tty (const char **tty_type, const char **tty_name, int noabort)
1029{ 1039{
1030 char *type = egetenv ("TERM"); 1040 const char *type = egetenv ("TERM");
1031 char *name = ttyname (fileno (stdout)); 1041 const char *name = ttyname (fileno (stdout));
1032 1042
1033 if (!name) 1043 if (!name)
1034 { 1044 {
@@ -1080,11 +1090,11 @@ find_tty (char **tty_type, char **tty_name, int noabort)
1080 0 - success: none of the above */ 1090 0 - success: none of the above */
1081 1091
1082static int 1092static int
1083socket_status (char *socket_name) 1093socket_status (char *name)
1084{ 1094{
1085 struct stat statbfr; 1095 struct stat statbfr;
1086 1096
1087 if (stat (socket_name, &statbfr) == -1) 1097 if (stat (name, &statbfr) == -1)
1088 return 2; 1098 return 2;
1089 1099
1090 if (statbfr.st_uid != geteuid ()) 1100 if (statbfr.st_uid != geteuid ())
@@ -1205,7 +1215,7 @@ set_local_socket (void)
1205 int default_sock = !socket_name; 1215 int default_sock = !socket_name;
1206 int saved_errno = 0; 1216 int saved_errno = 0;
1207 const char *server_name = "server"; 1217 const char *server_name = "server";
1208 const char *tmpdir; 1218 const char *tmpdir IF_LINT ( = NULL);
1209 1219
1210 if (socket_name && !strchr (socket_name, '/') 1220 if (socket_name && !strchr (socket_name, '/')
1211 && !strchr (socket_name, '\\')) 1221 && !strchr (socket_name, '\\'))
@@ -1260,10 +1270,10 @@ set_local_socket (void)
1260 associated with the name. This is reminiscent of the logic 1270 associated with the name. This is reminiscent of the logic
1261 that init_editfns uses to set the global Vuser_full_name. */ 1271 that init_editfns uses to set the global Vuser_full_name. */
1262 1272
1263 char *user_name = (char *) egetenv ("LOGNAME"); 1273 const char *user_name = egetenv ("LOGNAME");
1264 1274
1265 if (!user_name) 1275 if (!user_name)
1266 user_name = (char *) egetenv ("USER"); 1276 user_name = egetenv ("USER");
1267 1277
1268 if (user_name) 1278 if (user_name)
1269 { 1279 {
@@ -1483,8 +1493,8 @@ start_daemon_and_retry_set_socket (void)
1483 else 1493 else
1484 { 1494 {
1485 char emacs[] = "emacs"; 1495 char emacs[] = "emacs";
1486 char daemon[] = "--daemon"; 1496 char daemon_option[] = "--daemon";
1487 char *d_argv[] = {emacs, daemon, 0 }; 1497 char *d_argv[] = {emacs, daemon_option, 0 };
1488 if (socket_name != NULL) 1498 if (socket_name != NULL)
1489 { 1499 {
1490 /* Pass --daemon=socket_name as argument. */ 1500 /* Pass --daemon=socket_name as argument. */
@@ -1504,10 +1514,12 @@ start_daemon_and_retry_set_socket (void)
1504int 1514int
1505main (int argc, char **argv) 1515main (int argc, char **argv)
1506{ 1516{
1507 int i, rl, needlf = 0; 1517 int rl, needlf = 0;
1508 char *cwd, *str; 1518 char *cwd, *str;
1509 char string[BUFSIZ+1]; 1519 char string[BUFSIZ+1];
1510 int null_socket_name, null_server_file, start_daemon_if_needed; 1520 int null_socket_name IF_LINT ( = 0);
1521 int null_server_file IF_LINT ( = 0);
1522 int start_daemon_if_needed;
1511 int exit_status = EXIT_SUCCESS; 1523 int exit_status = EXIT_SUCCESS;
1512 1524
1513 main_argv = argv; 1525 main_argv = argv;
@@ -1543,21 +1555,21 @@ main (int argc, char **argv)
1543 null_server_file = (server_file == NULL); 1555 null_server_file = (server_file == NULL);
1544 } 1556 }
1545 1557
1546 if ((emacs_socket = set_socket (alternate_editor 1558 emacs_socket = set_socket (alternate_editor || start_daemon_if_needed);
1547 || start_daemon_if_needed)) == INVALID_SOCKET) 1559 if (emacs_socket == INVALID_SOCKET)
1548 if (start_daemon_if_needed) 1560 {
1549 { 1561 if (! start_daemon_if_needed)
1550 /* Reset socket_name and server_file if they were NULL 1562 fail ();
1551 before the set_socket call. */ 1563
1552 if (null_socket_name) 1564 /* Reset socket_name and server_file if they were NULL
1553 socket_name = NULL; 1565 before the set_socket call. */
1554 if (null_server_file) 1566 if (null_socket_name)
1555 server_file = NULL; 1567 socket_name = NULL;
1556 1568 if (null_server_file)
1557 start_daemon_and_retry_set_socket (); 1569 server_file = NULL;
1558 } 1570
1559 else 1571 start_daemon_and_retry_set_socket ();
1560 fail (); 1572 }
1561 1573
1562 cwd = get_current_dir_name (); 1574 cwd = get_current_dir_name ();
1563 if (cwd == 0) 1575 if (cwd == 0)
@@ -1615,7 +1627,7 @@ main (int argc, char **argv)
1615 frame is available. */ 1627 frame is available. */
1616 if (tty || (current_frame && !eval)) 1628 if (tty || (current_frame && !eval))
1617 { 1629 {
1618 char *tty_type, *tty_name; 1630 const char *tty_type, *tty_name;
1619 1631
1620 if (find_tty (&tty_type, &tty_name, !tty)) 1632 if (find_tty (&tty_type, &tty_name, !tty))
1621 { 1633 {
@@ -1635,6 +1647,7 @@ main (int argc, char **argv)
1635 1647
1636 if ((argc - optind > 0)) 1648 if ((argc - optind > 0))
1637 { 1649 {
1650 int i;
1638 for (i = optind; i < argc; i++) 1651 for (i = optind; i < argc; i++)
1639 { 1652 {
1640 1653
diff --git a/lib-src/etags.c b/lib-src/etags.c
index b738f0f4564..385e4cc9721 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -236,7 +236,6 @@ If you want regular expression support, you should delete this notice and
236#define ISALNUM(c) isalnum (CHAR(c)) 236#define ISALNUM(c) isalnum (CHAR(c))
237#define ISALPHA(c) isalpha (CHAR(c)) 237#define ISALPHA(c) isalpha (CHAR(c))
238#define ISDIGIT(c) isdigit (CHAR(c)) 238#define ISDIGIT(c) isdigit (CHAR(c))
239#define ISUPPER(c) isupper (CHAR(c))
240#define ISLOWER(c) islower (CHAR(c)) 239#define ISLOWER(c) islower (CHAR(c))
241 240
242#define lowcase(c) tolower (CHAR(c)) 241#define lowcase(c) tolower (CHAR(c))
@@ -6648,6 +6647,7 @@ canonicalize_filename (register char *fn)
6648 6647
6649#ifdef DOS_NT 6648#ifdef DOS_NT
6650 /* Canonicalize drive letter case. */ 6649 /* Canonicalize drive letter case. */
6650# define ISUPPER(c) isupper (CHAR(c))
6651 if (fn[0] != '\0' && fn[1] == ':' && ISUPPER (fn[0])) 6651 if (fn[0] != '\0' && fn[1] == ':' && ISUPPER (fn[0]))
6652 fn[0] = lowcase (fn[0]); 6652 fn[0] = lowcase (fn[0]);
6653 6653
diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c
index 26375a61654..780a104b405 100644
--- a/lib-src/fakemail.c
+++ b/lib-src/fakemail.c
@@ -62,6 +62,8 @@ main ()
62 62
63/* This is to declare cuserid. */ 63/* This is to declare cuserid. */
64#include <unistd.h> 64#include <unistd.h>
65
66#include <ignore-value.h>
65 67
66/* Type definitions */ 68/* Type definitions */
67 69
@@ -405,8 +407,8 @@ close_the_streams (void)
405 for (rem = the_streams; 407 for (rem = the_streams;
406 rem != ((stream_list) NULL); 408 rem != ((stream_list) NULL);
407 rem = rem->rest_streams) 409 rem = rem->rest_streams)
408 no_problems = (no_problems && 410 if (no_problems && (*rem->action) (rem->handle) != 0)
409 ((*rem->action) (rem->handle) == 0)); 411 error ("output error", NULL);
410 the_streams = ((stream_list) NULL); 412 the_streams = ((stream_list) NULL);
411 return (no_problems ? EXIT_SUCCESS : EXIT_FAILURE); 413 return (no_problems ? EXIT_SUCCESS : EXIT_FAILURE);
412} 414}
@@ -427,6 +429,8 @@ my_fclose (FILE *the_file)
427{ 429{
428 putc ('\n', the_file); 430 putc ('\n', the_file);
429 fflush (the_file); 431 fflush (the_file);
432 if (ferror (the_file))
433 return EOF;
430 return fclose (the_file); 434 return fclose (the_file);
431} 435}
432 436
@@ -496,7 +500,7 @@ put_line (const char *string)
496 } 500 }
497 } 501 }
498 /* Output that much, then break the line. */ 502 /* Output that much, then break the line. */
499 fwrite (s, 1, breakpos - s, rem->handle); 503 ignore_value (fwrite (s, 1, breakpos - s, rem->handle));
500 column = 8; 504 column = 8;
501 505
502 /* Skip whitespace and prepare to print more addresses. */ 506 /* Skip whitespace and prepare to print more addresses. */
@@ -729,6 +733,9 @@ main (int argc, char **argv)
729 put_string (buf); 733 put_string (buf);
730 } 734 }
731 735
736 if (no_problems && (ferror (stdin) || fclose (stdin) != 0))
737 error ("input error", NULL);
738
732 exit (close_the_streams ()); 739 exit (close_the_streams ());
733} 740}
734 741
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index f0aa222986a..f900ea42e91 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -617,7 +617,7 @@ write_globals (void)
617 qsort (globals, num_globals, sizeof (struct global), compare_globals); 617 qsort (globals, num_globals, sizeof (struct global), compare_globals);
618 for (i = 0; i < num_globals; ++i) 618 for (i = 0; i < num_globals; ++i)
619 { 619 {
620 char *type; 620 char const *type;
621 621
622 switch (globals[i].type) 622 switch (globals[i].type)
623 { 623 {
@@ -658,12 +658,8 @@ scan_c_file (char *filename, const char *mode)
658 FILE *infile; 658 FILE *infile;
659 register int c; 659 register int c;
660 register int commas; 660 register int commas;
661 register int defunflag;
662 register int defvarperbufferflag;
663 register int defvarflag;
664 int minargs, maxargs; 661 int minargs, maxargs;
665 int extension = filename[strlen (filename) - 1]; 662 int extension = filename[strlen (filename) - 1];
666 enum global_type type;
667 663
668 if (extension == 'o') 664 if (extension == 'o')
669 filename[strlen (filename) - 1] = 'c'; 665 filename[strlen (filename) - 1] = 'c';
@@ -693,6 +689,10 @@ scan_c_file (char *filename, const char *mode)
693 while (!feof (infile)) 689 while (!feof (infile))
694 { 690 {
695 int doc_keyword = 0; 691 int doc_keyword = 0;
692 int defunflag = 0;
693 int defvarperbufferflag = 0;
694 int defvarflag = 0;
695 enum global_type type = INVALID;
696 696
697 if (c != '\n' && c != '\r') 697 if (c != '\n' && c != '\r')
698 { 698 {
@@ -726,7 +726,6 @@ scan_c_file (char *filename, const char *mode)
726 continue; 726 continue;
727 727
728 defvarflag = 1; 728 defvarflag = 1;
729 defunflag = 0;
730 729
731 c = getc (infile); 730 c = getc (infile);
732 defvarperbufferflag = (c == 'P'); 731 defvarperbufferflag = (c == 'P');
@@ -738,8 +737,6 @@ scan_c_file (char *filename, const char *mode)
738 type = LISP_OBJECT; 737 type = LISP_OBJECT;
739 else if (c == 'B') 738 else if (c == 'B')
740 type = BOOLEAN; 739 type = BOOLEAN;
741 else
742 type = INVALID;
743 } 740 }
744 741
745 c = getc (infile); 742 c = getc (infile);
@@ -758,8 +755,6 @@ scan_c_file (char *filename, const char *mode)
758 continue; 755 continue;
759 c = getc (infile); 756 c = getc (infile);
760 defunflag = c == 'U'; 757 defunflag = c == 'U';
761 defvarflag = 0;
762 defvarperbufferflag = 0;
763 } 758 }
764 else continue; 759 else continue;
765 760