2 * sleep -- sleep for fractions of a second
4 * usage: sleep seconds[.fraction]
8 Copyright (C) 1999-2009 Free Software Foundation, Inc.
10 This file is part of GNU Bash.
11 Bash is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 Bash is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with Bash. If not, see <http://www.gnu.org/licenses/>.
27 #include "bashtypes.h"
29 #if defined (TIME_WITH_SYS_TIME)
30 # include <sys/time.h>
33 # if defined (HAVE_SYS_TIME_H)
34 # include <sys/time.h>
40 #if defined (HAVE_UNISTD_H)
45 #include "chartypes.h"
54 if (usp) *usp = usec; \
69 if (*list
->word
->word
== '-' || list
->next
) {
74 if (uconvert(list
->word
->word
, &sec
, &usec
)) {
76 return(EXECUTION_SUCCESS
);
79 builtin_error("%s: bad sleep interval", list
->word
->word
);
80 return (EXECUTION_FAILURE
);
83 static char *sleep_doc
[] = {
84 "Suspend execution for specified period.",
86 "sleep suspends execution for a minimum of SECONDS[.FRACTION] seconds.",
90 struct builtin sleep_struct
= {
95 "sleep seconds[.fraction]",