Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (16 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/coreutils/sleep.c

    r821 r1765  
    55 * Copyright (C) 2003  Manuel Novoa III  <mjn3@codepoet.org>
    66 *
    7  * This program is free software; you can redistribute it and/or modify
    8  * it under the terms of the GNU General Public License as published by
    9  * the Free Software Foundation; either version 2 of the License, or
    10  * (at your option) any later version.
    11  *
    12  * This program is distributed in the hope that it will be useful,
    13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    15  * General Public License for more details.
    16  *
    17  * You should have received a copy of the GNU General Public License
    18  * along with this program; if not, write to the Free Software
    19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    20  *
     7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
    218 */
    229
     
    3219 */
    3320
    34 #include <stdlib.h>
    35 #include <limits.h>
    36 #include <unistd.h>
    37 #include "busybox.h"
     21#include "libbb.h"
    3822
    39 #ifdef CONFIG_FEATURE_FANCY_SLEEP
    40 static const struct suffix_mult sleep_suffixes[] = {
     23/* This is a NOFORK applet. Be very careful! */
     24
     25
     26#if ENABLE_FEATURE_FANCY_SLEEP
     27static const struct suffix_mult sfx[] = {
    4128    { "s", 1 },
    4229    { "m", 60 },
    4330    { "h", 60*60 },
    4431    { "d", 24*60*60 },
    45     { NULL, 0 }
     32    { }
    4633};
    4734#endif
    4835
     36int sleep_main(int argc, char **argv);
    4937int sleep_main(int argc, char **argv)
    5038{
    51     unsigned int duration;
     39    unsigned duration;
    5240
    53 #ifdef CONFIG_FEATURE_FANCY_SLEEP
     41#if ENABLE_FEATURE_FANCY_SLEEP
    5442
    5543    if (argc < 2) {
     
    6048    duration = 0;
    6149    do {
    62         duration += bb_xgetularg_bnd_sfx(*argv, 10,
    63                                          0, UINT_MAX-duration,
    64                                          sleep_suffixes);
     50        duration += xatoul_range_sfx(*argv, 0, UINT_MAX-duration, sfx);
    6551    } while (*++argv);
    6652
    67 #else  /* CONFIG_FEATURE_FANCY_SLEEP */
     53#else  /* FEATURE_FANCY_SLEEP */
    6854
    6955    if (argc != 2) {
     
    7157    }
    7258
    73 #if UINT_MAX == ULONG_MAX
    74     duration = bb_xgetularg10(argv[1]);
    75 #else
    76     duration = bb_xgetularg10_bnd(argv[1], 0, UINT_MAX);
    77 #endif
     59    duration = xatou(argv[1]);
    7860
    79 #endif /* CONFIG_FEATURE_FANCY_SLEEP */
     61#endif /* FEATURE_FANCY_SLEEP */
    8062
    8163    if (sleep(duration)) {
Note: See TracChangeset for help on using the changeset viewer.