Sync usage with man page.
[netbsd-mini2440.git] / sys / dev / microcode / zyd / build.c
blobba9b750a8644bef3a2683a121b7ad8877c4ae787
1 /* $OpenBSD: build.c,v 1.2 2006/11/13 02:52:46 jsg Exp $ */
3 /*-
4 * Copyright (c) 2006
5 * Damien Bergamini <damien.bergamini@free.fr>
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 #include <sys/types.h>
22 #include <err.h>
23 #include <fcntl.h>
24 #include <stdio.h>
25 #include <unistd.h>
27 #include "microcode.h"
29 static void
30 output(const char *name, const uint8_t *ucode, int size)
32 ssize_t rlen;
33 int fd;
35 printf("creating %s length %d\n", name, size);
37 fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0644);
38 if (fd == -1)
39 err(1, "%s", name);
41 rlen = write(fd, ucode, size);
42 if (rlen == -1)
43 err(1, "%s", name);
44 if (rlen != size)
45 errx(1, "%s: short write", name);
47 close(fd);
50 int
51 main(void)
53 output("zyd-zd1211", zd1211_firmware, sizeof zd1211_firmware);
54 output("zyd-zd1211b", zd1211b_firmware, sizeof zd1211b_firmware);
56 return 0;