repo.or.cz
/
hvf.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
include: add {en,dis}able_io_int_classes() helpers
[hvf.git]
/
build
/
padcat.c
blob
58855ecc767c8bfe9fa2b8c77ea1eb8a52bfc1fa
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <string.h>
4
#include <assert.h>
5
6
void
cat
(
char
*
fn
)
7
{
8
FILE
*
f
;
9
char
buf
[
80
];
10
size_t
n
;
11
12
f
=
fopen
(
fn
,
"rb"
);
13
if
(!
f
) {
14
fprintf
(
stderr
,
"Could not open file
\"
%s
\"
.
\n
"
,
15
fn
);
16
exit
(
1
);
17
}
18
19
do
{
20
memset
(
buf
,
0
,
80
);
21
n
=
fread
(
buf
,
1
,
80
,
f
);
22
if
(
n
)
23
assert
(
fwrite
(
buf
,
1
,
80
,
stdout
) ==
80
);
24
}
while
(
n
==
80
);
25
26
fclose
(
f
);
27
}
28
29
int
main
(
int
argc
,
char
**
argv
)
30
{
31
int
i
;
32
33
for
(
i
=
1
;
i
<
argc
;
i
++)
34
cat
(
argv
[
i
]);
35
36
return
0
;
37
}