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

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);
1.1.1.2 ! root       25: int callback(int argc, char *argv[]);
1.1       root       26: 
                     27: 
                     28: int
                     29: main(int argc, char *argv[])
                     30: {
                     31:        int i;
                     32:        of_set_callback((void *) &_callback_entry);
                     33: 
                     34:        if (strcmp(argv[0], "netboot") == 0 && argc >= 5)
                     35:                return netboot(argc, argv);
                     36:        if (strcmp(argv[0], "netflash") == 0)
                     37:                return netflash(argc, argv);
                     38:        if (strcmp(argv[0], "ping") == 0)
                     39:                return ping(argc, argv);
                     40: #ifdef SNK_BIOSEMU_APPS
                     41:        // BIOS Emulator applications
                     42:        if (strcmp(argv[0], "biosemu") == 0)
                     43:                return biosemu(argc, argv);
                     44:        if (strcmp(argv[0], "get_vbe_info") == 0)
                     45:                return vbe_get_info(argc, argv);
                     46: #endif
                     47: 
                     48:        printf("Unknown client application called\n");
                     49:        for (i = 0; i < argc; i++)
                     50:                printf("argv[%d] %s\n", i, argv[i]);
                     51: 
                     52:        return -1;
                     53: }
                     54: 
                     55: int
                     56: callback(int argc, char *argv[])
                     57: {
                     58:        int i;
                     59: 
                     60:        printf("\n");
                     61: 
                     62:        /*
                     63:         * Register your application's callback handler here, similar to
                     64:         * the way you would register an application.
                     65:         * Please note that callback functions can be called safely only after
                     66:         * your application has called of_yield(). If you return or exit() from
                     67:         * your client application, the callback can no longer be used.
                     68:         */
                     69: #if 0
                     70:        if (strcmp(argv[0], "example") == 0)
                     71:                return example(argc, argv);
                     72: #endif
                     73: 
                     74:        printf("No such callback function\n");
                     75:        for (i = 0; i < argc; i++)
                     76:                printf("argv[%d] %s\n", i, argv[i]);
                     77: 
                     78:        return (-1);
                     79: }

unix.superglobalmegacorp.com

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