Annotation of src/sys/dev/microcode/rum/build.c, revision 1.1.2.2
1.1.2.2 ! ad 1: /* $NetBSD: build.c,v 1.1.2.1 2006/11/18 21:34:26 ad Exp $ */
! 2: /* $OpenBSD: build.c,v 1.1 2006/01/09 20:03:40 damien Exp $ */
! 3:
! 4: /*-
! 5: * Copyright (c) 2006
! 6: * Damien Bergamini <damien.bergamini@free.fr>
! 7: *
! 8: * Permission to use, copy, modify, and distribute this software for any
! 9: * purpose with or without fee is hereby granted, provided that the above
! 10: * copyright notice and this permission notice appear in all copies.
! 11: *
! 12: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
! 13: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
! 14: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
! 15: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
! 16: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
! 17: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
! 18: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
! 19: */
! 20:
! 21: #include <sys/types.h>
! 22:
! 23: #include <err.h>
! 24: #include <fcntl.h>
! 25: #include <stdio.h>
! 26: #include <unistd.h>
! 27:
! 28: #include "microcode.h"
! 29:
! 30: static void
! 31: output(const char *name, const uint8_t *ucode, int size)
! 32: {
! 33: ssize_t rlen;
! 34: int fd;
! 35:
! 36: printf("creating %s length %d\n", name, size);
! 37:
! 38: fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0644);
! 39: if (fd == -1)
! 40: err(1, "%s", name);
! 41:
! 42: rlen = write(fd, ucode, size);
! 43: if (rlen == -1)
! 44: err(1, "%s", name);
! 45: if (rlen != size)
! 46: errx(1, "%s: short write", name);
! 47:
! 48: close(fd);
! 49: }
! 50:
! 51: int
! 52: main(void)
! 53: {
! 54: output("rum-rt2573", rt2573, sizeof rt2573);
! 55:
! 56: return 0;
! 57: }
CVSweb <webmaster@jp.NetBSD.org>