lisp
tool
stripsh.c
Go to the documentation of this file.
1
/****************************************************************/
2
/* stripsh.c
3
/* strip off section headers from a.out
4
/*
5
/* (c) T.Matsui, 1986
6
/****************************************************************/
7
8
#include <signal.h>
9
#include <ctype.h>
10
#include <sys/file.h>
11
#include <fcntl.h>
12
#include <unistd.h>
13
#include <libelf.h>
14
15
#define min(a,b) (a<b)?a:b
16
17
main
(
argc
,argv)
18
int
argc
;
19
char
*argv[];
20
{
int
infd
,
outfd
;
21
int
count
, size, sh_off;
22
int
zero=0;
23
char
buf
[8192];
24
25
infd
=open(argv[1], O_RDONLY);
26
outfd
=open(argv[2], O_WRONLY | O_CREAT,0755);
27
read(
infd
,
buf
, 0x20);
28
write(
outfd
,
buf
,0x20);
29
read(
infd
, &
count
, 4);
30
write(
outfd
, &zero, 4);
31
count
=
count
-0x24;
32
printf(
"%x\n"
,
count
);
33
while
(
count
>0) {
34
size=read(
infd
,
buf
,
min
(8192,
count
));
35
count
-=size;
36
write(
outfd
,
buf
, size);}
37
close(
infd
); close(
outfd
);
38
}
39
40
buf
static char buf[CHAR_SIZE]
Definition:
helpsub.c:23
min
#define min(x, y)
Definition:
rmflags.c:17
infd
int infd
Definition:
exsym.c:17
main
main(int argc, argv)
Definition:
stripsh.c:17
outfd
int outfd
Definition:
exsym.c:17
count
int count
Definition:
thrtest.c:11
argc
static int argc
Definition:
transargv.c:56
euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 15 2023 02:06:43