oga's tools
修訂 | e03f7e928562b7fb4d44772a4a5c840e82483621 (tree) |
---|---|
時間 | 2014-01-05 14:13:21 |
作者 | oga <hyperoga@gmai...> |
Commiter | oga |
add usleep.c
@@ -26,7 +26,7 @@ TARGETS=$(VP)/age $(VP)/cal2 $(VP)/cgrep $(VP)/cmem $(VP)/cpkt $(VP)/cpuid \ | ||
26 | 26 | $(VP)/peke2 $(VP)/peke $(VP)/perfan $(VP)/strings2 $(VP)/t64an \ |
27 | 27 | $(VP)/tolower $(VP)/txt2vnt $(VP)/upload $(VP)/wavana $(VP)/wavcut2 \ |
28 | 28 | $(VP)/wavcut $(VP)/welcome $(VP)/whichx $(VP)/wwstat $(VP)/xalloc \ |
29 | - $(VP)/zusa $(VP)/rand2 | |
29 | + $(VP)/zusa $(VP)/rand2 $(VP)/usleep | |
30 | 30 | |
31 | 31 | TARGET_X=$(VP)/qix $(VP)/xmem $(VP)/xpkt $(VP)/xpstat |
32 | 32 |
@@ -289,6 +289,9 @@ $(VP)/u2dos : $(TOOL)/u2dos.c | ||
289 | 289 | $(VP)/upload : $(TOOL)/upload.c |
290 | 290 | ${CC} $? -o $@ -O |
291 | 291 | |
292 | +$(VP)/usleep : $(TOOL)/usleep.c | |
293 | + ${CC} $? -o $@ -O | |
294 | + | |
292 | 295 | $(VP)/wavana : $(TOOL)/wavana.c |
293 | 296 | ${CC} $? -o $@ -O |
294 | 297 |
@@ -0,0 +1,20 @@ | ||
1 | +#include <stdio.h> | |
2 | +#include <stdlib.h> | |
3 | + | |
4 | +int main(int a, char *b[]) | |
5 | +{ | |
6 | + int i; | |
7 | + int ms = 0; | |
8 | + | |
9 | + for (i = 1; i < a; i++) { | |
10 | + if (!strcmp(b[i], "-h")) { | |
11 | + printf("usage: usleep <ms>\n"); | |
12 | + return 1; | |
13 | + } | |
14 | + ms = atoi(b[i]); | |
15 | + } | |
16 | + | |
17 | + usleep(ms * 1000); | |
18 | + | |
19 | + return 0; | |
20 | +} |