Changeset 8565a42 in mainline for uspace/app/ping


Ignore:
Timestamp:
2018-03-02T20:34:50Z (8 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (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.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

File:
1 edited

Legend:

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

    r3061bc1 r8565a42  
    115115        if (rc != EOK)
    116116                return ENOMEM;
    117        
     117
    118118        char *adest;
    119119        rc = inet_addr_format(&dest_addr, &adest);
     
    122122                return ENOMEM;
    123123        }
    124        
     124
    125125        printf("Received ICMP echo reply: from %s to %s, seq. no %u, "
    126126            "payload size %zu\n", asrc, adest, sdu->seq_no, sdu->size);
    127        
     127
    128128        ping_signal_received(RECEIVED_SUCCESS);
    129        
     129
    130130        free(asrc);
    131131        free(adest);
     
    136136{
    137137        inetping_sdu_t sdu;
    138        
     138
    139139        sdu.src = src_addr;
    140140        sdu.dest = dest_addr;
     
    142142        sdu.data = (void *) "foo";
    143143        sdu.size = 3;
    144        
     144
    145145        errno_t rc = inetping_send(&sdu);
    146146        if (rc != EOK)
    147147                printf("Failed sending echo request: %s: %s.\n",
    148148                    str_error_name(rc), str_error(rc));
    149        
     149
    150150        return rc;
    151151}
     
    154154{
    155155        uint16_t seq_no = 0;
    156        
     156
    157157        while ((repeat_count--) || (repeat_forever)) {
    158158                fibril_mutex_lock(&received_lock);
    159159                received = RECEIVED_NONE;
    160160                fibril_mutex_unlock(&received_lock);
    161                
     161
    162162                (void) ping_send(++seq_no);
    163                
     163
    164164                fibril_mutex_lock(&received_lock);
    165165                errno_t rc = fibril_condvar_wait_timeout(&received_cv, &received_lock,
     
    167167                received_t recv = received;
    168168                fibril_mutex_unlock(&received_lock);
    169                
     169
    170170                if ((rc == ETIMEOUT) || (recv == RECEIVED_NONE))
    171171                        printf("Echo request timed out (seq. no %u)\n", seq_no);
    172                
     172
    173173                if (recv == RECEIVED_INTERRUPT)
    174174                        break;
    175                
     175
    176176                if ((repeat_count > 0) || (repeat_forever)) {
    177177                        fibril_mutex_lock(&received_lock);
     
    180180                        recv = received;
    181181                        fibril_mutex_unlock(&received_lock);
    182                        
     182
    183183                        if (recv == RECEIVED_INTERRUPT)
    184184                                break;
    185185                }
    186186        }
    187        
     187
    188188        ping_signal_quit();
    189189        return 0;
     
    193193{
    194194        console_ctrl_t *con = console_init(stdin, stdout);
    195        
     195
    196196        while (true) {
    197197                cons_event_t ev;
    198198                if (!console_get_event(con, &ev))
    199199                        break;
    200                
     200
    201201                if ((ev.type == CEV_KEY) && (ev.ev.key.type == KEY_PRESS) &&
    202202                    ((ev.ev.key.mods & (KM_ALT | KM_SHIFT)) == 0) &&
     
    209209                }
    210210        }
    211        
     211
    212212        return 0;
    213213}
     
    221221        const char *errmsg;
    222222        ip_ver_t ip_ver = ip_any;
    223        
     223
    224224        errno_t rc = inetping_init(&ev_ops);
    225225        if (rc != EOK) {
     
    228228                goto error;
    229229        }
    230        
     230
    231231        int c;
    232232        while ((c = getopt(argc, argv, short_options)) != -1) {
     
    255255                }
    256256        }
    257        
     257
    258258        if (optind >= argc) {
    259259                printf("IP address or host name not supplied.\n");
     
    261261                goto error;
    262262        }
    263        
     263
    264264        host = argv[optind];
    265        
     265
    266266        /* Look up host */
    267267        rc = inet_host_plookup_one(host, ip_ver, &dest_addr, NULL, &errmsg);
     
    270270                goto error;
    271271        }
    272        
     272
    273273        /* Determine source address */
    274274        rc = inetping_get_srcaddr(&dest_addr, &src_addr);
     
    277277                goto error;
    278278        }
    279        
     279
    280280        rc = inet_addr_format(&src_addr, &asrc);
    281281        if (rc != EOK) {
     
    283283                goto error;
    284284        }
    285        
     285
    286286        rc = inet_addr_format(&dest_addr, &adest);
    287287        if (rc != EOK) {
     
    289289                goto error;
    290290        }
    291        
     291
    292292        if (asprintf(&sdest, "%s (%s)", host, adest) < 0) {
    293293                printf("Out of memory.\n");
    294294                goto error;
    295295        }
    296        
     296
    297297        printf("Sending ICMP echo request from %s to %s (Ctrl+Q to quit)\n",
    298298            asrc, sdest);
    299        
     299
    300300        fid_t fid = fibril_create(transmit_fibril, NULL);
    301301        if (fid == 0) {
     
    303303                goto error;
    304304        }
    305        
     305
    306306        fibril_add_ready(fid);
    307        
     307
    308308        fid = fibril_create(input_fibril, NULL);
    309309        if (fid == 0) {
     
    311311                goto error;
    312312        }
    313        
     313
    314314        fibril_add_ready(fid);
    315        
     315
    316316        fibril_mutex_lock(&quit_lock);
    317317        while (!quit)
    318318                fibril_condvar_wait(&quit_cv, &quit_lock);
    319319        fibril_mutex_unlock(&quit_lock);
    320        
     320
    321321        free(asrc);
    322322        free(adest);
    323323        free(sdest);
    324324        return 0;
    325        
     325
    326326error:
    327327        free(asrc);
Note: See TracChangeset for help on using the changeset viewer.