Changeset 8fdb18e in mainline for uspace/app


Ignore:
Timestamp:
2013-05-03T14:51:30Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5d1cb8a
Parents:
ef904895 (diff), 1c7ba2da (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
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/dnsres/dnsres.c

    ref904895 r8fdb18e  
    3434
    3535#include <errno.h>
     36#include <inet/addr.h>
    3637#include <inet/dnsr.h>
    3738#include <stdio.h>
     
    4344{
    4445        printf("syntax: " NAME " <host-name>\n");
    45 }
    46 
    47 static int addr_format(inet_addr_t *addr, char **bufp)
    48 {
    49         int rc;
    50 
    51         rc = asprintf(bufp, "%d.%d.%d.%d", addr->ipv4 >> 24,
    52             (addr->ipv4 >> 16) & 0xff, (addr->ipv4 >> 8) & 0xff,
    53             addr->ipv4 & 0xff);
    54 
    55         if (rc < 0)
    56                 return ENOMEM;
    57 
    58         return EOK;
    5946}
    6047
     
    7663        }
    7764
    78         rc = addr_format(&hinfo->addr, &saddr);
     65        rc = inet_addr_format(&hinfo->addr, &saddr);
    7966        if (rc != EOK) {
    8067                dnsr_hostinfo_destroy(hinfo);
  • uspace/app/inet/inet.c

    ref904895 r8fdb18e  
    11/*
    2  * Copyright (c) 2012 Jiri Svoboda
     2 * Copyright (c) 2013 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3636
    3737#include <errno.h>
     38#include <inet/addr.h>
    3839#include <inet/inetcfg.h>
    3940#include <loc.h>
     
    5455}
    5556
    56 static int naddr_parse(const char *text, inet_naddr_t *naddr)
    57 {
    58         unsigned long a[4], bits;
    59         char *cp = (char *)text;
    60         int i;
    61 
    62         for (i = 0; i < 3; i++) {
    63                 a[i] = strtoul(cp, &cp, 10);
    64                 if (*cp != '.')
    65                         return EINVAL;
    66                 ++cp;
    67         }
    68 
    69         a[3] = strtoul(cp, &cp, 10);
    70         if (*cp != '/')
    71                 return EINVAL;
    72         ++cp;
    73 
    74         bits = strtoul(cp, &cp, 10);
    75         if (*cp != '\0')
    76                 return EINVAL;
    77 
    78         naddr->ipv4 = 0;
    79         for (i = 0; i < 4; i++) {
    80                 if (a[i] > 255)
    81                         return EINVAL;
    82                 naddr->ipv4 = (naddr->ipv4 << 8) | a[i];
    83         }
    84 
    85         if (bits > 31)
    86                 return EINVAL;
    87 
    88         naddr->bits = bits;
    89         return EOK;
    90 }
    91 
    92 static int addr_parse(const char *text, inet_addr_t *addr)
    93 {
    94         unsigned long a[4];
    95         char *cp = (char *)text;
    96         int i;
    97 
    98         for (i = 0; i < 3; i++) {
    99                 a[i] = strtoul(cp, &cp, 10);
    100                 if (*cp != '.')
    101                         return EINVAL;
    102                 ++cp;
    103         }
    104 
    105         a[3] = strtoul(cp, &cp, 10);
    106         if (*cp != '\0')
    107                 return EINVAL;
    108 
    109         addr->ipv4 = 0;
    110         for (i = 0; i < 4; i++) {
    111                 if (a[i] > 255)
    112                         return EINVAL;
    113                 addr->ipv4 = (addr->ipv4 << 8) | a[i];
    114         }
    115 
    116         return EOK;
    117 }
    118 
    119 static int naddr_format(inet_naddr_t *naddr, char **bufp)
    120 {
    121         int rc;
    122 
    123         rc = asprintf(bufp, "%d.%d.%d.%d/%d", naddr->ipv4 >> 24,
    124             (naddr->ipv4 >> 16) & 0xff, (naddr->ipv4 >> 8) & 0xff,
    125             naddr->ipv4 & 0xff, naddr->bits);
    126 
    127         if (rc < 0)
    128                 return ENOMEM;
    129 
    130         return EOK;
    131 }
    132 
    133 static int addr_format(inet_addr_t *addr, char **bufp)
    134 {
    135         int rc;
    136 
    137         rc = asprintf(bufp, "%d.%d.%d.%d", addr->ipv4 >> 24,
    138             (addr->ipv4 >> 16) & 0xff, (addr->ipv4 >> 8) & 0xff,
    139             addr->ipv4 & 0xff);
    140 
    141         if (rc < 0)
    142                 return ENOMEM;
    143 
    144         return EOK;
    145 }
    146 
    14757static int addr_create_static(int argc, char *argv[])
    14858{
     
    17888        }
    17989
    180         rc = naddr_parse(addr_spec, &naddr);
     90        rc = inet_naddr_parse(addr_spec, &naddr);
    18191        if (rc != EOK) {
    18292                printf(NAME ": Invalid network address format '%s'.\n",
     
    267177        route_name = argv[2];
    268178
    269         rc = naddr_parse(dest_str, &dest);
     179        rc = inet_naddr_parse(dest_str, &dest);
    270180        if (rc != EOK) {
    271181                printf(NAME ": Invalid network address format '%s'.\n",
     
    274184        }
    275185
    276         rc = addr_parse(router_str, &router);
     186        rc = inet_addr_parse(router_str, &router);
    277187        if (rc != EOK) {
    278188                printf(NAME ": Invalid address format '%s'.\n", router_str);
     
    366276                }
    367277
    368                 rc = naddr_format(&ainfo.naddr, &astr);
     278                rc = inet_naddr_format(&ainfo.naddr, &astr);
    369279                if (rc != EOK) {
    370280                        printf("Memory allocation failed.\n");
     
    430340                }
    431341
    432                 rc = naddr_format(&srinfo.dest, &dest_str);
     342                rc = inet_naddr_format(&srinfo.dest, &dest_str);
    433343                if (rc != EOK) {
    434344                        printf("Memory allocation failed.\n");
     
    437347                }
    438348
    439                 rc = addr_format(&srinfo.router, &router_str);
     349                rc = inet_addr_format(&srinfo.router, &router_str);
    440350                if (rc != EOK) {
    441351                        printf("Memory allocation failed.\n");
  • uspace/app/ping/ping.c

    ref904895 r8fdb18e  
    3838#include <fibril_synch.h>
    3939#include <inet/dnsr.h>
     40#include <inet/addr.h>
    4041#include <inet/inetping.h>
    4142#include <io/console.h>
     
    7273}
    7374
    74 static int addr_parse(const char *text, inet_addr_t *addr)
    75 {
    76         unsigned long a[4];
    77         char *cp = (char *)text;
    78         int i;
    79 
    80         for (i = 0; i < 3; i++) {
    81                 a[i] = strtoul(cp, &cp, 10);
    82                 if (*cp != '.')
    83                         return EINVAL;
    84                 ++cp;
    85         }
    86 
    87         a[3] = strtoul(cp, &cp, 10);
    88         if (*cp != '\0')
    89                 return EINVAL;
    90 
    91         addr->ipv4 = 0;
    92         for (i = 0; i < 4; i++) {
    93                 if (a[i] > 255)
    94                         return EINVAL;
    95                 addr->ipv4 = (addr->ipv4 << 8) | a[i];
    96         }
    97 
    98         return EOK;
    99 }
    100 
    101 static int addr_format(inet_addr_t *addr, char **bufp)
    102 {
    103         int rc;
    104 
    105         rc = asprintf(bufp, "%d.%d.%d.%d", addr->ipv4 >> 24,
    106             (addr->ipv4 >> 16) & 0xff, (addr->ipv4 >> 8) & 0xff,
    107             addr->ipv4 & 0xff);
    108 
    109         if (rc < 0)
    110                 return ENOMEM;
    111 
    112         return EOK;
    113 }
    114 
    11575static void ping_signal_done(void)
    11676{
     
    12686        int rc;
    12787
    128         rc = addr_format(&sdu->src, &asrc);
     88        rc = inet_addr_format(&sdu->src, &asrc);
    12989        if (rc != EOK)
    13090                return ENOMEM;
    13191
    132         rc = addr_format(&sdu->dest, &adest);
     92        rc = inet_addr_format(&sdu->dest, &adest);
    13393        if (rc != EOK) {
    13494                free(asrc);
     
    242202
    243203        /* Parse destination address */
    244         rc = addr_parse(argv[argi], &dest_addr);
     204        rc = inet_addr_parse(argv[argi], &dest_addr);
    245205        if (rc != EOK) {
    246206                /* Try interpreting as a host name */
     
    261221        }
    262222
    263         rc = addr_format(&src_addr, &asrc);
     223        rc = inet_addr_format(&src_addr, &asrc);
    264224        if (rc != EOK) {
    265225                printf(NAME ": Out of memory.\n");
     
    267227        }
    268228
    269         rc = addr_format(&dest_addr, &adest);
     229        rc = inet_addr_format(&dest_addr, &adest);
    270230        if (rc != EOK) {
    271231                printf(NAME ": Out of memory.\n");
  • uspace/app/vlaunch/vlaunch.c

    ref904895 r8fdb18e  
    121121        }
    122122       
    123         pixel_t grd_bg = PIXEL(255, 240, 240, 240);
     123        pixel_t grd_bg = PIXEL(255, 255, 255, 255);
    124124        pixel_t btn_bg = PIXEL(255, 0, 0, 0);
    125125        pixel_t btn_fg = PIXEL(255, 240, 240, 240);
    126         pixel_t lbl_bg = PIXEL(255, 240, 240, 240);
     126        pixel_t lbl_bg = PIXEL(255, 255, 255, 255);
    127127        pixel_t lbl_fg = PIXEL(255, 0, 0, 0);
    128128       
Note: See TracChangeset for help on using the changeset viewer.