Changeset c4b0317 in mainline for uspace/app
- Timestamp:
- 2012-05-18T08:14:19Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 67435b1
- Parents:
- 8f6bffdd (diff), 3e67ab1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/app
- Files:
-
- 3 edited
- 4 moved
-
inet/Makefile (moved) (moved from uspace/app/inetcfg/Makefile ) (1 diff)
-
inet/inet.c (moved) (moved from uspace/app/inetcfg/inetcfg.c ) (5 diffs)
-
init/init.c (modified) (1 diff)
-
loc/Makefile (moved) (moved from uspace/app/locinfo/Makefile ) (1 diff)
-
loc/loc.c (moved) (moved from uspace/app/locinfo/locinfo.c ) (4 diffs)
-
sbi/src/stype.c (modified) (1 diff)
-
websrv/websrv.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/inet/Makefile
r8f6bffdd rc4b0317 28 28 29 29 USPACE_PREFIX = ../.. 30 BINARY = inet cfg30 BINARY = inet 31 31 32 32 SOURCES = \ 33 inet cfg.c33 inet.c 34 34 35 35 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/inet/inet.c
r8f6bffdd rc4b0317 27 27 */ 28 28 29 /** @addtogroup inet cfg29 /** @addtogroup inet 30 30 * @{ 31 31 */ … … 43 43 #include <sys/types.h> 44 44 45 #define NAME "inet cfg"45 #define NAME "inet" 46 46 47 47 static void print_syntax(void) … … 187 187 rc = inetcfg_addr_create_static(aobj_name, &naddr, link_id, &addr_id); 188 188 if (rc != EOK) { 189 printf(NAME ": Failed creating static address '%s' (% d)\n",190 aobj_name, rc);189 printf(NAME ": Failed creating static address '%s' (%s)\n", 190 aobj_name, str_error(rc)); 191 191 return EIO; 192 192 } … … 345 345 346 346 printf("Configured addresses:\n"); 347 347 if (count > 0) 348 printf(" [Addr/Width] [Link-Name] [Addr-Name] [Def-MTU]\n"); 348 349 ainfo.name = linfo.name = astr = NULL; 349 350 … … 415 416 416 417 printf("Static routes:\n"); 418 if (count > 0) 419 printf(" [Dest/Width] [Router-Addr] [Route-Name]\n"); 417 420 418 421 srinfo.name = dest_str = router_str = NULL; -
uspace/app/init/init.c
r8f6bffdd rc4b0317 307 307 spawn("/srv/loopip"); 308 308 spawn("/srv/ethip"); 309 spawn("/srv/inet ");309 spawn("/srv/inetsrv"); 310 310 spawn("/srv/tcp"); 311 311 spawn("/srv/udp"); -
uspace/app/loc/Makefile
r8f6bffdd rc4b0317 28 28 29 29 USPACE_PREFIX = ../.. 30 EXTRA_CFLAGS = -Iinclude 31 BINARY = locinfo 30 BINARY = loc 32 31 33 32 SOURCES = \ 34 loc info.c33 loc.c 35 34 36 35 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/loc/loc.c
r8f6bffdd rc4b0317 27 27 */ 28 28 29 /** @addtogroup loc info29 /** @addtogroup loc 30 30 * @{ 31 31 */ 32 /** @file loc info.c Print information from location service.32 /** @file loc.c Print information from location service. 33 33 */ 34 34 … … 41 41 #include <sys/typefmt.h> 42 42 43 #define NAME "loc info"43 #define NAME "loc" 44 44 45 int main(int argc, char *argv[]) 45 static int show_cat(const char *cat_name, category_id_t cat_id) 46 { 47 service_id_t *svc_ids; 48 size_t svc_cnt; 49 char *svc_name; 50 int rc; 51 size_t j; 52 53 printf("%s (%" PRIun "):\n", cat_name, cat_id); 54 55 rc = loc_category_get_svcs(cat_id, &svc_ids, &svc_cnt); 56 if (rc != EOK) { 57 printf(NAME ": Failed getting list of services in " 58 "category %s, skipping.\n", cat_name); 59 return rc; 60 } 61 62 for (j = 0; j < svc_cnt; j++) { 63 rc = loc_service_get_name(svc_ids[j], &svc_name); 64 if (rc != EOK) { 65 printf(NAME ": Unknown service name (SID %" 66 PRIun ").\n", svc_ids[j]); 67 continue; 68 } 69 printf("\t%s (%" PRIun ")\n", svc_name, svc_ids[j]); 70 free(svc_name); 71 } 72 73 free(svc_ids); 74 return EOK; 75 } 76 77 static int list_svcs_by_cat(void) 46 78 { 47 79 category_id_t *cat_ids; 48 80 size_t cat_cnt; 49 service_id_t *svc_ids;50 size_t svc_cnt;51 81 52 size_t i , j;82 size_t i; 53 83 char *cat_name; 54 char *svc_name;55 84 int rc; 56 85 … … 58 87 if (rc != EOK) { 59 88 printf(NAME ": Error getting list of categories.\n"); 60 return 1;89 return rc; 61 90 } 62 91 … … 68 97 if (cat_name == NULL) { 69 98 printf(NAME ": Error allocating memory.\n"); 70 return 1; 99 free(cat_ids); 100 return rc; 71 101 } 72 102 73 printf("%s (%" PRIun "):\n", cat_name, cat_ids[i]); 103 rc = show_cat(cat_name, cat_ids[i]); 104 (void) rc; 74 105 75 rc = loc_category_get_svcs(cat_ids[i], &svc_ids, &svc_cnt);76 if (rc != EOK) {77 printf(NAME ": Failed getting list of services in "78 "category %s, skipping.\n", cat_name);79 free(cat_name);80 continue;81 }82 83 for (j = 0; j < svc_cnt; j++) {84 rc = loc_service_get_name(svc_ids[j], &svc_name);85 if (rc != EOK) {86 printf(NAME ": Unknown service name (SID %"87 PRIun ").\n", svc_ids[j]);88 continue;89 }90 printf("\t%s (%" PRIun ")\n", svc_name, svc_ids[j]);91 free(svc_name);92 }93 94 free(svc_ids);95 106 free(cat_name); 96 107 } 97 108 98 109 free(cat_ids); 110 return EOK; 111 } 112 113 static void print_syntax(void) 114 { 115 printf("syntax:\n" 116 "\t" NAME " List categories and services " 117 "they contain\n" 118 "\t" NAME " show-cat <category> List services in category\n"); 119 } 120 121 int main(int argc, char *argv[]) 122 { 123 int rc; 124 char *cmd; 125 char *cat_name; 126 category_id_t cat_id; 127 128 if (argc <= 1) { 129 rc = list_svcs_by_cat(); 130 if (rc != EOK) 131 return 1; 132 return 0; 133 } 134 135 cmd = argv[1]; 136 if (str_cmp(cmd, "show-cat") == 0) { 137 if (argc < 3) { 138 printf("Argument missing.\n"); 139 print_syntax(); 140 return 1; 141 } 142 143 cat_name = argv[2]; 144 rc = loc_category_get_id(cat_name, &cat_id, 0); 145 if (rc != EOK) { 146 printf("Error looking up category '%s'.\n", cat_name); 147 return 1; 148 } 149 150 rc = show_cat(cat_name, cat_id); 151 if (rc != EOK) 152 return 1; 153 } else { 154 printf("Invalid command '%s'\n", cmd); 155 print_syntax(); 156 return 1; 157 } 158 99 159 return 0; 100 160 } -
uspace/app/sbi/src/stype.c
r8f6bffdd rc4b0317 652 652 assert(iface_ti->tic == tic_tobject); 653 653 iface = iface_ti->u.tobject->csi; 654 assert(iface->cc = csi_interface);654 assert(iface->cc == csi_interface); 655 655 656 656 #ifdef DEBUG_TYPE_TRACE -
uspace/app/websrv/websrv.c
r8f6bffdd rc4b0317 1 1 /* 2 * Copyright (c) 201 1Jiri Svoboda2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 41 41 #include <stdlib.h> 42 42 #include <fcntl.h> 43 #include <task.h> 43 44 44 45 #include <net/in.h> … … 71 72 72 73 static char fbuf[BUFFER_SIZE]; 74 75 static bool verbose = false; 73 76 74 77 /** Responses to send to client. */ … … 187 190 size_t response_size = str_size(msg); 188 191 189 fprintf(stderr, "Sending response\n"); 192 if (verbose) 193 fprintf(stderr, "Sending response\n"); 194 190 195 ssize_t rc = send(conn_sd, (void *) msg, response_size, 0); 191 196 if (rc < 0) { … … 251 256 } 252 257 253 fprintf(stderr, "Request: %s", lbuf); 258 if (verbose) 259 fprintf(stderr, "Request: %s", lbuf); 254 260 255 261 if (str_lcmp(lbuf, "GET ", 4) != 0) { … … 266 272 267 273 *end_uri = '\0'; 268 fprintf(stderr, "Requested URI: %s\n", uri); 274 if (verbose) 275 fprintf(stderr, "Requested URI: %s\n", uri); 269 276 270 277 if (!uri_is_valid(uri)) { … … 287 294 "\n" 288 295 "-h | --help\n" 289 "\tShow this application help.\n"); 296 "\tShow this application help.\n" 297 "-v | --verbose\n" 298 "\tVerbose mode\n"); 290 299 } 291 300 … … 306 315 307 316 port = (uint16_t) value; 317 break; 318 case 'v': 319 verbose = true; 308 320 break; 309 321 /* Long options with double dash */ … … 318 330 319 331 port = (uint16_t) value; 332 } else if (str_cmp(argv[*index] +2, "verbose") == 0) { 333 verbose = true; 320 334 } else { 321 335 usage(); … … 358 372 } 359 373 360 fprintf(stderr, "Creating socket\n"); 374 printf("%s: HelenOS web server\n", NAME); 375 376 if (verbose) 377 fprintf(stderr, "Creating socket\n"); 361 378 362 379 int listen_sd = socket(PF_INET, SOCK_STREAM, 0); … … 380 397 } 381 398 382 fprintf(stderr, "Listening for connections at port %" PRIu16 "\n", 383 port); 399 fprintf(stderr, "%s: Listening for connections at port %" PRIu16 "\n", 400 NAME, port); 401 402 task_retval(0); 403 384 404 while (true) { 385 405 struct sockaddr_in raddr; … … 393 413 } 394 414 395 fprintf(stderr, "Connection accepted (sd=%d), " 396 "waiting for request\n", conn_sd); 415 if (verbose) { 416 fprintf(stderr, "Connection accepted (sd=%d), " 417 "waiting for request\n", conn_sd); 418 } 397 419 398 420 rbuf_out = 0; … … 412 434 } 413 435 414 fprintf(stderr, "Connection closed\n"); 436 if (verbose) 437 fprintf(stderr, "Connection closed\n"); 415 438 } 416 439
Note:
See TracChangeset
for help on using the changeset viewer.
