Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (7 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/util-linux/rdate.c

    r2725 r3232  
    22/*
    33 * The Rdate command will ask a time server for the RFC 868 time
    4  *  and optionally set the system time.
     4 * and optionally set the system time.
    55 *
    66 * by Sterling Huxley <sterling@europa.com>
     
    88 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    99*/
     10
     11//usage:#define rdate_trivial_usage
     12//usage:       "[-sp] HOST"
     13//usage:#define rdate_full_usage "\n\n"
     14//usage:       "Get and possibly set the system date/time from a remote HOST\n"
     15//usage:     "\n    -s  Set the system date/time (default)"
     16//usage:     "\n    -p  Print the date/time"
    1017
    1118#include "libbb.h"
     
    2936    fd = create_and_connect_stream_or_die(host, bb_lookup_port("time", "tcp", 37));
    3037
    31     if (safe_read(fd, (void *)&nett, 4) != 4)    /* read time from server */
     38    if (safe_read(fd, &nett, 4) != 4)    /* read time from server */
    3239        bb_error_msg_and_die("%s did not send the complete time", host);
    33     close(fd);
     40    if (ENABLE_FEATURE_CLEAN_UP)
     41        close(fd);
    3442
    35     /* convert from network byte order to local byte order.
     43    /* Convert from network byte order to local byte order.
    3644     * RFC 868 time is the number of seconds
    3745     * since 00:00 (midnight) 1 January 1900 GMT
    3846     * the RFC 868 time 2,208,988,800 corresponds to 00:00  1 Jan 1970 GMT
    39      * Subtract the RFC 868 time to get Linux epoch
     47     * Subtract the RFC 868 time to get Linux epoch.
    4048     */
    4149
     
    4755{
    4856    time_t remote_time;
    49     unsigned long flags;
     57    unsigned flags;
    5058
    5159    opt_complementary = "-1";
     
    5462    remote_time = askremotedate(argv[optind]);
    5563
    56     if ((flags & 2) == 0) {
     64    if (!(flags & 2)) { /* no -p (-s may be present) */
    5765        time_t current_time;
    5866
     
    6573    }
    6674
    67     if ((flags & 1) == 0)
     75    if (flags != 1) /* not lone -s */
    6876        printf("%s", ctime(&remote_time));
    6977
Note: See TracChangeset for help on using the changeset viewer.