Magellan Linux

Annotation of /trunk/mkinitrd-magellan/klibc/usr/utils/sleep.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 815 - (hide annotations) (download)
Fri Apr 24 18:32:46 2009 UTC (15 years, 1 month ago) by niro
File MIME type: text/plain
File size: 376 byte(s)
-updated to klibc-1.5.15
1 niro 532 #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 niro 815 err:
23 niro 532 fprintf(stderr, "Usage: %s seconds[.fraction]\n", argv[0]);
24     return 1;
25     }