comparison src/unexmips.c @ 3025:facf3239ba30

[xemacs-hg @ 2005-10-25 11:16:19 by ben] rename new->new_, convert 'foo to `foo' EmacsFrame.c, ExternalClient.c, ExternalShell.c, chartab.c, cmdloop.c, compiler.h, console.c, database.c, device-msw.c, device-x.c, device.c, doc.c, dragdrop.c, eval.c, event-msw.c, event-stream.c, events.c, extents.c, file-coding.c, fns.c, frame-tty.c, frame.c, gpmevent.c, gutter.c, hash.c, imgproc.c, indent.c, keymap.c, lisp-union.h, macros.c, malloc.c, marker.c, menubar-x.c, menubar.c, mule-charset.c, number.c, process.c, profile.h, ralloc.c, redisplay.c, select-common.h, select.c, syntax.c, sysfile.h, sysproc.h, systime.h, syswindows.h, toolbar.c, tooltalk.c, tparam.c, unexaix.c, unexalpha.c, unexconvex.c, unexec.c, unexhp9k800.c, unexmips.c, unicode.c, window.c: new -> new_. 'foo -> `foo'. lwlib-internal.h: redo assert macros to follow lisp.h and not trigger warnings. lwlib.c, xlwtabs.c: new -> new_.
author ben
date Tue, 25 Oct 2005 11:16:49 +0000
parents 04bc9d2f42c7
children
comparison
equal deleted inserted replaced
3024:b7f26b2f78bd 3025:facf3239ba30
127 char *new_name, *a_name; 127 char *new_name, *a_name;
128 unsigned data_start; 128 unsigned data_start;
129 unsigned UNUSED (bss_start); 129 unsigned UNUSED (bss_start);
130 unsigned entry_address; 130 unsigned entry_address;
131 { 131 {
132 int new, old; 132 int new_, old;
133 int pagesize, brk; 133 int pagesize, brk;
134 int newsyms, symrel; 134 int newsyms, symrel;
135 int nread; 135 int nread;
136 struct headers hdr; 136 struct headers hdr;
137 int i; 137 int i;
140 char buffer[BUFSIZE]; 140 char buffer[BUFSIZE];
141 141
142 old = open (a_name, O_RDONLY, 0); 142 old = open (a_name, O_RDONLY, 0);
143 if (old < 0) fatal_unexec ("opening %s", a_name); 143 if (old < 0) fatal_unexec ("opening %s", a_name);
144 144
145 new = creat (new_name, 0666); 145 new_ = creat (new_name, 0666);
146 if (new < 0) fatal_unexec ("creating %s", new_name); 146 if (new_ < 0) fatal_unexec ("creating %s", new_name);
147 147
148 hdr = *((struct headers *)TEXT_START); 148 hdr = *((struct headers *)TEXT_START);
149 #ifdef MIPS2 149 #ifdef MIPS2
150 if (hdr.fhdr.f_magic != MIPSELMAGIC 150 if (hdr.fhdr.f_magic != MIPSELMAGIC
151 && hdr.fhdr.f_magic != MIPSEBMAGIC 151 && hdr.fhdr.f_magic != MIPSEBMAGIC
273 bss_section->s_paddr = vaddr; 273 bss_section->s_paddr = vaddr;
274 bss_section->s_size = 0; 274 bss_section->s_size = 0;
275 bss_section->s_scnptr = scnptr; 275 bss_section->s_scnptr = scnptr;
276 } 276 }
277 277
278 WRITE (new, (void *) TEXT_START, hdr.aout.tsize, 278 WRITE (new_, (void *) TEXT_START, hdr.aout.tsize,
279 "writing text section to %s", new_name); 279 "writing text section to %s", new_name);
280 WRITE (new, (void *) DATA_START, hdr.aout.dsize, 280 WRITE (new_, (void *) DATA_START, hdr.aout.dsize,
281 "writing data section to %s", new_name); 281 "writing data section to %s", new_name);
282 282
283 SEEK (old, hdr.fhdr.f_symptr, "seeking to start of symbols in %s", a_name); 283 SEEK (old, hdr.fhdr.f_symptr, "seeking to start of symbols in %s", a_name);
284 errno = EEOF; 284 errno = EEOF;
285 nread = read (old, buffer, BUFSIZE); 285 nread = read (old, buffer, BUFSIZE);
305 symhdr->cbExtOffset += symrel; 305 symhdr->cbExtOffset += symrel;
306 #endif 306 #endif
307 #undef symhdr 307 #undef symhdr
308 do 308 do
309 { 309 {
310 if (write (new, buffer, nread) != nread) 310 if (write (new_, buffer, nread) != nread)
311 fatal_unexec ("writing symbols to %s", new_name); 311 fatal_unexec ("writing symbols to %s", new_name);
312 nread = read (old, buffer, BUFSIZE); 312 nread = read (old, buffer, BUFSIZE);
313 if (nread < 0) fatal_unexec ("reading symbols from %s", a_name); 313 if (nread < 0) fatal_unexec ("reading symbols from %s", a_name);
314 #undef BUFSIZE 314 #undef BUFSIZE
315 } while (nread != 0); 315 } while (nread != 0);
316 316
317 SEEK (new, 0, "seeking to start of header in %s", new_name); 317 SEEK (new_, 0, "seeking to start of header in %s", new_name);
318 WRITE (new, &hdr, sizeof (hdr), 318 WRITE (new_, &hdr, sizeof (hdr),
319 "writing header of %s", new_name); 319 "writing header of %s", new_name);
320 320
321 close (old); 321 close (old);
322 close (new); 322 close (new_);
323 mark_x (new_name); 323 mark_x (new_name);
324 } 324 }
325 325
326 /* 326 /*
327 * mark_x 327 * mark_x