summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc/stand/boot.mac/hack-coff.c
blob: 989dd0333144f7806d4f2f23813b9f41033112d5 (plain)
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
#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);
}