On Fri, May 03, 2002 at 02:51:54PM +0200, Francois Taiani wrote:
Hi everyone,
I'm not sure this is directly connected with the ppc distrib, but I'v
just discovered mac-on-linux's start script (startmol) uses a command
'usleep' which seems not to be present in debian. (I've got 'sleep',
which on my system is equivalent to usleep since it accepts floating
point value. But I need to change manually the startmol script.)
Would anybody know if there is a real reason for usleep missing in
debian (MDB), or if I just have to search hard enough to get the correct
package ?
I rewrote it a few months ago. Pretty much, usleep is a function that
makes a process do nothing for a certain number of microseconds. It is
in the standard C library, and might be a shell internal in something
other than bash.
I have attached the C code for my version of usleep. To compile it,
save it as a file named usleep.c, and type:
gcc usleep.c -o usleep
Then, as root copy it into /usr/local/bin.
usleep.c
------------------------------
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
int main(int argc, char* argv[]) {
unsigned long int length = 0;
if (argc != 2) {
printf("%s must be given a time\n", argv[0]);
return 1;
}
length = strtol(argv[1],NULL, 10);
if (length == LONG_MAX) {
printf("Number is too large\n");
return 1;
}
usleep(length);
return 0;
}
-------------------------------
-Nathan Conrad