[BACK]Return to build.c CVS log [TXT][DIR] Up to [local] / sys / dev / microcode / rum

Annotation of sys/dev/microcode/rum/build.c, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: build.c,v 1.1 2006/08/17 08:32:30 damien Exp $        */
        !             2:
        !             3: /*-
        !             4:  * Copyright (c) 2006
        !             5:  *     Damien Bergamini <damien.bergamini@free.fr>
        !             6:  *
        !             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.
        !            10:  *
        !            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.
        !            18:  */
        !            19:
        !            20: #include <sys/types.h>
        !            21:
        !            22: #include <err.h>
        !            23: #include <fcntl.h>
        !            24: #include <stdio.h>
        !            25: #include <unistd.h>
        !            26:
        !            27: #include "microcode.h"
        !            28:
        !            29: static void
        !            30: output(const char *name, const uint8_t *ucode, int size)
        !            31: {
        !            32:        ssize_t rlen;
        !            33:        int fd;
        !            34:
        !            35:        printf("creating %s length %d\n", name, size);
        !            36:
        !            37:        fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0644);
        !            38:        if (fd == -1)
        !            39:                err(1, "%s", name);
        !            40:
        !            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);
        !            46:
        !            47:        close(fd);
        !            48: }
        !            49:
        !            50: int
        !            51: main(void)
        !            52: {
        !            53:        output("rum-rt2573", rt2573, sizeof rt2573);
        !            54:
        !            55:        return 0;
        !            56: }

CVSweb