repo.or.cz
/
netsniff-ng.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
netsniff-ng: nlmsg: Print genl ops & mcast groups attributes
[netsniff-ng.git]
/
cpp.c
blob
6734eac3509dfe313f27e19de277446299a45bc5
1
#include <stdio.h>
2
#include <libgen.h>
3
4
#include
"str.h"
5
#include
"xmalloc.h"
6
7
int
cpp_exec
(
char
*
in_file
,
char
*
out_file
,
size_t
out_len
)
8
{
9
char
*
tmp
=
xstrdup
(
in_file
);
10
char
cmd
[
256
], *
base
;
11
int
ret
=
0
;
12
13
base
=
basename
(
tmp
);
14
15
slprintf
(
out_file
,
out_len
,
"/tmp/.tmp-%u-%s"
,
rand
(),
base
);
16
slprintf
(
cmd
,
sizeof
(
cmd
),
"cpp -I"
ETCDIRE_STRING
" %s > %s"
,
17
in_file
,
out_file
);
18
19
if
(
system
(
cmd
) !=
0
)
20
ret
= -
1
;
21
22
xfree
(
tmp
);
23
return
ret
;
24
}