Changeset 89ac5513 in mainline for uspace/app/nterm


Ignore:
Timestamp:
2013-06-23T19:54:53Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
Children:
ddb1922
Parents:
3abf0760 (diff), 96cbd18 (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.
Message:

Merge mainline changes.

Location:
uspace/app/nterm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/nterm/conn.c

    r3abf0760 r89ac5513  
    3333 */
    3434
     35#include <byteorder.h>
    3536#include <stdbool.h>
    3637#include <errno.h>
    3738#include <fibril.h>
     39#include <inet/dnsr.h>
    3840#include <net/socket.h>
    3941#include <stdio.h>
     
    7476{
    7577        struct sockaddr_in addr;
     78        dnsr_hostinfo_t *hinfo = NULL;
    7679        int rc;
    7780        char *endptr;
     
    8184        rc = inet_pton(addr.sin_family, addr_s, (uint8_t *)&addr.sin_addr);
    8285        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                rc = inet_addr_sockaddr_in(&hinfo->addr, &addr);
     94                if (rc != EOK) {
     95                        printf("Host '%s' not resolved as IPv4 address.\n", addr_s);
     96                        return rc;
     97                }
    8598        }
    8699
     
    88101        if (*endptr != '\0') {
    89102                printf("Invalid port number %s\n", port_s);
    90                 return EINVAL;
     103                goto error;
    91104        }
    92105
     
    95108                goto error;
    96109
    97         printf("Connecting to address %s port %u\n", addr_s, ntohs(addr.sin_port));
     110        printf("Connecting to host %s port %u\n", addr_s, ntohs(addr.sin_port));
    98111
    99112        rc = connect(conn_fd, (struct sockaddr *)&addr, sizeof(addr));
  • uspace/app/nterm/nterm.c

    r3abf0760 r89ac5513  
    104104static void print_syntax(void)
    105105{
    106         printf("syntax: nterm <ip-address> <port>\n");
     106        printf("syntax: nterm <host> <port>\n");
    107107}
    108108
Note: See TracChangeset for help on using the changeset viewer.