1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/* $OpenBSD: hack-coff.c,v 1.1 2001/09/01 15:36:37 drahn Exp $ */
#include <stdio.h>
char magic[2] = { 1, 0xb };
char snos[12] = { 0, 1, 0, 1, 0, 2, 0, 0, 0, 0, 0, 3 };
main(int ac, char **av)
{
int fd;
if (ac != 2) {
fprintf(stderr, "Usage: hack-coff coff-file\n");
exit(1);
}
if ((fd = open(av[1], 2)) == -1) {
perror(av[2]);
exit(1);
}
if (lseek(fd, (long) 0x14, 0) == -1
|| write(fd, magic, sizeof(magic)) != sizeof(magic)
|| lseek(fd, (long) 0x34, 0) == -1
|| write(fd, snos, sizeof(snos)) != sizeof(snos)) {
fprintf(stderr, "%s: write error\n", av[1]);
exit(1);
}
close(fd);
exit(0);
}
|