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