Hi Nathan,
thanks for your usleep command. I had already changed the script to
"sleep 0.5" (and apparently it wasn't that important anyway), though
I've installed your usleep command since, it certainly will be useful
in the future.
I've aslo sent your code to the debian shellutils maintainer Michael
Stone (mailto:[EMAIL PROTECTED]) and asked him if it could be added to
debian in the future.
Regards
Francois
Nathan Conrad wrote:
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
--
Francois Taiani LAAS-CNRS (http://www.laas.fr)
+33 (0) 561 336 406 Dependable Computing
http://www.laas.fr/~ftaiani and Fault Tolerance
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]