* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
static char sccsid
[] = "@(#)px_header.c 5.2 (Berkeley) %G%";
* pxheader - program to sit in front of interpreter code to make shell mods
* unnecessary to make Pascal obj's look like real programs.
* This program lives in /usr/lib/px_header
* Bill Joy UCB February 6, 1978
(START + HEADER_BYTES - sizeof (struct exec) - sizeof (struct pxhdr))
codesiz
= ((struct pxhdr
*)(cp
))->objsize
+ sizeof(struct pxhdr
);
symtabsiz
= ((struct pxhdr
*)(cp
))->symtabsize
;
error(2, "Too many arguments.\n");
largv
[1] = "/tmp/px00000";
for (i
= getpid(); i
> 0; i
/= 10)
fd
= creat(largv
[1], 0444);
error(3, "Cannot create /tmp file\n");
for (i
= 0; i
< argc
; i
++)
writeobj(fd
, codesiz
, symtabsiz
);
for (i
= 0; i
< argc
; i
++)
writeobj(pv
[1], codesiz
, symtabsiz
);
writeobj(fd
, codesiz
, symtabsiz
)
i
= (codesiz
< BUFSIZ
) ? codesiz
: BUFSIZ
;
i
= (symtabsiz
< BUFSIZ
) ? symtabsiz
: BUFSIZ
;
error(1, " not found.\n");