* Copyright (c) 1980 The Regents of the University of California.
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)yymain.c 5.2 (Berkeley) %G%";
#include "tree_ty.h" /* must be included for yy.h */
* Yymain initializes each of the utility
* clusters and then starts the processing
* initialize symbol table temp files
Perror(filename
, "No lines in file");
* Initialize the clusters
* save outermost block of namelist
writef(2, "File not rewritten because of errors\n");
(void) signal(SIGHUP
, SIG_IGN
);
(void) signal(SIGINT
, SIG_IGN
);
pexit(eflg
? ERRS
: AOK
);
if (creat(firstname
, 0644) != 1) {
(void) lseek(fout
[0], 0l, 0);
while ((c
= read(fout
[0], &fout
[3], 512)) > 0) {
if (write(1, &fout
[3], c
) != c
) {
short buf
[HEADER_BYTES
/ sizeof ( short )];
unsigned *ubuf
= (unsigned *) buf
;
if (hf
>= 0 && read(hf
, (char *) buf
, HEADER_BYTES
) > sizeof(struct exec
)) {
magichdr
.a_magic
= ubuf
[0];
magichdr
.a_text
= ubuf
[1];
magichdr
.a_data
= ubuf
[2];
magichdr
.a_bss
= ubuf
[3];
magichdr
.a_syms
= ubuf
[4];
magichdr
.a_entry
= ubuf
[5];
magichdr
.a_trsize
= ubuf
[6];
magichdr
.a_drsize
= ubuf
[7];
for (i
= 0; i
< HEADER_BYTES
/ sizeof ( short ); i
++)
if (magichdr
.a_magic
!= 0407)
magichdr
.a_data
= ( unsigned ) lc
- magichdr
.a_text
;
magichdr
.a_data
-= sizeof (struct exec
);
pxhd
.objsize
= ( ( unsigned ) lc
) - HEADER_BYTES
;
pxhd
.symtabsize
= nlhdrsize();
magichdr
.a_data
+= pxhd
.symtabsize
;
(void) time((long *) (&pxhd
.maketime
));
pxhd
.magicnum
= MAGICNUM
;
(void) lseek(ofil
, 0l, 0);
write(ofil
, (char *) (&magichdr
), sizeof(struct exec
));
(void) lseek(ofil
, ( long ) ( HEADER_BYTES
- sizeof ( pxhd
) ) , 0);
write(ofil
, (char *) (&pxhd
), sizeof (pxhd
));
write(i
, cp
, strlen(cp
));