Contents of /tags/mkinitrd-6_1_12/klibc/usr/utils/sleep.c
Parent Directory | Revision Log
Revision 939 -
(show annotations)
(download)
Tue Nov 17 21:24:51 2009 UTC (14 years, 10 months ago) by niro
File MIME type: text/plain
File size: 376 byte(s)
Tue Nov 17 21:24:51 2009 UTC (14 years, 10 months ago) by niro
File MIME type: text/plain
File size: 376 byte(s)
tagged 'mkinitrd-6_1_12'
1 | #include <stdio.h> |
2 | #include <stdlib.h> |
3 | #include <time.h> |
4 | #include <errno.h> |
5 | |
6 | int main(int argc, char *argv[]) |
7 | { |
8 | struct timespec ts; |
9 | char *p; |
10 | |
11 | if (argc != 2) |
12 | goto err; |
13 | |
14 | p = strtotimespec(argv[1], &ts); |
15 | if (*p) |
16 | goto err; |
17 | |
18 | while (nanosleep(&ts, &ts) == -1 && errno == EINTR) ; |
19 | |
20 | return 0; |
21 | |
22 | err: |
23 | fprintf(stderr, "Usage: %s seconds[.fraction]\n", argv[0]); |
24 | return 1; |
25 | } |