~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to src/sleep.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* sleep - delay for a specified amount of time.
2
 
   Copyright (C) 1984, 1991-1997, 1999-2005, 2007-2011 Free Software
3
 
   Foundation, Inc.
 
2
   Copyright (C) 1984-2012 Free Software Foundation, Inc.
4
3
 
5
4
   This program is free software: you can redistribute it and/or modify
6
5
   it under the terms of the GNU General Public License as published by
28
27
#include "xnanosleep.h"
29
28
#include "xstrtod.h"
30
29
 
31
 
/* The official name of this program (e.g., no `g' prefix).  */
 
30
/* The official name of this program (e.g., no 'g' prefix).  */
32
31
#define PROGRAM_NAME "sleep"
33
32
 
34
33
#define AUTHORS \
39
38
usage (int status)
40
39
{
41
40
  if (status != EXIT_SUCCESS)
42
 
    fprintf (stderr, _("Try `%s --help' for more information.\n"),
43
 
             program_name);
 
41
    emit_try_help ();
44
42
  else
45
43
    {
46
44
      printf (_("\
47
45
Usage: %s NUMBER[SUFFIX]...\n\
48
46
  or:  %s OPTION\n\
49
 
Pause for NUMBER seconds.  SUFFIX may be `s' for seconds (the default),\n\
50
 
`m' for minutes, `h' for hours or `d' for days.  Unlike most implementations\n\
 
47
Pause for NUMBER seconds.  SUFFIX may be 's' for seconds (the default),\n\
 
48
'm' for minutes, 'h' for hours or 'd' for days.  Unlike most implementations\n\
51
49
that require NUMBER be an integer, here NUMBER may be an arbitrary floating\n\
52
50
point number.  Given two or more arguments, pause for the amount of time\n\
53
51
specified by the sum of their values.\n\
63
61
 
64
62
/* Given a floating point value *X, and a suffix character, SUFFIX_CHAR,
65
63
   scale *X by the multiplier implied by SUFFIX_CHAR.  SUFFIX_CHAR may
66
 
   be the NUL byte or `s' to denote seconds, `m' for minutes, `h' for
67
 
   hours, or `d' for days.  If SUFFIX_CHAR is invalid, don't modify *X
 
64
   be the NUL byte or 's' to denote seconds, 'm' for minutes, 'h' for
 
65
   hours, or 'd' for days.  If SUFFIX_CHAR is invalid, don't modify *X
68
66
   and return false.  Otherwise return true.  */
69
67
 
70
68
static bool