#include <stdio.h>#include <string.h>#include <stdlib.h>#include <errno.h>#include "command_line_parser.h"Include dependency graph for command_line_parser.c:

Go to the source code of this file.
Functions | |
| void | print_help (void) |
| int | command_line_parser (int argc, char *argv[], command_options_t *options) |
| void | init_command_line_options (command_options_t *options) |
|
||||||||||||||||
|
Definition at line 54 of file command_line_parser.c. References command_options_t, options, command_options::port, and print_help(). 00054 {
00055 int i;
00056 const char port_str[]="-p";
00057 const char help_str[]="-h";
00058 long portnum=5555;
00059
00060 for (i=1;i<argc;i++) {
00061 if (!strcmp(argv[i],port_str)) {
00062 if ((i+1)<argc) {
00063 if (!((portnum=strtol(argv[i+1],NULL,10))<1024)) {
00064 options->port=portnum;
00065 }
00066 i++;
00067 }
00068 }
00069 else if (!strcmp(argv[i],help_str)) {
00070 print_help();
00071 exit(0);
00072 }
00073 else {
00074 printf("Error: bad option %s\n",argv[i]);
00075 printf("\"cart_comm -h\" for list of options\n");
00076 exit(0);
00077 }
00078 }
00079 return 0;
00080 }
|
Here is the call graph for this function:

|
|
Definition at line 88 of file command_line_parser.c. References command_options_t, options, and command_options::port. Referenced by main().
|
|
|
Definition at line 82 of file command_line_parser.c. Referenced by command_line_parser(). 00082 {
00083 printf("\nUSAGE: arm-elf-console-proxy [-h] [-r] [-a] [-p portnum]\n");
00084 printf("-h: Print this help message and exit\n");
00085 printf("-p portnum: Specify the port number for the comm server. Default value is 5555\n\n");
00086 }
|
1.3.9.1