diff options
author | Jim Meyering <jim@meyering.net> | 1999-11-27 15:02:27 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1999-11-27 15:02:27 +0000 |
commit | 6b36a017db707b85bdf7275ba8d835b7f2c91fb6 (patch) | |
tree | bd9291ed646a42631f12c79020ee898ecac3391b | |
parent | 30d2b031abc4df6d64169d827393c65492ef6bf3 (diff) | |
download | coreutils-6b36a017db707b85bdf7275ba8d835b7f2c91fb6.tar.xz |
(argdecode): Move definition to precede use.
Remove prototype.
-rw-r--r-- | src/sleep.c | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/src/sleep.c b/src/sleep.c index 433bc9401..3074eb53d 100644 --- a/src/sleep.c +++ b/src/sleep.c @@ -27,9 +27,7 @@ /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "sleep" -#define AUTHORS "FIXME: unknown" - -static long argdecode PARAMS ((const char *s)); +#define AUTHORS "Jim Meyering" /* The name by which this program was run. */ char *program_name; @@ -63,6 +61,39 @@ h for hours or d for days.\n\ exit (status); } +static long +argdecode (const char *s) +{ + long value; + register const char *p = s; + register char c; + + value = 0; + while ((c = *p++) >= '0' && c <= '9') + value = value * 10 + c - '0'; + + switch (c) + { + case 's': + break; + case 'm': + value *= 60; + break; + case 'h': + value *= 60 * 60; + break; + case 'd': + value *= 60 * 60 * 24; + break; + default: + p--; + } + + if (*p) + error (1, 0, _("invalid time interval `%s'"), s); + return value; +} + int main (int argc, char **argv) { @@ -103,36 +134,3 @@ main (int argc, char **argv) exit (0); } - -static long -argdecode (const char *s) -{ - long value; - register const char *p = s; - register char c; - - value = 0; - while ((c = *p++) >= '0' && c <= '9') - value = value * 10 + c - '0'; - - switch (c) - { - case 's': - break; - case 'm': - value *= 60; - break; - case 'h': - value *= 60 * 60; - break; - case 'd': - value *= 60 * 60 * 24; - break; - default: - p--; - } - - if (*p) - error (1, 0, _("invalid time interval `%s'"), s); - return value; -} |