Gentoo Archives: gentoo-commits

From: "Ulrich Mueller (ulm)" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/emacs/18.59: 01_all_unexelf.patch 02_all_gentoo.patch 03_all_gcc4.patch
Date: Fri, 21 Dec 2007 21:06:51
Message-Id: E1J5p4o-00040h-8z@stork.gentoo.org
1 ulm 07/12/21 21:06:38
2
3 Added: 01_all_unexelf.patch 02_all_gentoo.patch
4 03_all_gcc4.patch
5 Log:
6 Add patchset for emacs-18.59
7
8 Revision Changes Path
9 1.1 src/patchsets/emacs/18.59/01_all_unexelf.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/emacs/18.59/01_all_unexelf.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/emacs/18.59/01_all_unexelf.patch?rev=1.1&content-type=text/plain
13
14 Index: 01_all_unexelf.patch
15 ===================================================================
16 Prereq: 1999-11-05
17 diff -Nur emacs-18.59-orig/src/ChangeLog emacs-18.59/src/ChangeLog
18 --- emacs-18.59-orig/src/ChangeLog 1999-11-05 09:19:56.000000000 +0100
19 +++ emacs-18.59/src/ChangeLog 2004-03-08 09:38:50.000000000 +0100
20 @@ -1,3 +1,7 @@
21 +2004-03-08 Ulrich Mueller <ulm@×××××××××××××.de>
22 +
23 + * unexelf.c: Replaced with version from Emacs 21.3.
24 +
25 1999-11-05 Noah Friedman <friedman@××××××.com>
26
27 * ymakefile [LIBS_TERMCAP]: Use -lncurses, not -lcurses.
28 diff -Nur emacs-18.59-orig/src/unexelf.c emacs-18.59/src/unexelf.c
29 --- emacs-18.59-orig/src/unexelf.c 1998-05-31 04:35:54.000000000 +0200
30 +++ emacs-18.59/src/unexelf.c 2004-03-08 01:18:54.000000000 +0100
31 @@ -1,4 +1,4 @@
32 -/* Copyright (C) 1985, 1986, 1987, 1988, 1990, 1992
33 +/* Copyright (C) 1985, 1986, 1987, 1988, 1990, 1992, 1999, 2000, 01, 02
34 Free Software Foundation, Inc.
35
36 This file is part of GNU Emacs.
37 @@ -33,14 +33,14 @@
38 * Modified heavily since then.
39 *
40 * Synopsis:
41 - * unexec (new_name, a_name, data_start, bss_start, entry_address)
42 - * char *new_name, *a_name;
43 + * unexec (new_name, old_name, data_start, bss_start, entry_address)
44 + * char *new_name, *old_name;
45 * unsigned data_start, bss_start, entry_address;
46 *
47 * Takes a snapshot of the program and makes an a.out format file in the
48 * file named by the string argument new_name.
49 - * If a_name is non-NULL, the symbol table will be taken from the given file.
50 - * On some machines, an existing a_name file is required.
51 + * If old_name is non-NULL, the symbol table will be taken from the given file.
52 + * On some machines, an existing old_name file is required.
53 *
54 * The boundaries within the a.out file may be adjusted with the data_start
55 * and bss_start arguments. Either or both may be given as 0 for defaults.
56 @@ -52,11 +52,6 @@
57 * The value you specify may be rounded down to a suitable boundary
58 * as required by the machine you are using.
59 *
60 - * Specifying zero for data_start means the boundary between text and data
61 - * should not be the same as when the program was loaded.
62 - * If NO_REMAP is defined, the argument data_start is ignored and the
63 - * segment boundaries are never changed.
64 - *
65 * Bss_start indicates how much of the data segment is to be saved in the
66 * a.out file and restored when the program is executed. It gives the lowest
67 * unsaved address, and is rounded up to a page boundary. The default when 0
68 @@ -66,9 +61,6 @@
69 *
70 * The new file is set up to start at entry_address.
71 *
72 - * If you make improvements I'd like to get them too.
73 - * harpo!utah-cs!thomas, thomas@Utah-20
74 - *
75 */
76
77 /* Even more heavily modified by james@×××××××××××××.org of Dell Computer Co.
78 @@ -412,22 +404,159 @@
79
80 */
81
82 +/*
83 + * Modified by rdh@××××××××××.com of Yotta Yotta Incorporated.
84 + *
85 + * The code originally used mmap() to create a memory image of the new
86 + * and old object files. This had a few handy features: (1) you get
87 + * to use a cool system call like mmap, (2) no need to explicitly
88 + * write out the new file before the close, and (3) no swap space
89 + * requirements. Unfortunately, mmap() often fails to work with
90 + * nfs-mounted file systems.
91 + *
92 + * So, instead of relying on the vm subsystem to do the file i/o for
93 + * us, it's now done explicitly. A buffer of the right size for the
94 + * file is dynamically allocated, and either the old_name is read into
95 + * it, or it is initialized with the correct new executable contents,
96 + * and then written to new_name.
97 + */
98 +
99 +#ifndef emacs
100 +#define fatal(a, b, c) fprintf (stderr, a, b, c), exit (1)
101 +#include <string.h>
102 +#else
103 +#include "config.h"
104 +extern void fatal (char *, ...);
105 +#endif
106 +
107 #include <sys/types.h>
108 #include <stdio.h>
109 #include <sys/stat.h>
110 #include <memory.h>
111 -#include <string.h>
112 #include <errno.h>
113 #include <unistd.h>
114 #include <fcntl.h>
115 +#if !defined (__NetBSD__) && !defined (__OpenBSD__)
116 #include <elf.h>
117 +#endif
118 #include <sys/mman.h>
119 -
120 -#ifndef emacs
121 -#define fatal(a, b, c) fprintf (stderr, a, b, c), exit (1)
122 +#if defined (__sony_news) && defined (_SYSTYPE_SYSV)
123 +#include <sys/elf_mips.h>
124 +#include <sym.h>
125 +#endif /* __sony_news && _SYSTYPE_SYSV */
126 +#if __sgi
127 +#include <syms.h> /* for HDRR declaration */
128 +#endif /* __sgi */
129 +
130 +#ifndef MAP_ANON
131 +#ifdef MAP_ANONYMOUS
132 +#define MAP_ANON MAP_ANONYMOUS
133 #else
134 -#include "config.h"
135 -extern void fatal (char *, ...);
136 +#define MAP_ANON 0
137 +#endif
138 +#endif
139 +
140 +#ifndef MAP_FAILED
141 +#define MAP_FAILED ((void *) -1)
142 +#endif
143 +
144 +#if defined (__alpha__) && !defined (__NetBSD__) && !defined (__OpenBSD__)
145 +/* Declare COFF debugging symbol table. This used to be in
146 + /usr/include/sym.h, but this file is no longer included in Red Hat
147 + 5.0 and presumably in any other glibc 2.x based distribution. */
148 +typedef struct {
149 + short magic;
150 + short vstamp;
151 + int ilineMax;
152 + int idnMax;
153 + int ipdMax;
154 + int isymMax;
155 + int ioptMax;
156 + int iauxMax;
157 + int issMax;
158 + int issExtMax;
159 + int ifdMax;
160 + int crfd;
161 + int iextMax;
162 + long cbLine;
163 + long cbLineOffset;
164 + long cbDnOffset;
165 + long cbPdOffset;
166 + long cbSymOffset;
167 + long cbOptOffset;
168 + long cbAuxOffset;
169 + long cbSsOffset;
170 + long cbSsExtOffset;
171 + long cbFdOffset;
172 + long cbRfdOffset;
173 + long cbExtOffset;
174 +} HDRR, *pHDRR;
175 +#define cbHDRR sizeof(HDRR)
176 +#define hdrNil ((pHDRR)0)
177 +#endif
178 +
179 +#ifdef __NetBSD__
180 +/*
181 + * NetBSD does not have normal-looking user-land ELF support.
182 + */
183 +# if defined __alpha__ || defined __sparc_v9__
184 +# define ELFSIZE 64
185 +# else
186 +# define ELFSIZE 32
187 +# endif
188 +# include <sys/exec_elf.h>
189 +
190 +# ifndef PT_LOAD
191 +# define PT_LOAD Elf_pt_load
192 +# if 0 /* was in pkgsrc patches for 20.7 */
193 +# define SHT_PROGBITS Elf_sht_progbits
194 +# endif
195 +# define SHT_SYMTAB Elf_sht_symtab
196 +# define SHT_DYNSYM Elf_sht_dynsym
197 +# define SHT_NULL Elf_sht_null
198 +# define SHT_NOBITS Elf_sht_nobits
199 +# define SHT_REL Elf_sht_rel
200 +# define SHT_RELA Elf_sht_rela
201 +
202 +# define SHN_UNDEF Elf_eshn_undefined
203 +# define SHN_ABS Elf_eshn_absolute
204 +# define SHN_COMMON Elf_eshn_common
205 +# endif /* !PT_LOAD */
206 +
207 +# ifdef __alpha__
208 +# include <sys/exec_ecoff.h>
209 +# define HDRR struct ecoff_symhdr
210 +# define pHDRR HDRR *
211 +# endif /* __alpha__ */
212 +
213 +#ifdef __mips__ /* was in pkgsrc patches for 20.7 */
214 +# define SHT_MIPS_DEBUG DT_MIPS_FLAGS
215 +# define HDRR struct Elf_Shdr
216 +#endif /* __mips__ */
217 +#endif /* __NetBSD__ */
218 +
219 +#ifdef __OpenBSD__
220 +# include <sys/exec_elf.h>
221 +#endif
222 +
223 +#if __GNU_LIBRARY__ - 0 >= 6
224 +# include <link.h> /* get ElfW etc */
225 +#endif
226 +
227 +#ifndef ElfW
228 +# ifdef __STDC__
229 +# define ElfBitsW(bits, type) Elf##bits##_##type
230 +# else
231 +# define ElfBitsW(bits, type) Elf/**/bits/**/_/**/type
232 +# endif
233 +# ifdef _LP64
234 +# define ELFSIZE 64
235 +# else
236 +# define ELFSIZE 32
237 +# endif
238 + /* This macro expands `bits' before invoking ElfBitsW. */
239 +# define ElfExpandBitsW(bits, type) ElfBitsW (bits, type)
240 +# define ElfW(type) ElfExpandBitsW (ELFSIZE, type)
241 #endif
242
243 #ifndef ELF_BSS_SECTION_NAME
244 @@ -462,13 +591,13 @@
245 */
246
247 #define OLD_SECTION_H(n) \
248 - (*(Elf32_Shdr *) ((byte *) old_section_h + old_file_h->e_shentsize * (n)))
249 + (*(ElfW(Shdr) *) ((byte *) old_section_h + old_file_h->e_shentsize * (n)))
250 #define NEW_SECTION_H(n) \
251 - (*(Elf32_Shdr *) ((byte *) new_section_h + new_file_h->e_shentsize * (n)))
252 + (*(ElfW(Shdr) *) ((byte *) new_section_h + new_file_h->e_shentsize * (n)))
253 #define OLD_PROGRAM_H(n) \
254 - (*(Elf32_Phdr *) ((byte *) old_program_h + old_file_h->e_phentsize * (n)))
255 + (*(ElfW(Phdr) *) ((byte *) old_program_h + old_file_h->e_phentsize * (n)))
256 #define NEW_PROGRAM_H(n) \
257 - (*(Elf32_Phdr *) ((byte *) new_program_h + new_file_h->e_phentsize * (n)))
258 + (*(ElfW(Phdr) *) ((byte *) new_program_h + new_file_h->e_phentsize * (n)))
259
260 #define PATCH_INDEX(n) \
261 do { \
262 @@ -478,9 +607,9 @@
263
264 /* Round X up to a multiple of Y. */
265
266 -int
267 +static ElfW(Addr)
268 round_up (x, y)
269 - int x, y;
270 + ElfW(Addr) x, y;
271 {
272 int rem = x % y;
273 if (rem == 0)
274 @@ -488,6 +617,45 @@
275 return x - rem + y;
276 }
277
278 +/* Return the index of the section named NAME.
279 + SECTION_NAMES, FILE_NAME and FILE_H give information
280 + about the file we are looking in.
281 +
282 + If we don't find the section NAME, that is a fatal error
283 + if NOERROR is 0; we return -1 if NOERROR is nonzero. */
284 +
285 +static int
286 +find_section (name, section_names, file_name, old_file_h, old_section_h, noerror)
287 + char *name;
288 + char *section_names;
289 + char *file_name;
290 + ElfW(Ehdr) *old_file_h;
291 + ElfW(Shdr) *old_section_h;
292 + int noerror;
293 +{
294 + int idx;
295 +
296 + for (idx = 1; idx < old_file_h->e_shnum; idx++)
297 + {
298 +#ifdef DEBUG
299 + fprintf (stderr, "Looking for %s - found %s\n", name,
300 + section_names + OLD_SECTION_H (idx).sh_name);
301 +#endif
302 + if (!strcmp (section_names + OLD_SECTION_H (idx).sh_name,
303 + name))
304 + break;
305 + }
306 + if (idx == old_file_h->e_shnum)
307 + {
308 + if (noerror)
309 + return -1;
310 + else
311 + fatal ("Can't find %s in %s.\n", name, file_name);
312 + }
313 +
314 + return idx;
315 +}
316 +
317 /* ****************************************************************
318 * unexec
319 *
320 @@ -507,25 +675,36 @@
321 /* Pointers to the base of the image of the two files. */
322 caddr_t old_base, new_base;
323
324 +#if MAP_ANON == 0
325 + int mmap_fd;
326 +#else
327 +# define mmap_fd -1
328 +#endif
329 +
330 /* Pointers to the file, program and section headers for the old and new
331 * files.
332 */
333 - Elf32_Ehdr *old_file_h, *new_file_h;
334 - Elf32_Phdr *old_program_h, *new_program_h;
335 - Elf32_Shdr *old_section_h, *new_section_h;
336 + ElfW(Ehdr) *old_file_h, *new_file_h;
337 + ElfW(Phdr) *old_program_h, *new_program_h;
338 + ElfW(Shdr) *old_section_h, *new_section_h;
339
340 /* Point to the section name table in the old file */
341 char *old_section_names;
342
343 - Elf32_Addr old_bss_addr, new_bss_addr;
344 - Elf32_Word old_bss_size, new_data2_size;
345 - Elf32_Off new_data2_offset;
346 - Elf32_Addr new_data2_addr;
347 -
348 - int n, nn, old_bss_index, old_data_index, new_data2_index;
349 + ElfW(Addr) old_bss_addr, new_bss_addr;
350 + ElfW(Word) old_bss_size, new_data2_size;
351 + ElfW(Off) new_data2_offset;
352 + ElfW(Addr) new_data2_addr;
353 +
354 + int n, nn;
355 + int old_bss_index, old_sbss_index;
356 + int old_data_index, new_data2_index;
357 + int old_mdebug_index;
358 struct stat stat_buf;
359 + int old_file_size;
360
361 - /* Open the old file & map it into the address space. */
362 + /* Open the old file, allocate a buffer of the right size, and read
363 + * in the file contents. */
364
365 old_file = open (old_name, O_RDONLY);
366
367 @@ -535,52 +714,80 @@
368 if (fstat (old_file, &stat_buf) == -1)
369 fatal ("Can't fstat (%s): errno %d\n", old_name, errno);
370
371 - old_base = mmap (0, stat_buf.st_size, PROT_READ, MAP_SHARED, old_file, 0);
372 +#if MAP_ANON == 0
373 + mmap_fd = open ("/dev/zero", O_RDONLY);
374 + if (mmap_fd < 0)
375 + fatal ("Can't open /dev/zero for reading: errno %d\n", errno);
376 +#endif
377
378 - if (old_base == (caddr_t) -1)
379 - fatal ("Can't mmap (%s): errno %d\n", old_name, errno);
380 + /* We cannot use malloc here because that may use sbrk. If it does,
381 + we'd dump our temporary buffers with Emacs, and we'd have to be
382 + extra careful to use the correct value of sbrk(0) after
383 + allocating all buffers in the code below, which we aren't. */
384 + old_file_size = stat_buf.st_size;
385 + old_base = mmap (NULL, old_file_size, PROT_READ | PROT_WRITE,
386 + MAP_ANON | MAP_PRIVATE, mmap_fd, 0);
387 + if (old_base == MAP_FAILED)
388 + fatal ("Can't allocate buffer for %s\n", old_name);
389
390 -#ifdef DEBUG
391 - fprintf (stderr, "mmap (%s, %x) -> %x\n", old_name, stat_buf.st_size,
392 - old_base);
393 -#endif
394 + if (read (old_file, old_base, stat_buf.st_size) != stat_buf.st_size)
395 + fatal ("Didn't read all of %s: errno %d\n", old_name, errno);
396
397 /* Get pointers to headers & section names */
398
399 - old_file_h = (Elf32_Ehdr *) old_base;
400 - old_program_h = (Elf32_Phdr *) ((byte *) old_base + old_file_h->e_phoff);
401 - old_section_h = (Elf32_Shdr *) ((byte *) old_base + old_file_h->e_shoff);
402 + old_file_h = (ElfW(Ehdr) *) old_base;
403 + old_program_h = (ElfW(Phdr) *) ((byte *) old_base + old_file_h->e_phoff);
404 + old_section_h = (ElfW(Shdr) *) ((byte *) old_base + old_file_h->e_shoff);
405 old_section_names = (char *) old_base
406 + OLD_SECTION_H (old_file_h->e_shstrndx).sh_offset;
407
408 + /* Find the mdebug section, if any. */
409 +
410 + old_mdebug_index = find_section (".mdebug", old_section_names,
411 + old_name, old_file_h, old_section_h, 1);
412 +
413 /* Find the old .bss section. Figure out parameters of the new
414 * data2 and bss sections.
415 */
416
417 - for (old_bss_index = 1; old_bss_index < (int) old_file_h->e_shnum;
418 - old_bss_index++)
419 + old_bss_index = find_section (".bss", old_section_names,
420 + old_name, old_file_h, old_section_h, 0);
421 +
422 + old_sbss_index = find_section (".sbss", old_section_names,
423 + old_name, old_file_h, old_section_h, 1);
424 + if (old_sbss_index != -1)
425 + if (OLD_SECTION_H (old_sbss_index).sh_type == SHT_PROGBITS)
426 + old_sbss_index = -1;
427 +
428 + if (old_sbss_index == -1)
429 {
430 -#ifdef DEBUG
431 - fprintf (stderr, "Looking for .bss - found %s\n",
432 - old_section_names + OLD_SECTION_H (old_bss_index).sh_name);
433 -#endif
434 - if (!strcmp (old_section_names + OLD_SECTION_H (old_bss_index).sh_name,
435 - ELF_BSS_SECTION_NAME))
436 - break;
437 + old_bss_addr = OLD_SECTION_H (old_bss_index).sh_addr;
438 + old_bss_size = OLD_SECTION_H (old_bss_index).sh_size;
439 + new_data2_index = old_bss_index;
440 + }
441 + else
442 + {
443 + old_bss_addr = OLD_SECTION_H (old_sbss_index).sh_addr;
444 + old_bss_size = OLD_SECTION_H (old_bss_index).sh_size
445 + + OLD_SECTION_H (old_sbss_index).sh_size;
446 + new_data2_index = old_sbss_index;
447 }
448 - if (old_bss_index == old_file_h->e_shnum)
449 - fatal ("Can't find .bss in %s.\n", old_name, 0);
450
451 - old_bss_addr = OLD_SECTION_H (old_bss_index).sh_addr;
452 - old_bss_size = OLD_SECTION_H (old_bss_index).sh_size;
453 -#if defined(emacs) || !defined(DEBUG)
454 - new_bss_addr = (Elf32_Addr) sbrk (0);
455 + /* Find the old .data section. Figure out parameters of
456 + the new data2 and bss sections. */
457 +
458 + old_data_index = find_section (".data", old_section_names,
459 + old_name, old_file_h, old_section_h, 0);
460 +
461 +#if defined (emacs) || !defined (DEBUG)
462 + new_bss_addr = (ElfW(Addr)) sbrk (0);
463 #else
464 new_bss_addr = old_bss_addr + old_bss_size + 0x1234;
465 #endif
466 new_data2_addr = old_bss_addr;
467 new_data2_size = new_bss_addr - old_bss_addr;
468 - new_data2_offset = OLD_SECTION_H (old_bss_index).sh_offset;
469 + new_data2_offset = OLD_SECTION_H (old_data_index).sh_offset +
470 + (new_data2_addr - OLD_SECTION_H (old_data_index).sh_addr);
471
472 #ifdef DEBUG
473 fprintf (stderr, "old_bss_index %d\n", old_bss_index);
474 @@ -595,9 +802,9 @@
475 if ((unsigned) new_bss_addr < (unsigned) old_bss_addr + old_bss_size)
476 fatal (".bss shrank when undumping???\n", 0, 0);
477
478 - /* Set the output file to the right size and mmap it. Set
479 - * pointers to various interesting objects. stat_buf still has
480 - * old_file data.
481 + /* Set the output file to the right size. Allocate a buffer to hold
482 + * the image of the new file. Set pointers to various interesting
483 + * objects. stat_buf still has old_file data.
484 */
485
486 new_file = open (new_name, O_RDWR | O_CREAT, 0666);
487 @@ -609,20 +816,14 @@
488 if (ftruncate (new_file, new_file_size))
489 fatal ("Can't ftruncate (%s): errno %d\n", new_name, errno);
490
491 -#ifdef UNEXEC_USE_MAP_PRIVATE
492 - new_base = mmap (0, new_file_size, PROT_READ | PROT_WRITE, MAP_PRIVATE,
493 - new_file, 0);
494 -#else
495 - new_base = mmap (0, new_file_size, PROT_READ | PROT_WRITE, MAP_SHARED,
496 - new_file, 0);
497 -#endif
498 -
499 - if (new_base == (caddr_t) -1)
500 - fatal ("Can't mmap (%s): errno %d\n", new_name, errno);
501 -
502 - new_file_h = (Elf32_Ehdr *) new_base;
503 - new_program_h = (Elf32_Phdr *) ((byte *) new_base + old_file_h->e_phoff);
504 - new_section_h = (Elf32_Shdr *)
505 + new_base = mmap (NULL, new_file_size, PROT_READ | PROT_WRITE,
506 + MAP_ANON | MAP_PRIVATE, mmap_fd, 0);
507 + if (new_base == MAP_FAILED)
508 + fatal ("Can't allocate buffer for %s\n", old_name);
509 +
510 + new_file_h = (ElfW(Ehdr) *) new_base;
511 + new_program_h = (ElfW(Phdr) *) ((byte *) new_base + old_file_h->e_phoff);
512 + new_section_h = (ElfW(Shdr) *)
513 ((byte *) new_base + old_file_h->e_shoff + new_data2_size);
514
515 /* Make our new file, program and section headers as copies of the
516 @@ -661,12 +862,22 @@
517 for (n = new_file_h->e_phnum - 1; n >= 0; n--)
518 {
519 /* Compute maximum of all requirements for alignment of section. */
520 - int alignment = (NEW_PROGRAM_H (n)).p_align;
521 + ElfW(Word) alignment = (NEW_PROGRAM_H (n)).p_align;
522 if ((OLD_SECTION_H (old_bss_index)).sh_addralign > alignment)
523 alignment = OLD_SECTION_H (old_bss_index).sh_addralign;
524
525 - if (NEW_PROGRAM_H (n).p_vaddr + NEW_PROGRAM_H (n).p_filesz > old_bss_addr)
526 - fatal ("Program segment above .bss in %s\n", old_name, 0);
527 +#ifdef __sgi
528 + /* According to r02kar@×××××××××.de (Karsten Kuenne)
529 + and oliva@×××.org (Alexandre Oliva), on IRIX 5.2, we
530 + always get "Program segment above .bss" when dumping
531 + when the executable doesn't have an sbss section. */
532 + if (old_sbss_index != -1)
533 +#endif /* __sgi */
534 + if (NEW_PROGRAM_H (n).p_vaddr + NEW_PROGRAM_H (n).p_filesz
535 + > (old_sbss_index == -1
536 + ? old_bss_addr
537 + : round_up (old_bss_addr, alignment)))
538 + fatal ("Program segment above .bss in %s\n", old_name, 0);
539
540 if (NEW_PROGRAM_H (n).p_type == PT_LOAD
541 && (round_up ((NEW_PROGRAM_H (n)).p_vaddr
542 @@ -678,7 +889,9 @@
543 if (n < 0)
544 fatal ("Couldn't find segment next to .bss in %s\n", old_name, 0);
545
546 - NEW_PROGRAM_H (n).p_filesz += new_data2_size;
547 + /* Make sure that the size includes any padding before the old .bss
548 + section. */
549 + NEW_PROGRAM_H (n).p_filesz = new_bss_addr - NEW_PROGRAM_H (n).p_vaddr;
550 NEW_PROGRAM_H (n).p_memsz = NEW_PROGRAM_H (n).p_filesz;
551
552 #if 0 /* Maybe allow section after data2 - does this ever happen? */
553 @@ -712,12 +925,14 @@
554 for (n = 1, nn = 1; n < (int) old_file_h->e_shnum; n++, nn++)
555 {
556 caddr_t src;
557 - /* If it is bss section, insert the new data2 section before it. */
558 - if (n == old_bss_index)
559 + /* If it is (s)bss section, insert the new data2 section before it. */
560 + /* new_data2_index is the index of either old_sbss or old_bss, that was
561 + chosen as a section for new_data2. */
562 + if (n == new_data2_index)
563 {
564 /* Steal the data section header for this data2 section. */
565 memcpy (&NEW_SECTION_H (nn), &OLD_SECTION_H (old_data_index),
566 - new_file_h->e_shentsize);
567 + new_file_h->e_shentsize);
568
569 NEW_SECTION_H (nn).sh_addr = new_data2_addr;
570 NEW_SECTION_H (nn).sh_offset = new_data2_offset;
571 @@ -737,13 +952,17 @@
572 memcpy (&NEW_SECTION_H (nn), &OLD_SECTION_H (n),
573 old_file_h->e_shentsize);
574
575 - /* The new bss section's size is zero, and its file offset and virtual
576 - address should be off by NEW_DATA2_SIZE. */
577 - if (n == old_bss_index)
578 + if (n == old_bss_index
579 + /* The new bss and sbss section's size is zero, and its file offset
580 + and virtual address should be off by NEW_DATA2_SIZE. */
581 + || n == old_sbss_index
582 + )
583 {
584 - /* NN should be `old_bss_index + 1' at this point. */
585 - NEW_SECTION_H (nn).sh_offset += new_data2_size;
586 - NEW_SECTION_H (nn).sh_addr += new_data2_size;
587 + /* NN should be `old_s?bss_index + 1' at this point. */
588 + NEW_SECTION_H (nn).sh_offset =
589 + NEW_SECTION_H (new_data2_index).sh_offset + new_data2_size;
590 + NEW_SECTION_H (nn).sh_addr =
591 + NEW_SECTION_H (new_data2_index).sh_addr + new_data2_size;
592 /* Let the new bss section address alignment be the same as the
593 section address alignment followed the old bss section, so
594 this section will be placed in exactly the same place. */
595 @@ -767,7 +986,9 @@
596 >= OLD_SECTION_H (old_bss_index-1).sh_offset)
597 NEW_SECTION_H (nn).sh_offset += new_data2_size;
598 #else
599 - if (NEW_SECTION_H (nn).sh_offset >= new_data2_offset)
600 + if (round_up (NEW_SECTION_H (nn).sh_offset,
601 + OLD_SECTION_H (old_bss_index).sh_addralign)
602 + >= new_data2_offset)
603 NEW_SECTION_H (nn).sh_offset += new_data2_size;
604 #endif
605 /* Any section that was originally placed after the section
606 @@ -787,18 +1008,54 @@
607 if (NEW_SECTION_H (nn).sh_type != SHT_SYMTAB
608 && NEW_SECTION_H (nn).sh_type != SHT_DYNSYM)
609 PATCH_INDEX (NEW_SECTION_H (nn).sh_info);
610 +
611 + if (old_sbss_index != -1)
612 + if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".sbss"))
613 + {
614 + NEW_SECTION_H (nn).sh_offset =
615 + round_up (NEW_SECTION_H (nn).sh_offset,
616 + NEW_SECTION_H (nn).sh_addralign);
617 + NEW_SECTION_H (nn).sh_type = SHT_PROGBITS;
618 + }
619
620 /* Now, start to copy the content of sections. */
621 if (NEW_SECTION_H (nn).sh_type == SHT_NULL
622 || NEW_SECTION_H (nn).sh_type == SHT_NOBITS)
623 continue;
624
625 - /* Write out the sections. .data and .data1 (and data2, called
626 + /* Write out the sections. .data and .data1 (and data2, called
627 ".data" in the strings table) get copied from the current process
628 instead of the old file. */
629 if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data")
630 || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
631 - ".data1"))
632 + ".sdata")
633 + || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
634 + ".lit4")
635 + || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
636 + ".lit8")
637 + /* The conditional bit below was in Oliva's original code
638 + (1999-08-25) and seems to have been dropped by mistake
639 + subsequently. It prevents a crash at startup under X in
640 + `IRIX64 6.5 6.5.17m' with c_dev 7.3.1.3m. It causes no
641 + trouble on the other ELF platforms I could test (Irix
642 + 6.5.15m, Solaris 8, Debian Potato x86, Debian Woody
643 + SPARC); however, it's reported to cause crashes under
644 + some version of GNU/Linux. It's not yet clear what's
645 + changed in that Irix version to cause the problem, or why
646 + the fix sometimes fails under GNU/Linux. There's
647 + probably no good reason to have something Irix-specific
648 + here, but this will have to do for now. IRIX6_5 is the
649 + most specific macro we have to test. -- fx 2002-10-01 */
650 +#ifdef IRIX6_5
651 + || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
652 + ".got")
653 +#endif
654 + || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
655 + ".sdata1")
656 + || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
657 + ".data1")
658 + || !strcmp ((old_section_names + NEW_SECTION_H (n).sh_name),
659 + ".sbss"))
660 src = (caddr_t) OLD_SECTION_H (n).sh_addr;
661 else
662 src = old_base + OLD_SECTION_H (n).sh_offset;
663 @@ -806,13 +1063,114 @@
664 memcpy (NEW_SECTION_H (nn).sh_offset + new_base, src,
665 NEW_SECTION_H (nn).sh_size);
666
667 +#ifdef __alpha__
668 + /* Update Alpha COFF symbol table: */
669 + if (strcmp (old_section_names + OLD_SECTION_H (n).sh_name, ".mdebug")
670 + == 0)
671 + {
672 + pHDRR symhdr = (pHDRR) (NEW_SECTION_H (nn).sh_offset + new_base);
673 +
674 + symhdr->cbLineOffset += new_data2_size;
675 + symhdr->cbDnOffset += new_data2_size;
676 + symhdr->cbPdOffset += new_data2_size;
677 + symhdr->cbSymOffset += new_data2_size;
678 + symhdr->cbOptOffset += new_data2_size;
679 + symhdr->cbAuxOffset += new_data2_size;
680 + symhdr->cbSsOffset += new_data2_size;
681 + symhdr->cbSsExtOffset += new_data2_size;
682 + symhdr->cbFdOffset += new_data2_size;
683 + symhdr->cbRfdOffset += new_data2_size;
684 + symhdr->cbExtOffset += new_data2_size;
685 + }
686 +#endif /* __alpha__ */
687 +
688 +#if defined (__sony_news) && defined (_SYSTYPE_SYSV)
689 + if (NEW_SECTION_H (nn).sh_type == SHT_MIPS_DEBUG
690 + && old_mdebug_index != -1)
691 + {
692 + int diff = NEW_SECTION_H(nn).sh_offset
693 + - OLD_SECTION_H(old_mdebug_index).sh_offset;
694 + HDRR *phdr = (HDRR *)(NEW_SECTION_H (nn).sh_offset + new_base);
695 +
696 + if (diff)
697 + {
698 + phdr->cbLineOffset += diff;
699 + phdr->cbDnOffset += diff;
700 + phdr->cbPdOffset += diff;
701 + phdr->cbSymOffset += diff;
702 + phdr->cbOptOffset += diff;
703 + phdr->cbAuxOffset += diff;
704 + phdr->cbSsOffset += diff;
705 + phdr->cbSsExtOffset += diff;
706 + phdr->cbFdOffset += diff;
707 + phdr->cbRfdOffset += diff;
708 + phdr->cbExtOffset += diff;
709 + }
710 + }
711 +#endif /* __sony_news && _SYSTYPE_SYSV */
712 +
713 +#if __sgi
714 + /* Adjust the HDRR offsets in .mdebug and copy the
715 + line data if it's in its usual 'hole' in the object.
716 + Makes the new file debuggable with dbx.
717 + patches up two problems: the absolute file offsets
718 + in the HDRR record of .mdebug (see /usr/include/syms.h), and
719 + the ld bug that gets the line table in a hole in the
720 + elf file rather than in the .mdebug section proper.
721 + David Anderson. davea@×××.com Jan 16,1994. */
722 + if (n == old_mdebug_index)
723 + {
724 +#define MDEBUGADJUST(__ct,__fileaddr) \
725 + if (n_phdrr->__ct > 0) \
726 + { \
727 + n_phdrr->__fileaddr += movement; \
728 + }
729 +
730 + HDRR * o_phdrr = (HDRR *)((byte *)old_base + OLD_SECTION_H (n).sh_offset);
731 + HDRR * n_phdrr = (HDRR *)((byte *)new_base + NEW_SECTION_H (nn).sh_offset);
732 + unsigned movement = new_data2_size;
733 +
734 + MDEBUGADJUST (idnMax, cbDnOffset);
735 + MDEBUGADJUST (ipdMax, cbPdOffset);
736 + MDEBUGADJUST (isymMax, cbSymOffset);
737 + MDEBUGADJUST (ioptMax, cbOptOffset);
738 + MDEBUGADJUST (iauxMax, cbAuxOffset);
739 + MDEBUGADJUST (issMax, cbSsOffset);
740 + MDEBUGADJUST (issExtMax, cbSsExtOffset);
741 + MDEBUGADJUST (ifdMax, cbFdOffset);
742 + MDEBUGADJUST (crfd, cbRfdOffset);
743 + MDEBUGADJUST (iextMax, cbExtOffset);
744 + /* The Line Section, being possible off in a hole of the object,
745 + requires special handling. */
746 + if (n_phdrr->cbLine > 0)
747 + {
748 + if (o_phdrr->cbLineOffset > (OLD_SECTION_H (n).sh_offset
749 + + OLD_SECTION_H (n).sh_size))
750 + {
751 + /* line data is in a hole in elf. do special copy and adjust
752 + for this ld mistake.
753 + */
754 + n_phdrr->cbLineOffset += movement;
755 +
756 + memcpy (n_phdrr->cbLineOffset + new_base,
757 + o_phdrr->cbLineOffset + old_base, n_phdrr->cbLine);
758 + }
759 + else
760 + {
761 + /* somehow line data is in .mdebug as it is supposed to be. */
762 + MDEBUGADJUST (cbLine, cbLineOffset);
763 + }
764 + }
765 + }
766 +#endif /* __sgi */
767 +
768 /* If it is the symbol table, its st_shndx field needs to be patched. */
769 if (NEW_SECTION_H (nn).sh_type == SHT_SYMTAB
770 || NEW_SECTION_H (nn).sh_type == SHT_DYNSYM)
771 {
772 - Elf32_Shdr *spt = &NEW_SECTION_H (nn);
773 + ElfW(Shdr) *spt = &NEW_SECTION_H (nn);
774 unsigned int num = spt->sh_size / spt->sh_entsize;
775 - Elf32_Sym * sym = (Elf32_Sym *) (NEW_SECTION_H (nn).sh_offset +
776 + ElfW(Sym) * sym = (ElfW(Sym) *) (NEW_SECTION_H (nn).sh_offset +
777 new_base);
778 for (; num--; sym++)
779 {
780 @@ -830,7 +1188,7 @@
781 for (n = new_file_h->e_shnum - 1; n; n--)
782 {
783 byte *symnames;
784 - Elf32_Sym *symp, *symendp;
785 + ElfW(Sym) *symp, *symendp;
786
787 if (NEW_SECTION_H (n).sh_type != SHT_DYNSYM
788 && NEW_SECTION_H (n).sh_type != SHT_SYMTAB)
789 @@ -838,12 +1196,14 @@
790
791 symnames = ((byte *) new_base
792 + NEW_SECTION_H (NEW_SECTION_H (n).sh_link).sh_offset);
793 - symp = (Elf32_Sym *) (NEW_SECTION_H (n).sh_offset + new_base);
794 - symendp = (Elf32_Sym *) ((byte *)symp + NEW_SECTION_H (n).sh_size);
795 + symp = (ElfW(Sym) *) (NEW_SECTION_H (n).sh_offset + new_base);
796 + symendp = (ElfW(Sym) *) ((byte *)symp + NEW_SECTION_H (n).sh_size);
797
798 for (; symp < symendp; symp ++)
799 if (strcmp ((char *) (symnames + symp->st_name), "_end") == 0
800 - || strcmp ((char *) (symnames + symp->st_name), "_edata") == 0)
801 + || strcmp ((char *) (symnames + symp->st_name), "end") == 0
802 + || strcmp ((char *) (symnames + symp->st_name), "_edata") == 0
803 + || strcmp ((char *) (symnames + symp->st_name), "edata") == 0)
804 memcpy (&symp->st_value, &new_bss_addr, sizeof (new_bss_addr));
805 }
806
807 @@ -851,7 +1211,7 @@
808 that it can undo relocations performed by the runtime linker. */
809 for (n = new_file_h->e_shnum - 1; n; n--)
810 {
811 - Elf32_Shdr section = NEW_SECTION_H (n);
812 + ElfW(Shdr) section = NEW_SECTION_H (n);
813 switch (section.sh_type) {
814 default:
815 break;
816 @@ -863,37 +1223,65 @@
817 nn = section.sh_info;
818 if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data")
819 || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
820 + ".sdata")
821 + || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
822 + ".lit4")
823 + || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
824 + ".lit8")
825 +#ifdef IRIX6_5 /* see above */
826 + || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
827 + ".got")
828 +#endif
829 + || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
830 + ".sdata1")
831 + || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
832 ".data1"))
833 {
834 - Elf32_Addr offset = NEW_SECTION_H (nn).sh_addr -
835 + ElfW(Addr) offset = NEW_SECTION_H (nn).sh_addr -
836 NEW_SECTION_H (nn).sh_offset;
837 caddr_t reloc = old_base + section.sh_offset, end;
838 for (end = reloc + section.sh_size; reloc < end;
839 reloc += section.sh_entsize)
840 {
841 - Elf32_Addr addr = ((Elf32_Rel *) reloc)->r_offset - offset;
842 - memcpy (new_base + addr, old_base + addr, 4);
843 - }
844 + ElfW(Addr) addr = ((ElfW(Rel) *) reloc)->r_offset - offset;
845 +#ifdef __alpha__
846 + /* The Alpha ELF binutils currently have a bug that
847 + sometimes results in relocs that contain all
848 + zeroes. Work around this for now... */
849 + if (((ElfW(Rel) *) reloc)->r_offset == 0)
850 + continue;
851 +#endif
852 + memcpy (new_base + addr, old_base + addr, sizeof(ElfW(Addr)));
853 + }
854 }
855 break;
856 }
857 }
858
859 -#ifdef UNEXEC_USE_MAP_PRIVATE
860 - if (lseek (new_file, 0, SEEK_SET) == -1)
861 - fatal ("Can't rewind (%s): errno %d\n", new_name, errno);
862 + /* Write out new_file, close it, and free the buffer containing its
863 + * contents */
864
865 if (write (new_file, new_base, new_file_size) != new_file_size)
866 - fatal ("Can't write (%s): errno %d\n", new_name, errno);
867 -#endif
868 + fatal ("Didn't write %d bytes to %s: errno %d\n",
869 + new_file_size, new_base, errno);
870 +
871 + if (close (new_file))
872 + fatal ("Can't close (%s): errno %d\n", new_name, errno);
873 +
874 + munmap (new_base, new_file_size);
875
876 - /* Close the files and make the new file executable. */
877 + /* Close old_file, and free the corresponding buffer */
878 +
879 +#if MAP_ANON == 0
880 + close (mmap_fd);
881 +#endif
882
883 if (close (old_file))
884 fatal ("Can't close (%s): errno %d\n", old_name, errno);
885
886 - if (close (new_file))
887 - fatal ("Can't close (%s): errno %d\n", new_name, errno);
888 + munmap (old_base, old_file_size);
889 +
890 + /* Make the new file executable */
891
892 if (stat (new_name, &stat_buf) == -1)
893 fatal ("Can't stat (%s): errno %d\n", new_name, errno);
894
895
896
897 1.1 src/patchsets/emacs/18.59/02_all_gentoo.patch
898
899 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/emacs/18.59/02_all_gentoo.patch?rev=1.1&view=markup
900 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/emacs/18.59/02_all_gentoo.patch?rev=1.1&content-type=text/plain
901
902 Index: 02_all_gentoo.patch
903 ===================================================================
904 Prereq: 2004-03-08
905 diff -Nur emacs-18.59-orig/src/ChangeLog emacs-18.59/src/ChangeLog
906 --- emacs-18.59-orig/src/ChangeLog 2004-03-08 09:38:50.000000000 +0100
907 +++ emacs-18.59/src/ChangeLog 2004-03-09 08:36:49.000000000 +0100
908 @@ -1,3 +1,9 @@
909 +2004-03-09 Ulrich Mueller <ulm@×××××××××××××.de>
910 +
911 + * malloc.c (DONT_DEFINE_SIGNAL): Defined.
912 +
913 + * s-linux.h (TERMINFO): Moved here from ymakefile.
914 +
915 2004-03-08 Ulrich Mueller <ulm@×××××××××××××.de>
916
917 * unexelf.c: Replaced with version from Emacs 21.3.
918 diff -Nur emacs-18.59-orig/src/malloc.c emacs-18.59/src/malloc.c
919 --- emacs-18.59-orig/src/malloc.c 1992-03-23 05:09:07.000000000 +0100
920 +++ emacs-18.59/src/malloc.c 2004-03-09 08:33:12.000000000 +0100
921 @@ -59,6 +59,9 @@
922 */
923
924 #ifdef emacs
925 +/* Inhibit macro definition of "signal" in m-*.h */
926 +#define DONT_DEFINE_SIGNAL
927 +
928 /* config.h specifies which kind of system this is. */
929 #include "config.h"
930
931 diff -Nur emacs-18.59-orig/src/s-linux.h emacs-18.59/src/s-linux.h
932 --- emacs-18.59-orig/src/s-linux.h 1999-11-05 09:17:23.000000000 +0100
933 +++ emacs-18.59/src/s-linux.h 2004-03-09 08:34:05.000000000 +0100
934 @@ -164,6 +164,9 @@
935 #define POSIX /* affects only getpagesize.h */
936 #define POSIX_SIGNALS /* uses sigaction from sys_signal */
937
938 +/* Use terminfo instead of termcap. */
939 +#define TERMINFO
940 +
941 #ifdef HAVE_PTMX
942
943 /* This change means that we don't loop through allocate_pty too many
944 @@ -250,7 +253,7 @@
945
946 #define C_COMPILER gcc
947 #define C_DEBUG_SWITCH -g
948 -#define C_OPTIMIZE_SWITCH -O3 -malign-loops=2 -malign-jumps=2 -malign-functions=2
949 +#define C_OPTIMIZE_SWITCH -O2 -malign-loops=2 -malign-jumps=2 -malign-functions=2
950 #define OLDXMENU_OPTIONS CFLAGS=-O2 EXTRA=insque.o
951 #define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
952 #define LIBS_DEBUG /* override in config.h to include -lg */
953 diff -Nur emacs-18.59-orig/src/ymakefile emacs-18.59/src/ymakefile
954 --- emacs-18.59-orig/src/ymakefile 1999-11-05 09:19:47.000000000 +0100
955 +++ emacs-18.59/src/ymakefile 2003-11-13 08:35:38.000000000 +0100
956 @@ -191,7 +191,7 @@
957 SHORT= shortnames
958 #endif /* SHORTNAMES */
959
960 -CFLAGS= C_DEBUG_SWITCH C_OPTIMIZE_SWITCH -Demacs $(MYCPPFLAG) C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM
961 +CFLAGS= C_OPTIMIZE_SWITCH -Demacs $(MYCPPFLAG) C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM
962 /* DO NOT use -R. There is a special hack described in lastfile.c
963 which is used instead. Some initialized data areas are modified
964 at initial startup, then labeled as part of the text area when
965 @@ -284,7 +284,6 @@
966 process.o callproc.o $(environobj) \
967 doprnt.o
968
969 -#define TERMINFO
970 #ifdef TERMINFO
971 /* Used to be -ltermcap here. If your machine needs that,
972 define LIBS_TERMCAP in the m- file. */
973 diff -Nur emacs-18.59-orig/lisp/ChangeLog emacs-18.59/lisp/ChangeLog
974 --- emacs-18.59-orig/lisp/ChangeLog 1992-10-31 01:32:00.000000000 +0100
975 +++ emacs-18.59/lisp/ChangeLog 2004-03-08 09:37:21.000000000 +0100
976 @@ -1,3 +1,9 @@
977 +2004-03-08 Ulrich Mueller <ulm@×××××××××××××.de>
978 +
979 + * term/linux.el: New file.
980 +
981 + * term/xterm.el: Load vt200.el.
982 +
983 Fri Oct 30 19:36:38 1992 Richard Stallman (rms@×××××××××××××××.edu)
984
985 * Version 18.59 released.
986 diff -Nur emacs-18.59-orig/lisp/term/linux.el emacs-18.59/lisp/term/linux.el
987 --- emacs-18.59-orig/lisp/term/linux.el 1970-01-01 01:00:00.000000000 +0100
988 +++ emacs-18.59/lisp/term/linux.el 2003-11-29 21:37:15.000000000 +0100
989 @@ -0,0 +1,2 @@
990 +(load (concat term-file-prefix "vt200") nil t)
991 +(enable-arrow-keys)
992 diff -Nur emacs-18.59-orig/lisp/term/xterm.el emacs-18.59/lisp/term/xterm.el
993 --- emacs-18.59-orig/lisp/term/xterm.el 1989-04-27 03:52:39.000000000 +0200
994 +++ emacs-18.59/lisp/term/xterm.el 2003-11-29 21:37:15.000000000 +0100
995 @@ -1,2 +1,2 @@
996 -;; Don't send the `ti' string when screen is cleared.
997 -(setq reset-terminal-on-clear nil)
998 +(load (concat term-file-prefix "vt200") nil t)
999 +(enable-arrow-keys)
1000
1001
1002
1003 1.1 src/patchsets/emacs/18.59/03_all_gcc4.patch
1004
1005 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/emacs/18.59/03_all_gcc4.patch?rev=1.1&view=markup
1006 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/emacs/18.59/03_all_gcc4.patch?rev=1.1&content-type=text/plain
1007
1008 Index: 03_all_gcc4.patch
1009 ===================================================================
1010 Prereq: 2004-03-09
1011 diff -ur emacs-18.59-orig/src/ChangeLog emacs-18.59/src/ChangeLog
1012 --- emacs-18.59-orig/src/ChangeLog 2004-03-09 08:36:49.000000000 +0100
1013 +++ emacs-18.59/src/ChangeLog 2007-01-29 21:47:56.000000000 +0100
1014 @@ -1,3 +1,11 @@
1015 +2007-01-29 Ulrich Mueller <ulm@×××××××××××××.de>
1016 +
1017 + * x11term.c (internal_socket_read): Handle XK_BackSpace key.
1018 +
1019 + * callproc.c, doprnt.c, emacssignal.h, fns.c, lisp.h, lread.c,
1020 + malloc.c, process.c, s-linux.h, sysdep.c, terminfo.c, x11term.c:
1021 + Fix GCC 4.1 compilation issues.
1022 +
1023 2004-03-09 Ulrich Mueller <ulm@×××××××××××××.de>
1024
1025 * malloc.c (DONT_DEFINE_SIGNAL): Defined.
1026 diff -ur emacs-18.59-orig/src/alloc.c emacs-18.59/src/alloc.c
1027 --- emacs-18.59-orig/src/alloc.c 1992-09-21 07:45:30.000000000 +0200
1028 +++ emacs-18.59/src/alloc.c 2007-01-29 21:47:56.000000000 +0100
1029 @@ -1073,7 +1073,7 @@
1030 mark_object (&ptr->contents[i]);
1031 }
1032 break;
1033 -#endif 0
1034 +#endif
1035
1036 case Lisp_Symbol:
1037 {
1038 @@ -1310,7 +1310,7 @@
1039 }
1040 }
1041
1042 -#endif standalone
1043 +#endif /* standalone */
1044
1045 /* Free all unmarked vectors */
1046 {
1047 diff -ur emacs-18.59-orig/src/buffer.c emacs-18.59/src/buffer.c
1048 --- emacs-18.59-orig/src/buffer.c 1992-05-13 21:39:33.000000000 +0200
1049 +++ emacs-18.59/src/buffer.c 2007-01-29 21:47:56.000000000 +0100
1050 @@ -331,7 +331,7 @@
1051 return XBUFFER (buffer)->number;
1052 }
1053 */
1054 -#endif NOTDEF
1055 +#endif /* NOTDEF */
1056
1057 DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0,
1058 "Return name of file BUFFER is visiting, or NIL if none.\n\
1059 @@ -601,7 +601,7 @@
1060
1061 #ifdef subprocesses
1062 kill_buffer_processes (buf);
1063 -#endif subprocesses
1064 +#endif
1065
1066 tem = Vinhibit_quit;
1067 Vinhibit_quit = Qt;
1068 diff -ur emacs-18.59-orig/src/callproc.c emacs-18.59/src/callproc.c
1069 --- emacs-18.59-orig/src/callproc.c 1992-07-12 05:26:01.000000000 +0200
1070 +++ emacs-18.59/src/callproc.c 2007-01-29 21:47:56.000000000 +0100
1071 @@ -21,6 +21,7 @@
1072 /* This must precede sys/signal.h on certain machines. */
1073 #include <sys/types.h>
1074 #include <signal.h>
1075 +#include <unistd.h>
1076
1077 #include "config.h"
1078
1079 @@ -241,7 +242,7 @@
1080 {
1081 #ifndef subprocesses
1082 wait_without_blocking ();
1083 -#endif subprocesses
1084 +#endif
1085 return Qnil;
1086 }
1087
1088 @@ -413,7 +414,7 @@
1089
1090 #ifdef vipc
1091 something missing here;
1092 -#endif vipc
1093 +#endif
1094
1095 /* execvp does not accept an environment arg so the only way
1096 to pass this environment is to set environ. Our caller
1097 diff -ur emacs-18.59-orig/src/dispnew.c emacs-18.59/src/dispnew.c
1098 --- emacs-18.59-orig/src/dispnew.c 1992-07-24 21:31:36.000000000 +0200
1099 +++ emacs-18.59/src/dispnew.c 2007-01-29 21:47:56.000000000 +0100
1100 @@ -586,15 +586,15 @@
1101 {
1102 #ifndef COMPILER_REGISTER_BUG
1103 register
1104 -#endif COMPILER_REGISTER_BUG
1105 +#endif
1106 struct window *w = XWINDOW (selected_window);
1107 #ifndef COMPILER_REGISTER_BUG
1108 register
1109 -#endif COMPILER_REGISTER_BUG
1110 +#endif
1111 int hpos = cursor_hpos;
1112 #ifndef COMPILER_REGISTER_BUG
1113 register
1114 -#endif COMPILER_REGISTER_BUG
1115 +#endif
1116 int vpos = cursor_vpos;
1117
1118 /* Give up if about to continue line */
1119 diff -ur emacs-18.59-orig/src/doprnt.c emacs-18.59/src/doprnt.c
1120 --- emacs-18.59-orig/src/doprnt.c 1991-01-08 18:26:23.000000000 +0100
1121 +++ emacs-18.59/src/doprnt.c 2007-01-29 21:47:56.000000000 +0100
1122 @@ -22,6 +22,7 @@
1123
1124 #include <stdio.h>
1125 #include <ctype.h>
1126 +#include "config.h"
1127
1128 doprnt (buffer, bufsize, format, nargs, args)
1129 char *buffer;
1130 diff -ur emacs-18.59-orig/src/editfns.c emacs-18.59/src/editfns.c
1131 --- emacs-18.59-orig/src/editfns.c 1992-08-08 01:38:16.000000000 +0200
1132 +++ emacs-18.59/src/editfns.c 2007-01-29 21:47:56.000000000 +0100
1133 @@ -1046,7 +1046,7 @@
1134 return Qnil;
1135 return build_string (val);
1136 }
1137 -#endif MAINTAIN_ENVIRONMENT
1138 +#endif /* MAINTAIN_ENVIRONMENT */
1139
1140 void
1141 syms_of_editfns ()
1142 diff -ur emacs-18.59-orig/src/emacs.c emacs-18.59/src/emacs.c
1143 --- emacs-18.59-orig/src/emacs.c 1992-10-17 04:51:00.000000000 +0100
1144 +++ emacs-18.59/src/emacs.c 2007-01-29 21:47:56.000000000 +0100
1145 @@ -314,7 +314,7 @@
1146 #ifdef HIGHPRI
1147 setpriority (PRIO_PROCESS, getpid (), HIGHPRI);
1148 setuid (getuid ());
1149 -#endif HIGHPRI
1150 +#endif
1151
1152 inhibit_window_system = 0;
1153
1154 @@ -402,7 +402,7 @@
1155 #endif
1156 #ifdef SIGXFSZ
1157 signal (SIGXFSZ, fatal_error_signal);
1158 -#endif SIGXFSZ
1159 +#endif
1160
1161 #ifdef AIX
1162 /* This used to run fatal_error_signal,
1163 @@ -489,7 +489,7 @@
1164 syms_of_alloc ();
1165 #ifdef MAINTAIN_ENVIRONMENT
1166 syms_of_environ ();
1167 -#endif MAINTAIN_ENVIRONMENT
1168 +#endif /* MAINTAIN_ENVIRONMENT */
1169 syms_of_read ();
1170 syms_of_print ();
1171 syms_of_eval ();
1172 diff -ur emacs-18.59-orig/src/emacssignal.h emacs-18.59/src/emacssignal.h
1173 --- emacs-18.59-orig/src/emacssignal.h 1991-12-31 21:52:31.000000000 +0100
1174 +++ emacs-18.59/src/emacssignal.h 2007-01-29 21:47:56.000000000 +0100
1175 @@ -22,7 +22,8 @@
1176 #define sighold(SIG) ONLY_USED_IN_BSD_4_1
1177 #define sigrelse(SIG) ONLY_USED_IN_BSD_4_1
1178
1179 -int (*sys_signal (int signal_number, int (*action)())) ();
1180 +typedef void (*signal_handler_t) ();
1181 +signal_handler_t sys_signal (int signal_number, signal_handler_t action);
1182 int sys_sigpause (sigset_t new_mask);
1183 sigset_t sys_sigblock (sigset_t new_mask);
1184 sigset_t sys_sigunblock (sigset_t new_mask);
1185 diff -ur emacs-18.59-orig/src/fileio.c emacs-18.59/src/fileio.c
1186 --- emacs-18.59-orig/src/fileio.c 1998-05-31 05:34:39.000000000 +0200
1187 +++ emacs-18.59/src/fileio.c 2007-01-29 21:47:56.000000000 +0100
1188 @@ -784,7 +784,7 @@
1189 if (o == target + 1 && o[-1] == '/' && o[0] == '/')
1190 ++o;
1191 else
1192 -#endif APOLLO
1193 +#endif /* APOLLO */
1194 if (o == target && *o == '/')
1195 ++o;
1196 p += 3;
1197 diff -ur emacs-18.59-orig/src/fns.c emacs-18.59/src/fns.c
1198 --- emacs-18.59-orig/src/fns.c 1992-10-17 04:54:17.000000000 +0100
1199 +++ emacs-18.59/src/fns.c 2007-01-29 21:47:56.000000000 +0100
1200 @@ -90,8 +90,6 @@
1201 (arg)
1202 Lisp_Object arg;
1203 {
1204 - extern long random ();
1205 - extern srandom ();
1206 extern long time ();
1207
1208 if (EQ (arg, Qt))
1209 diff -ur emacs-18.59-orig/src/lisp.h emacs-18.59/src/lisp.h
1210 --- emacs-18.59-orig/src/lisp.h 1992-03-06 00:11:31.000000000 +0100
1211 +++ emacs-18.59/src/lisp.h 2004-05-13 02:56:53.000000000 +0200
1212 @@ -983,7 +983,6 @@
1213
1214 extern void debugger ();
1215
1216 -extern char *malloc (), *realloc (), *getenv (), *ctime (), *getwd ();
1217 extern long *xmalloc (), *xrealloc ();
1218
1219 #ifdef MAINTAIN_ENVIRONMENT
1220 diff -ur emacs-18.59-orig/src/lread.c emacs-18.59/src/lread.c
1221 --- emacs-18.59-orig/src/lread.c 1992-03-23 05:18:17.000000000 +0100
1222 +++ emacs-18.59/src/lread.c 2007-01-29 21:47:56.000000000 +0100
1223 @@ -229,7 +229,7 @@
1224 Lisp_Object stream;
1225 {
1226 fclose (*(FILE **) XSTRING (stream));
1227 - free (XPNTR (stream));
1228 + free ((void *)(XPNTR (stream)));
1229 if (--load_in_progress < 0) load_in_progress = 0;
1230 return Qnil;
1231 }
1232 @@ -465,7 +465,7 @@
1233 return Qnil;
1234 }
1235
1236 -#endif standalone
1237 +#endif /* standalone */
1238
1239 DEFUN ("read", Fread, Sread, 0, 1, 0,
1240 "Read one Lisp expression as text from STREAM, return as Lisp object.\n\
1241 @@ -1141,7 +1141,7 @@
1242 sym = intern (string);
1243 XSET (XSYMBOL (sym)->function, Lisp_Subr, sname);
1244 }
1245 -#endif NOTDEF
1246 +#endif /* NOTDEF */
1247
1248 /* New replacement for DefIntVar; it ignores the doc string argument
1249 on the assumption that make-docfile will handle that. */
1250 @@ -1230,7 +1230,7 @@
1251 abort ();
1252 }
1253
1254 -#endif standalone
1255 +#endif /* standalone */
1256
1257 init_read ()
1258 {
1259 diff -ur emacs-18.59-orig/src/malloc.c emacs-18.59/src/malloc.c
1260 --- emacs-18.59-orig/src/malloc.c 2004-03-09 08:33:12.000000000 +0100
1261 +++ emacs-18.59/src/malloc.c 2007-01-29 21:47:56.000000000 +0100
1262 @@ -213,8 +213,6 @@
1263
1264 static void getpool ();
1265
1266 -char *malloc ();
1267 -
1268 /* Cause reinitialization based on job parameters;
1269 also declare where the end of pure storage is. */
1270 void
1271 @@ -412,7 +410,7 @@
1272 }
1273 }
1274
1275 -char *
1276 +void *
1277 malloc (n) /* get a block */
1278 unsigned n;
1279 {
1280 @@ -488,8 +486,9 @@
1281 return (char *) p + ((sizeof *p + 7) & ~7);
1282 }
1283
1284 +void
1285 free (mem)
1286 - char *mem;
1287 + void *mem;
1288 {
1289 register struct mhead *p;
1290 {
1291 @@ -509,7 +508,7 @@
1292 if (p -> mh_alloc != ISALLOC)
1293 abort ();
1294
1295 -#else rcheck
1296 +#else /* rcheck */
1297 if (p -> mh_alloc != ISALLOC)
1298 {
1299 if (p -> mh_alloc == ISFREE)
1300 @@ -544,9 +543,9 @@
1301 }
1302 }
1303
1304 -char *
1305 +void *
1306 realloc (mem, n)
1307 - char *mem;
1308 + void *mem;
1309 register unsigned n;
1310 {
1311 register struct mhead *p;
1312 @@ -606,7 +605,7 @@
1313
1314 /* This is in case something linked with Emacs calls calloc. */
1315
1316 -char *
1317 +void *
1318 calloc (num, size)
1319 unsigned num, size;
1320 {
1321 @@ -621,8 +620,9 @@
1322
1323 /* This is in case something linked with Emacs calls cfree. */
1324
1325 +void
1326 cfree (mem)
1327 - char *mem;
1328 + void *mem;
1329 {
1330 return free (mem);
1331 }
1332 @@ -656,8 +656,8 @@
1333 #ifndef HPUX
1334 /* This runs into trouble with getpagesize on HPUX.
1335 Patching out seems cleaner than the ugly fix needed. */
1336 -char *
1337 -valloc (size)
1338 +void *
1339 +valloc (size_t size)
1340 {
1341 return memalign (getpagesize (), size);
1342 }
1343 diff -ur emacs-18.59-orig/src/mocklisp.c emacs-18.59/src/mocklisp.c
1344 --- emacs-18.59-orig/src/mocklisp.c 1991-01-08 19:00:01.000000000 +0100
1345 +++ emacs-18.59/src/mocklisp.c 2007-01-29 21:47:56.000000000 +0100
1346 @@ -193,7 +193,7 @@
1347 XSETINT (to, XINT (to) + XINT (from));
1348 return Fsubstring (string, from, to);
1349 }
1350 -#endif NOTDEF
1351 +#endif /* NOTDEF */
1352 DEFUN ("insert-string", Finsert_string, Sinsert_string, 0, MANY, 0,
1353 "Mocklisp-compatibility insert function.\n\
1354 Like the function `insert' except that any argument that is a number\n\
1355 diff -ur emacs-18.59-orig/src/process.c emacs-18.59/src/process.c
1356 --- emacs-18.59-orig/src/process.c 1998-05-31 05:34:40.000000000 +0200
1357 +++ emacs-18.59/src/process.c 2007-01-29 21:47:56.000000000 +0100
1358 @@ -1438,7 +1438,7 @@
1359
1360 while (1)
1361 {
1362 - int value = connect (s, &address, sizeof address);
1363 + int value = connect (s, (struct sockaddr *)&address, sizeof address);
1364 /* Continue if successeful. */
1365 if (value != -1)
1366 break;
1367 @@ -1592,7 +1592,8 @@
1368 int xerrno;
1369 Lisp_Object proc;
1370 #ifdef HAVE_TIMEVAL
1371 - struct timeval timeout, end_time, garbage;
1372 + struct timeval timeout, end_time;
1373 + struct timezone garbage;
1374 #else
1375 long timeout, end_time, temp;
1376 #endif /* not HAVE_TIMEVAL */
1377 diff -ur emacs-18.59-orig/src/regex.c emacs-18.59/src/regex.c
1378 --- emacs-18.59-orig/src/regex.c 1992-07-07 17:35:33.000000000 +0200
1379 +++ emacs-18.59/src/regex.c 2007-01-29 21:47:56.000000000 +0100
1380 @@ -90,7 +90,7 @@
1381
1382 #ifndef NFAILURES
1383 #define NFAILURES 80
1384 -#endif NFAILURES
1385 +#endif
1386
1387 /* width of a byte in bits */
1388
1389 @@ -536,7 +536,7 @@
1390 PATFETCH (c);
1391 PATPUSH (syntax_spec_code[c]);
1392 break;
1393 -#endif emacs
1394 +#endif /* emacs */
1395
1396 case 'w':
1397 laststart = b;
1398 @@ -833,7 +833,7 @@
1399 if (SYNTAX (j) != (enum syntaxcode) k)
1400 fastmap[j] = 1;
1401 break;
1402 -#endif emacs
1403 +#endif /* emacs */
1404
1405 case charset:
1406 for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
1407 @@ -1475,7 +1475,7 @@
1408 PREFETCH;
1409 if (SYNTAX (*d++) != 0) goto fail;
1410 break;
1411 -#endif not emacs
1412 +#endif /* not emacs */
1413
1414 case begbuf:
1415 if (d == string1) /* Note, d cannot equal string2 */
1416 @@ -1722,4 +1722,4 @@
1417 exit (1);
1418 }
1419
1420 -#endif test
1421 +#endif /* test */
1422 diff -ur emacs-18.59-orig/src/s-linux.h emacs-18.59/src/s-linux.h
1423 --- emacs-18.59-orig/src/s-linux.h 2004-03-09 08:34:05.000000000 +0100
1424 +++ emacs-18.59/src/s-linux.h 2007-01-29 21:47:56.000000000 +0100
1425 @@ -126,6 +126,11 @@
1426
1427 /* Special hacks needed to make Emacs run on this system. */
1428
1429 +#ifdef emacs
1430 +#include <stdlib.h>
1431 +#include <string.h>
1432 +#endif
1433 +
1434 /* On USG systems the system calls are interruptable by signals
1435 that the user program has elected to catch. Thus the system call
1436 must be retried in these cases. To handle this without massive
1437 @@ -224,6 +229,7 @@
1438 #define MAXNAMLEN NAME_MAX /* missing SYSV-ism */
1439 #endif
1440
1441 +#undef SIGSYS
1442 #define SIGSYS SIGUNUSED /* rename to harmless work-alike */
1443 #define VSWTCH VSWTC /* mis-spelling in termios.h? */
1444
1445 @@ -253,7 +259,7 @@
1446
1447 #define C_COMPILER gcc
1448 #define C_DEBUG_SWITCH -g
1449 -#define C_OPTIMIZE_SWITCH -O2 -malign-loops=2 -malign-jumps=2 -malign-functions=2
1450 +#define C_OPTIMIZE_SWITCH -O2 -falign-loops=2 -falign-jumps=2 -falign-functions=2
1451 #define OLDXMENU_OPTIONS CFLAGS=-O2 EXTRA=insque.o
1452 #define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
1453 #define LIBS_DEBUG /* override in config.h to include -lg */
1454 diff -ur emacs-18.59-orig/src/sysdep.c emacs-18.59/src/sysdep.c
1455 --- emacs-18.59-orig/src/sysdep.c 1998-05-31 05:34:43.000000000 +0200
1456 +++ emacs-18.59/src/sysdep.c 2007-01-29 21:47:56.000000000 +0100
1457 @@ -2051,8 +2051,6 @@
1458 #endif
1459 }
1460
1461 -typedef int (*signal_handler_t) ();
1462 -
1463 signal_handler_t
1464 sys_signal (int signal_number, signal_handler_t action)
1465 {
1466 @@ -2063,7 +2061,7 @@
1467 #else
1468 sigemptyset (&new_action.sa_mask);
1469 new_action.sa_handler = action;
1470 - new_action.sa_flags = NULL;
1471 + new_action.sa_flags = 0;
1472 sigaction (signal_number, &new_action, &old_action);
1473 return (old_action.sa_handler);
1474 #endif /* DGUX */
1475 diff -ur emacs-18.59-orig/src/terminfo.c emacs-18.59/src/terminfo.c
1476 --- emacs-18.59-orig/src/terminfo.c 1991-01-08 19:09:05.000000000 +0100
1477 +++ emacs-18.59/src/terminfo.c 2007-01-29 21:47:56.000000000 +0100
1478 @@ -17,6 +17,8 @@
1479 along with GNU Emacs; see the file COPYING. If not, write to
1480 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
1481
1482 +#include "config.h"
1483 +
1484 /* Define these variables that serve as global parameters to termcap,
1485 so that we do not need to conditionalize the places in Emacs
1486 that set them. */
1487 diff -ur emacs-18.59-orig/src/x11fns.c emacs-18.59/src/x11fns.c
1488 --- emacs-18.59-orig/src/x11fns.c 1992-07-15 21:38:49.000000000 +0200
1489 +++ emacs-18.59/src/x11fns.c 2007-01-29 21:47:56.000000000 +0100
1490 @@ -884,7 +884,7 @@
1491 rawshift = (((unsigned) (XINT (shift_mask))) & 15) << 11;
1492 XRebindCode (rawkey, rawshift, rawstring, strsize);
1493 }
1494 -#endif notdef
1495 +#endif /* notdef */
1496 return Qnil;
1497 }
1498
1499 @@ -918,11 +918,11 @@
1500 XRebindCode (rawkey, i << 11, rawstring, strsize);
1501 }
1502 }
1503 -#endif notdef
1504 +#endif /* notdef */
1505 return Qnil;
1506 }
1507
1508 -#endif foobar
1509 +#endif /* foobar */
1510
1511 XExitWithCoreDump ()
1512 {
1513 @@ -988,7 +988,7 @@
1514 defsubr (&Sx_set_font);
1515 #ifdef notdef
1516 defsubr (&Sx_set_icon);
1517 -#endif notdef
1518 +#endif
1519 defsubr (&Scoordinates_in_window_p);
1520 defsubr (&Sx_mouse_events);
1521 defsubr (&Sx_proc_mouse_event);
1522 @@ -1012,7 +1012,7 @@
1523 #ifdef notdef
1524 defsubr (&Sx_rebind_key);
1525 defsubr (&Sx_rebind_keys);
1526 -#endif notdef
1527 +#endif
1528 defsubr (&Sx_debug);
1529 }
1530
1531 diff -ur emacs-18.59-orig/src/x11term.c emacs-18.59/src/x11term.c
1532 --- emacs-18.59-orig/src/x11term.c 1992-10-24 05:31:56.000000000 +0100
1533 +++ emacs-18.59/src/x11term.c 2007-01-29 21:47:56.000000000 +0100
1534 @@ -33,1 +33,1 @@
1535 -#endif lint
1536 +#endif
1537 @@ -1482,6 +1482,10 @@
1538 strcpy(mapping_buf,"\016");
1539 nbytes = 1;
1540 break;
1541 + case XK_BackSpace:
1542 + strcpy(mapping_buf,"\177");
1543 + nbytes = 1;
1544 + break;
1545 }
1546 #ifndef AIX
1547 }
1548 @@ -1715,7 +1719,6 @@
1549
1550 extern char *getenv ();
1551 extern XTinterrupt_signal ();
1552 - extern char *malloc ();
1553 extern Lisp_Object Vxterm, Vxterm1, Qt;
1554 extern int XIgnoreError();
1555 int ix;
1556 diff -ur emacs-18.59-orig/src/xdisp.c emacs-18.59/src/xdisp.c
1557 --- emacs-18.59-orig/src/xdisp.c 1992-07-24 21:08:13.000000000 +0200
1558 +++ emacs-18.59/src/xdisp.c 2007-01-29 21:47:56.000000000 +0100
1559 @@ -2107,7 +2107,7 @@
1560 Lisp_Object root_window;
1561 #ifndef COMPILER_REGISTER_BUG
1562 register
1563 -#endif COMPILER_REGISTER_BUG
1564 +#endif
1565 struct window *mini_w;
1566
1567 this_line_bufpos = 0;
1568 diff -ur emacs-18.59-orig/etc/ChangeLog emacs-18.59/etc/ChangeLog
1569 --- emacs-18.59-orig/etc/ChangeLog 1998-05-31 05:34:34.000000000 +0200
1570 +++ emacs-18.59/etc/ChangeLog 2007-01-29 21:47:56.000000000 +0100
1571 @@ -1,3 +1,11 @@
1572 +2007-01-29 Ulrich Mueller <ulm@×××××××××××××.de>
1573 +
1574 + * emacsclient.c, server.c: Check for HAVE_SOCKETS instead of BSD.
1575 +
1576 + * cvtmail.c, emacsclient.c, env.c, etags.c, fakemail.c,
1577 + make-docfile.c, movemail.c, server.c, sorted-doc.c,
1578 + test-distrib.c, wakeup.c, yow.c: Fix GCC 4.1 compilation issues.
1579 +
1580 1998-05-30 Noah Friedman <friedman@××××××.com>
1581
1582 * env.c (main): Declare sys_errlist if linux + glibc2.
1583 diff -ur emacs-18.59-orig/etc/cvtmail.c emacs-18.59/etc/cvtmail.c
1584 --- emacs-18.59-orig/etc/cvtmail.c 1991-01-08 20:06:08.000000000 +0100
1585 +++ emacs-18.59/etc/cvtmail.c 2007-01-29 21:47:56.000000000 +0100
1586 @@ -36,7 +36,10 @@
1587
1588
1589 #include <stdio.h>
1590 +#include <stdlib.h>
1591 +#include <string.h>
1592
1593 +void *xmalloc(), *xrealloc();
1594
1595 main (argc, argv)
1596 int argc;
1597 @@ -109,22 +112,22 @@
1598 ;
1599 }
1600
1601 -int
1602 +void *
1603 xmalloc (size)
1604 int size;
1605 {
1606 - int result = malloc (size);
1607 + void *result = malloc (size);
1608 if (!result)
1609 fatal ("virtual memory exhausted", 0);
1610 return result;
1611 }
1612
1613 -int
1614 +void *
1615 xrealloc (ptr, size)
1616 char *ptr;
1617 int size;
1618 {
1619 - int result = realloc (ptr, size);
1620 + void *result = realloc (ptr, size);
1621 if (!result)
1622 fatal ("virtual memory exhausted");
1623 return result;
1624 diff -ur emacs-18.59-orig/etc/emacsclient.c emacs-18.59/etc/emacsclient.c
1625 --- emacs-18.59-orig/etc/emacsclient.c 1992-08-22 09:09:47.000000000 +0200
1626 +++ emacs-18.59/etc/emacsclient.c 2007-01-29 21:47:56.000000000 +0100
1627 @@ -27,8 +27,10 @@
1628 #undef close
1629 #endif
1630
1631 +#include <stdlib.h>
1632 +#include <string.h>
1633
1634 -#if !defined(BSD) && !defined(HAVE_SYSVIPC)
1635 +#if !defined(HAVE_SOCKETS) && !defined(HAVE_SYSVIPC)
1636 #include <stdio.h>
1637
1638 main (argc, argv)
1639 @@ -41,9 +43,9 @@
1640 exit (1);
1641 }
1642
1643 -#else /* BSD or HAVE_SYSVIPC */
1644 +#else /* HAVE_SOCKETS or HAVE_SYSVIPC */
1645
1646 -#if defined(BSD) && ! defined (HAVE_SYSVIPC)
1647 +#if defined(HAVE_SOCKETS)
1648 /* BSD code is very different from SYSV IPC code */
1649
1650 #include <sys/types.h>
1651 @@ -51,10 +53,10 @@
1652 #include <sys/un.h>
1653 #include <stdio.h>
1654 #include <errno.h>
1655 +#include <unistd.h>
1656 #include <sys/stat.h>
1657
1658 extern int sys_nerr;
1659 -extern char *sys_errlist[];
1660 extern int errno;
1661
1662 main (argc, argv)
1663 @@ -69,8 +71,6 @@
1664 char string[BUFSIZ];
1665 struct stat statbfr;
1666
1667 - char *getenv (), *getwd ();
1668 -
1669 if (argc < 2)
1670 {
1671 fprintf (stderr, "Usage: %s filename\n", argv[0]);
1672 @@ -112,7 +112,8 @@
1673 strcat (server.sun_path, "/.emacs_server");
1674 #endif
1675
1676 - if (connect (s, &server, strlen (server.sun_path) + 2) < 0)
1677 + if (connect (s, (struct sockaddr *)&server,
1678 + strlen (server.sun_path) + 2) < 0)
1679 {
1680 fprintf (stderr, "%s: ", argv[0]);
1681 perror ("connect");
1682 @@ -125,11 +126,11 @@
1683 exit (1);
1684 }
1685
1686 - cwd = getwd (string);
1687 + cwd = getcwd (string, sizeof string);
1688 if (cwd == 0)
1689 {
1690 - /* getwd puts message in STRING if it fails. */
1691 - fprintf (stderr, "%s: %s (%s)\n", argv[0], string,
1692 + fprintf (stderr, "%s: %s (%s)\n", argv[0],
1693 + "Cannot get current working directory",
1694 (errno < sys_nerr) ? sys_errlist[errno] : "unknown error");
1695 exit (1);
1696 }
1697 @@ -275,4 +276,4 @@
1698
1699 #endif /* HAVE_SYSVIPC */
1700
1701 -#endif /* BSD or HAVE_SYSVIPC */
1702 +#endif /* HAVE_SOCKETS or HAVE_SYSVIPC */
1703 diff -ur emacs-18.59-orig/etc/env.c emacs-18.59/etc/env.c
1704 --- emacs-18.59-orig/etc/env.c 1998-05-31 05:34:36.000000000 +0200
1705 +++ emacs-18.59/etc/env.c 2007-01-29 21:47:56.000000000 +0100
1706 @@ -89,6 +89,8 @@
1707
1708 #include <stdio.h>
1709 #include <errno.h>
1710 +#include <stdlib.h>
1711 +#include <string.h>
1712
1713 extern int execvp ();
1714 extern char *index ();
1715 @@ -102,7 +104,7 @@
1716 int nenv_size;
1717
1718 char *progname;
1719 -void setenv ();
1720 +void xsetenv ();
1721 void fatal ();
1722
1723 main (argc, argv, envp)
1724 @@ -134,7 +136,7 @@
1725 if (tem)
1726 {
1727 *tem = '\000';
1728 - setenv (*envp, tem + 1);
1729 + xsetenv (*envp, tem + 1);
1730 }
1731 }
1732
1733 @@ -145,7 +147,7 @@
1734 /* If arg contains a "=" it specifies to set a variable */
1735 {
1736 *tem = '\000';
1737 - setenv (*argv, tem + 1);
1738 + xsetenv (*argv, tem + 1);
1739 argc--; argv++;
1740 continue;
1741 }
1742 @@ -161,7 +163,7 @@
1743 /* Unset a variable */
1744 {
1745 argc--; argv++;
1746 - setenv (*argv, 0);
1747 + xsetenv (*argv, 0);
1748 argc--; argv++;
1749 }
1750 else if (!strcmp (*argv, "-s") ||
1751 @@ -174,7 +176,7 @@
1752 fatal ("No value specified for variable \"%s\"",
1753 tem);
1754 argc--; argv++;
1755 - setenv (tem, *argv);
1756 + xsetenv (tem, *argv);
1757 argc--; argv++;
1758 }
1759 else if (!strcmp (*argv, "-") || !strcmp (*argv, "--"))
1760 @@ -216,7 +218,7 @@
1761 }
1762
1763 void
1764 -setenv (var, val)
1765 +xsetenv (var, val)
1766 register char *var, *val;
1767 {
1768 register char **e;
1769 @@ -274,8 +276,6 @@
1770 }
1771
1772
1773 -extern char *malloc (), *realloc ();
1774 -
1775 void
1776 memory_fatal ()
1777 {
1778 diff -ur emacs-18.59-orig/etc/etags.c emacs-18.59/etc/etags.c
1779 --- emacs-18.59-orig/etc/etags.c 1992-08-20 07:11:01.000000000 +0200
1780 +++ emacs-18.59/etc/etags.c 2007-01-29 21:47:56.000000000 +0100
1781 @@ -21,6 +21,8 @@
1782
1783 #include <stdio.h>
1784 #include <ctype.h>
1785 +#include <stdlib.h>
1786 +#include <string.h>
1787
1788 /* Define the symbol ETAGS to make the program "etags",
1789 which makes emacs-style tag tables by default.
1790 @@ -128,11 +130,10 @@
1791
1792 char *savestr();
1793 char *savenstr ();
1794 -char *rindex();
1795 -char *index();
1796 char *concat ();
1797 void initbuffer ();
1798 long readline ();
1799 +void *xmalloc(), *xrealloc();
1800
1801 /* A `struct linebuffer' is a structure which holds a line of text.
1802 `readline' reads a line from a stream into a linebuffer
1803 @@ -1380,7 +1381,6 @@
1804 char *defenv;
1805 {
1806 register char *env, *p;
1807 - extern char *savenstr (), *index ();
1808
1809 struct TEX_tabent *tab;
1810 int size, i;
1811 @@ -1530,47 +1530,6 @@
1812 return dp;
1813 }
1814
1815 -/*
1816 - * Return the ptr in sp at which the character c last
1817 - * appears; NULL if not found
1818 - *
1819 - * Identical to v7 rindex, included for portability.
1820 - */
1821 -
1822 -char *
1823 -rindex(sp, c)
1824 - register char *sp, c;
1825 -{
1826 - register char *r;
1827 -
1828 - r = NULL;
1829 - do
1830 - {
1831 - if (*sp == c)
1832 - r = sp;
1833 - } while (*sp++);
1834 - return(r);
1835 -}
1836 -
1837 -/*
1838 - * Return the ptr in sp at which the character c first
1839 - * appears; NULL if not found
1840 - *
1841 - * Identical to v7 index, included for portability.
1842 - */
1843 -
1844 -char *
1845 -index(sp, c)
1846 - register char *sp, c;
1847 -{
1848 - do
1849 - {
1850 - if (*sp == c)
1851 - return (sp);
1852 - } while (*sp++);
1853 - return (NULL);
1854 -}
1855 -
1856 /* Print error message and exit. */
1857
1858 fatal (s1, s2)
1859 @@ -1609,22 +1568,22 @@
1860
1861 /* Like malloc but get fatal error if memory is exhausted. */
1862
1863 -int
1864 +void *
1865 xmalloc (size)
1866 int size;
1867 {
1868 - int result = malloc (size);
1869 + void *result = malloc (size);
1870 if (!result)
1871 fatal ("virtual memory exhausted", 0);
1872 return result;
1873 }
1874
1875 -int
1876 +void *
1877 xrealloc (ptr, size)
1878 char *ptr;
1879 int size;
1880 {
1881 - int result = realloc (ptr, size);
1882 + void *result = realloc (ptr, size);
1883 if (!result)
1884 fatal ("virtual memory exhausted");
1885 return result;
1886 diff -ur emacs-18.59-orig/etc/fakemail.c emacs-18.59/etc/fakemail.c
1887 --- emacs-18.59-orig/etc/fakemail.c 1991-01-08 20:08:42.000000000 +0100
1888 +++ emacs-18.59/etc/fakemail.c 2007-01-29 21:47:56.000000000 +0100
1889 @@ -43,6 +43,7 @@
1890 #endif
1891
1892 #include <stdio.h>
1893 +#include <stdlib.h>
1894 #include <string.h>
1895 #include <ctype.h>
1896 #include <time.h>
1897 @@ -123,16 +124,8 @@
1898
1899 extern FILE *popen ();
1900 extern int fclose (), pclose ();
1901 -extern char *malloc (), *realloc ();
1902
1903 -#ifdef CURRENT_USER
1904 -extern struct passwd *getpwuid ();
1905 -extern unsigned short geteuid ();
1906 -static struct passwd *my_entry;
1907 -#define cuserid(s) \
1908 -(my_entry = getpwuid (((int) geteuid ())), \
1909 - my_entry->pw_name)
1910 -#endif
1911 +#define cuserid(s) (getpwuid (geteuid ())->pw_name)
1912
1913 /* Utilities */
1914
1915 @@ -564,7 +557,6 @@
1916 return;
1917 }
1918
1919 -void
1920 main (argc, argv)
1921 int argc;
1922 char **argv;
1923 diff -ur emacs-18.59-orig/etc/make-docfile.c emacs-18.59/etc/make-docfile.c
1924 --- emacs-18.59-orig/etc/make-docfile.c 1991-10-25 19:43:28.000000000 +0100
1925 +++ emacs-18.59/etc/make-docfile.c 2007-01-29 21:47:56.000000000 +0100
1926 @@ -32,6 +32,8 @@
1927 */
1928
1929 #include <stdio.h>
1930 +#include <stdlib.h>
1931 +#include <string.h>
1932
1933 FILE *outfile;
1934
1935 diff -ur emacs-18.59-orig/etc/movemail.c emacs-18.59/etc/movemail.c
1936 --- emacs-18.59-orig/etc/movemail.c 1992-05-07 22:11:16.000000000 +0200
1937 +++ emacs-18.59/etc/movemail.c 2007-01-29 21:47:56.000000000 +0100
1938 @@ -52,6 +52,9 @@
1939 #include <sys/stat.h>
1940 #include <sys/file.h>
1941 #include <errno.h>
1942 +#include <stdio.h>
1943 +#include <stdlib.h>
1944 +#include <string.h>
1945 #define NO_SHORTNAMES /* Tell config not to load remap.h */
1946 #include "../src/config.h"
1947
1948 @@ -81,6 +84,7 @@
1949 #undef close
1950
1951 char *concat ();
1952 +void *xmalloc ();
1953 extern int errno;
1954
1955 /* Nonzero means this is name of a lock file to delete on fatal error. */
1956 @@ -320,7 +324,6 @@
1957 char *name;
1958 {
1959 extern int errno, sys_nerr;
1960 - extern char *sys_errlist[];
1961 char *s;
1962
1963 if (errno < sys_nerr)
1964 @@ -334,7 +337,6 @@
1965 char *name;
1966 {
1967 extern int errno, sys_nerr;
1968 - extern char *sys_errlist[];
1969 char *s;
1970
1971 if (errno < sys_nerr)
1972 @@ -365,11 +367,11 @@
1973
1974 /* Like malloc but get fatal error if memory is exhausted. */
1975
1976 -int
1977 +void *
1978 xmalloc (size)
1979 int size;
1980 {
1981 - int result = malloc (size);
1982 + void *result = malloc (size);
1983 if (!result)
1984 fatal ("virtual memory exhausted", 0);
1985 return result;
1986 @@ -704,7 +706,6 @@
1987 get_errmsg ()
1988 {
1989 extern int errno, sys_nerr;
1990 - extern char *sys_errlist[];
1991 char *s;
1992
1993 if (errno < sys_nerr)
1994 diff -ur emacs-18.59-orig/etc/server.c emacs-18.59/etc/server.c
1995 --- emacs-18.59-orig/etc/server.c 1992-03-23 05:06:08.000000000 +0100
1996 +++ emacs-18.59/etc/server.c 2007-01-29 21:47:56.000000000 +0100
1997 @@ -36,8 +36,10 @@
1998 #undef open
1999 #undef close
2000
2001 +#include <stdlib.h>
2002 +#include <string.h>
2003
2004 -#if !defined(BSD) && !defined(HAVE_SYSVIPC)
2005 +#if !defined(HAVE_SOCKETS) && !defined(HAVE_SYSVIPC)
2006 #include <stdio.h>
2007
2008 main ()
2009 @@ -47,9 +49,9 @@
2010 exit (1);
2011 }
2012
2013 -#else /* BSD or HAVE_SYSVIPC */
2014 +#else /* HAVE_SOCKETS or HAVE_SYSVIPC */
2015
2016 -#if defined (BSD) && ! defined (HAVE_SYSVIPC)
2017 +#if defined (HAVE_SOCKETS)
2018 /* BSD code is very different from SYSV IPC code */
2019
2020 #include <sys/file.h>
2021 @@ -110,7 +112,7 @@
2022 unlink (server.sun_path);
2023 #endif
2024
2025 - if (bind (s, &server, strlen (server.sun_path) + 2) < 0)
2026 + if (bind (s, (struct sockaddr *)&server, strlen (server.sun_path) + 2) < 0)
2027 {
2028 perror ("bind");
2029 exit (1);
2030 @@ -128,14 +130,18 @@
2031 signal (SIGPIPE, SIG_IGN);
2032 for (;;)
2033 {
2034 - int rmask = (1 << s) + 1;
2035 + fd_set rmask;
2036 + FD_ZERO (&rmask);
2037 + FD_SET (0, &rmask);
2038 + FD_SET (s, &rmask);
2039 if (select (s + 1, &rmask, 0, 0, 0) < 0)
2040 perror ("select");
2041 - if (rmask & (1 << s)) /* client sends list of filenames */
2042 + if (FD_ISSET (s, &rmask)) /* client sends list of filenames */
2043 {
2044 fromlen = sizeof (fromunix);
2045 fromunix.sun_family = AF_UNIX;
2046 - infd = accept (s, &fromunix, &fromlen); /* open socket fd */
2047 + infd = accept (s, (struct sockaddr *)&fromunix, &fromlen);
2048 + /* open socket fd */
2049 if (infd < 0)
2050 {
2051 if (errno == EMFILE || errno == ENFILE)
2052 @@ -184,7 +190,8 @@
2053 fflush (infile);
2054 continue;
2055 }
2056 - else if (rmask & 1) /* emacs sends codeword, fd, and string message */
2057 + else if (FD_ISSET (0, &rmask))
2058 + /* emacs sends codeword, fd, and string message */
2059 {
2060 /* Read command codeword and fd */
2061 clearerr (stdin);
2062 @@ -325,6 +332,4 @@
2063
2064 #endif /* SYSV IPC */
2065
2066 -#endif /* BSD && IPC */
2067 -
2068 -
2069 +#endif /* HAVE_SOCKETS && IPC */
2070 diff -ur emacs-18.59-orig/etc/sorted-doc.c emacs-18.59/etc/sorted-doc.c
2071 --- emacs-18.59-orig/etc/sorted-doc.c 1988-06-04 06:22:22.000000000 +0200
2072 +++ emacs-18.59/etc/sorted-doc.c 2007-01-29 21:47:56.000000000 +0100
2073 @@ -7,8 +7,9 @@
2074
2075 #include <stdio.h>
2076 #include <ctype.h>
2077 +#include <stdlib.h>
2078 +#include <string.h>
2079
2080 -extern char *malloc ();
2081 char *xmalloc ();
2082
2083 #define NUL '\0'
2084 diff -ur emacs-18.59-orig/etc/test-distrib.c emacs-18.59/etc/test-distrib.c
2085 --- emacs-18.59-orig/etc/test-distrib.c 1987-05-22 06:15:12.000000000 +0200
2086 +++ emacs-18.59/etc/test-distrib.c 2007-01-29 21:47:56.000000000 +0100
2087 @@ -1,4 +1,5 @@
2088 #include <stdio.h>
2089 +#include <stdlib.h>
2090
2091 /* Break string in two parts to avoid buggy C compilers that ignore characters
2092 after nulls in strings. */
2093 diff -ur emacs-18.59-orig/etc/wakeup.c emacs-18.59/etc/wakeup.c
2094 --- emacs-18.59-orig/etc/wakeup.c 1991-07-30 23:03:39.000000000 +0200
2095 +++ emacs-18.59/etc/wakeup.c 2007-01-29 21:47:56.000000000 +0100
2096 @@ -2,6 +2,7 @@
2097
2098 #include <stdio.h>
2099 #include <time.h>
2100 +#include <stdlib.h>
2101
2102 struct tm *localtime ();
2103
2104 diff -ur emacs-18.59-orig/etc/yow.c emacs-18.59/etc/yow.c
2105 --- emacs-18.59-orig/etc/yow.c 1988-04-13 08:13:41.000000000 +0200
2106 +++ emacs-18.59/etc/yow.c 2007-01-29 21:47:56.000000000 +0100
2107 @@ -1,5 +1,7 @@
2108 #include <stdio.h>
2109 #include <ctype.h>
2110 +#include <stdlib.h>
2111 +#include <string.h>
2112 #include "../src/paths.h"
2113
2114 /* zippy.c
2115
2116
2117
2118 --
2119 gentoo-commits@g.o mailing list