Changes in uspace/app/nettest2/nettest2.c [849ed54:2721a75] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nettest2/nettest2.c
r849ed54 r2721a75 40 40 #include <task.h> 41 41 #include <time.h> 42 #include <arg_parse.h> 42 43 43 44 #include <in.h> … … 46 47 #include <socket.h> 47 48 #include <net_err.h> 49 #include <socket_parse.h> 48 50 49 51 #include "nettest.h" 50 #include "parse.h"51 52 #include "print_error.h" 52 53 … … 105 106 struct timeval time_after; 106 107 107 printf("Task %d - ", task_get_id());108 printf("%s\n", NAME);109 110 108 // parse the command line arguments 111 109 // stop before the last argument if it does not start with the minus sign ('-') … … 116 114 // short options with only one letter 117 115 case 'f': 118 ERROR_PROPAGATE( parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 0,parse_protocol_family));116 ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &family, 0, socket_parse_protocol_family)); 119 117 break; 120 118 case 'h': … … 123 121 break; 124 122 case 'm': 125 ERROR_PROPAGATE( parse_parameter_int(argc, argv, &index, &messages, "message count", 0));123 ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &messages, 0)); 126 124 break; 127 125 case 'n': 128 ERROR_PROPAGATE( parse_parameter_int(argc, argv, &index, &sockets, "socket count", 0));126 ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &sockets, 0)); 129 127 break; 130 128 case 'p': 131 ERROR_PROPAGATE( parse_parameter_int(argc, argv, &index, &value, "port number", 0));129 ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &value, 0)); 132 130 port = (uint16_t) value; 133 131 break; 134 132 case 's': 135 ERROR_PROPAGATE( parse_parameter_int(argc, argv, &index, &value, "packet size", 0));133 ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &value, 0)); 136 134 size = (value >= 0) ? (size_t) value : 0; 137 135 break; 138 136 case 't': 139 ERROR_PROPAGATE( parse_parameter_name_int(argc, argv, &index, &value, "socket type", 0,parse_socket_type));137 ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &value, 0, socket_parse_socket_type)); 140 138 type = (sock_type_t) value; 141 139 break; … … 146 144 case '-': 147 145 if(str_lcmp(argv[index] + 2, "family=", 7) == 0){ 148 ERROR_PROPAGATE( parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 9,parse_protocol_family));146 ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &family, 9, socket_parse_protocol_family)); 149 147 }else if(str_lcmp(argv[index] + 2, "help", 5) == 0){ 150 148 nettest2_print_help(); 151 149 return EOK; 152 150 }else if(str_lcmp(argv[index] + 2, "messages=", 6) == 0){ 153 ERROR_PROPAGATE( parse_parameter_int(argc, argv, &index, &messages, "message count", 8));151 ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &messages, 8)); 154 152 }else if(str_lcmp(argv[index] + 2, "sockets=", 6) == 0){ 155 ERROR_PROPAGATE( parse_parameter_int(argc, argv, &index, &sockets, "socket count", 8));153 ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &sockets, 8)); 156 154 }else if(str_lcmp(argv[index] + 2, "port=", 5) == 0){ 157 ERROR_PROPAGATE( parse_parameter_int(argc, argv, &index, &value, "port number", 7));155 ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &value, 7)); 158 156 port = (uint16_t) value; 159 157 }else if(str_lcmp(argv[index] + 2, "type=", 5) == 0){ 160 ERROR_PROPAGATE( parse_parameter_name_int(argc, argv, &index, &value, "socket type", 7,parse_socket_type));158 ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &value, 7, socket_parse_socket_type)); 161 159 type = (sock_type_t) value; 162 160 }else if(str_lcmp(argv[index] + 2, "verbose", 8) == 0){ 163 161 verbose = 1; 164 162 }else{ 165 print_unrecognized(index, argv[index] + 2);166 163 nettest2_print_help(); 167 164 return EINVAL; … … 169 166 break; 170 167 default: 171 print_unrecognized(index, argv[index] + 1);172 168 nettest2_print_help(); 173 169 return EINVAL; 174 170 } 175 171 }else{ 176 print_unrecognized(index, argv[index]);177 172 nettest2_print_help(); 178 173 return EINVAL;
Note:
See TracChangeset
for help on using the changeset viewer.