9 /* #include <iostuff.h>
11 /* void doze(microseconds)
12 /* unsigned microseconds;
14 /* doze() sleeps for the specified number of microseconds. It is
15 /* a simple alternative for systems that lack usleep().
17 /* All errors are fatal.
21 /* The Secure Mailer license must be distributed with this software.
24 /* IBM T.J. Watson Research
26 /* Yorktown Heights, NY 10598, USA
35 #ifdef USE_SYS_SELECT_H
36 #include <sys/select.h>
39 /* Utility library. */
44 /* doze - sleep a while */
46 void doze(unsigned delay
)
50 #define MILLION 1000000
52 tv
.tv_sec
= delay
/ MILLION
;
53 tv
.tv_usec
= delay
% MILLION
;
54 while (select(0, (fd_set
*) 0, (fd_set
*) 0, (fd_set
*) 0, &tv
) < 0)
56 msg_fatal("doze: select: %m");
63 int main(int argc
, char **argv
)
67 if (argc
!= 2 || (delay
= atol(argv
[1])) == 0)
68 msg_fatal("usage: %s microseconds", argv
[0]);