tamashell: now pause in milliseconds
This commit is contained in:
parent
9c7c4307d4
commit
9a101943b8
2 changed files with 17 additions and 4 deletions
|
@ -22,7 +22,7 @@ Shebang is supported, simply start your script with:
|
||||||
|
|
||||||
.SH COMMANDS
|
.SH COMMANDS
|
||||||
|
|
||||||
\fIp N\fP to introduce a pause of N seconds.
|
\fIp N\fP to introduce a pause of N milliseconds.
|
||||||
|
|
||||||
\fIq\fP or \fICtrl-d\fP to quit.
|
\fIq\fP or \fICtrl-d\fP to quit.
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,20 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <unistd.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
// Needed by sleep() under Unix
|
||||||
|
# include <unistd.h>
|
||||||
|
# define sleep usleep
|
||||||
|
# define SUSP_TIME 1000 // usecs.
|
||||||
|
#else
|
||||||
|
// Needed by Sleep() under Windows
|
||||||
|
# include <winbase.h>
|
||||||
|
# define sleep Sleep
|
||||||
|
# define SUSP_TIME 1 // msecs.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <nfc/nfc.h>
|
#include <nfc/nfc.h>
|
||||||
|
|
||||||
|
@ -132,9 +145,9 @@ int main(int argc, const char* argv[])
|
||||||
offset++;
|
offset++;
|
||||||
}
|
}
|
||||||
sscanf(cmd+offset, "%d", &s);
|
sscanf(cmd+offset, "%d", &s);
|
||||||
printf("Pause for %i secs\n", s);
|
printf("Pause for %i msecs\n", s);
|
||||||
if (s>0) {
|
if (s>0) {
|
||||||
sleep(s);
|
sleep(s * SUSP_TIME);
|
||||||
}
|
}
|
||||||
free(cmd);
|
free(cmd);
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue