xref: /openbsd-src/sys/dev/microcode/tusb3410/build.c (revision b27348b2082c02cb5227e0e4933400ad6739ec5a)
1*b27348b2Sderaadt /*	$OpenBSD: build.c,v 1.6 2017/09/08 05:36:52 deraadt Exp $	*/
2f515c31dSderaadt 
3f515c31dSderaadt /*
4f515c31dSderaadt  * Copyright (c) 2004 Theo de Raadt <deraadt@openbsd.org>
5f515c31dSderaadt  *
6f515c31dSderaadt  * Permission to use, copy, modify, and distribute this software for any
7f515c31dSderaadt  * purpose with or without fee is hereby granted, provided that the above
8f515c31dSderaadt  * copyright notice and this permission notice appear in all copies.
9f515c31dSderaadt  *
10f515c31dSderaadt  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11f515c31dSderaadt  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12f515c31dSderaadt  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13f515c31dSderaadt  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14f515c31dSderaadt  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15f515c31dSderaadt  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16f515c31dSderaadt  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17f515c31dSderaadt  */
18*b27348b2Sderaadt #include <sys/param.h>
19f515c31dSderaadt #include <sys/uio.h>
20f515c31dSderaadt #include <fcntl.h>
21b1447b06Smartynas #include <err.h>
224a6cbd20Sjsg #include <stdio.h>
23b1447b06Smartynas #include <unistd.h>
24f515c31dSderaadt 
25f515c31dSderaadt #include "tusb3410.h"
26f515c31dSderaadt #define FILENAME "tusb3410"
27f515c31dSderaadt 
28f515c31dSderaadt int
main(int argc,char * argv[])29f515c31dSderaadt main(int argc, char *argv[])
30f515c31dSderaadt {
31f515c31dSderaadt 	ssize_t rlen;
32f515c31dSderaadt 	int fd;
33f515c31dSderaadt 
34867e0126Skrw 	printf("creating %s length %zu\n", FILENAME, sizeof uticom_fw_3410);
35f515c31dSderaadt 	fd = open(FILENAME, O_WRONLY|O_CREAT|O_TRUNC, 0644);
36f515c31dSderaadt 	if (fd == -1)
37f515c31dSderaadt 		err(1, "%s", FILENAME);
38f515c31dSderaadt 
39f515c31dSderaadt 	rlen = write(fd, uticom_fw_3410, sizeof uticom_fw_3410);
40f515c31dSderaadt 	if (rlen != sizeof uticom_fw_3410)
41f515c31dSderaadt 		err(1, "%s", FILENAME);
42f515c31dSderaadt 	return 0;
43f515c31dSderaadt }
44