route_cmd.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 FILE_LICENCE ( GPL2_OR_LATER );
00020
00021 #include <stdio.h>
00022 #include <getopt.h>
00023 #include <gpxe/command.h>
00024 #include <usr/route.h>
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 static void route_syntax ( char **argv ) {
00038 printf ( "Usage:\n"
00039 " %s\n"
00040 "\n"
00041 "Displays the routing table\n",
00042 argv[0] );
00043 }
00044
00045
00046
00047
00048
00049
00050
00051
00052 static int route_exec ( int argc, char **argv ) {
00053 static struct option longopts[] = {
00054 { "help", 0, NULL, 'h' },
00055 { NULL, 0, NULL, 0 },
00056 };
00057
00058 int c;
00059
00060
00061 while ( ( c = getopt_long ( argc, argv, "h", longopts, NULL ) ) >= 0 ){
00062 switch ( c ) {
00063 case 'h':
00064
00065 default:
00066
00067 route_syntax ( argv );
00068 return 1;
00069 }
00070 }
00071
00072 if ( optind != argc ) {
00073 route_syntax ( argv );
00074 return 1;
00075 }
00076
00077 route();
00078 return 0;
00079 }
00080
00081
00082 struct command route_commands[] __command = {
00083 {
00084 .name = "route",
00085 .exec = route_exec,
00086 },
00087 };