Annotation of qemu/roms/SLOF/clients/net-snk/app/main.c, revision 1.1

1.1     ! root        1: /******************************************************************************
        !             2:  * Copyright (c) 2004, 2011 IBM Corporation
        !             3:  * All rights reserved.
        !             4:  * This program and the accompanying materials
        !             5:  * are made available under the terms of the BSD License
        !             6:  * which accompanies this distribution, and is available at
        !             7:  * http://www.opensource.org/licenses/bsd-license.php
        !             8:  *
        !             9:  * Contributors:
        !            10:  *     IBM Corporation - initial implementation
        !            11:  *****************************************************************************/
        !            12: 
        !            13: #include <string.h>
        !            14: #include <stdio.h>
        !            15: #include <of.h>
        !            16: #include <netapps/netapps.h>
        !            17: #include <libbootmsg.h>
        !            18: 
        !            19: #ifdef SNK_BIOSEMU_APPS
        !            20: extern int biosemu(char argc, char**argv);
        !            21: extern int vbe_get_info(char argc, char**argv);
        !            22: #endif
        !            23: 
        !            24: extern void _callback_entry(void);
        !            25: 
        !            26: 
        !            27: int
        !            28: main(int argc, char *argv[])
        !            29: {
        !            30:        int i;
        !            31:        of_set_callback((void *) &_callback_entry);
        !            32: 
        !            33:        if (strcmp(argv[0], "netboot") == 0 && argc >= 5)
        !            34:                return netboot(argc, argv);
        !            35:        if (strcmp(argv[0], "netflash") == 0)
        !            36:                return netflash(argc, argv);
        !            37:        if (strcmp(argv[0], "ping") == 0)
        !            38:                return ping(argc, argv);
        !            39: #ifdef SNK_BIOSEMU_APPS
        !            40:        // BIOS Emulator applications
        !            41:        if (strcmp(argv[0], "biosemu") == 0)
        !            42:                return biosemu(argc, argv);
        !            43:        if (strcmp(argv[0], "get_vbe_info") == 0)
        !            44:                return vbe_get_info(argc, argv);
        !            45: #endif
        !            46: 
        !            47:        printf("Unknown client application called\n");
        !            48:        for (i = 0; i < argc; i++)
        !            49:                printf("argv[%d] %s\n", i, argv[i]);
        !            50: 
        !            51:        return -1;
        !            52: }
        !            53: 
        !            54: int
        !            55: callback(int argc, char *argv[])
        !            56: {
        !            57:        int i;
        !            58: 
        !            59:        printf("\n");
        !            60: 
        !            61:        /*
        !            62:         * Register your application's callback handler here, similar to
        !            63:         * the way you would register an application.
        !            64:         * Please note that callback functions can be called safely only after
        !            65:         * your application has called of_yield(). If you return or exit() from
        !            66:         * your client application, the callback can no longer be used.
        !            67:         */
        !            68: #if 0
        !            69:        if (strcmp(argv[0], "example") == 0)
        !            70:                return example(argc, argv);
        !            71: #endif
        !            72: 
        !            73:        printf("No such callback function\n");
        !            74:        for (i = 0; i < argc; i++)
        !            75:                printf("argv[%d] %s\n", i, argv[i]);
        !            76: 
        !            77:        return (-1);
        !            78: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.