Changeset 4e716180 in mainline for uspace/app/nterm/conn.c
- Timestamp:
- 2013-05-03T21:14:39Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 716357f
- Parents:
- 1c7ba2d (diff), 5d1cb8a (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nterm/conn.c
r1c7ba2d r4e716180 33 33 */ 34 34 35 #include <byteorder.h> 35 36 #include <stdbool.h> 36 37 #include <errno.h> 37 38 #include <fibril.h> 39 #include <inet/dnsr.h> 38 40 #include <net/socket.h> 39 41 #include <stdio.h> … … 74 76 { 75 77 struct sockaddr_in addr; 78 dnsr_hostinfo_t *hinfo = NULL; 76 79 int rc; 77 80 char *endptr; … … 81 84 rc = inet_pton(addr.sin_family, addr_s, (uint8_t *)&addr.sin_addr); 82 85 if (rc != EOK) { 83 printf("Invalid addres %s\n", addr_s); 84 return EINVAL; 86 /* Try interpreting as a host name */ 87 rc = dnsr_name2host(addr_s, &hinfo); 88 if (rc != EOK) { 89 printf("Error resolving host '%s'.\n", addr_s); 90 goto error; 91 } 92 93 addr.sin_addr.s_addr = host2uint32_t_be(hinfo->addr.ipv4); 85 94 } 86 95 … … 88 97 if (*endptr != '\0') { 89 98 printf("Invalid port number %s\n", port_s); 90 return EINVAL;99 goto error; 91 100 } 92 101 … … 95 104 goto error; 96 105 97 printf("Connecting to address%s port %u\n", addr_s, ntohs(addr.sin_port));106 printf("Connecting to host %s port %u\n", addr_s, ntohs(addr.sin_port)); 98 107 99 108 rc = connect(conn_fd, (struct sockaddr *)&addr, sizeof(addr));
Note:
See TracChangeset
for help on using the changeset viewer.