| 1 |
#include <stdio.h> |
| 2 |
#include <string.h> |
| 3 |
#include <stdlib.h> |
| 4 |
|
| 5 |
#ifndef WIN32 |
| 6 |
#include <unistd.h> |
| 7 |
#else |
| 8 |
#include <windows.h> |
| 9 |
#endif |
| 10 |
|
| 11 |
#define SECONDS_TO_SLEEP 5 |
| 12 |
|
| 13 |
int main(int argc, char** argv) |
| 14 |
{ |
| 15 |
int i = 1; |
| 16 |
for(; i < argc; ++i) { |
| 17 |
if(strstr(argv[i], " ") || strstr(argv[i], "\t")) { |
| 18 |
// escape with double quoutes |
| 19 |
fprintf(stdout, "\"%s\" ", argv[i]); |
| 20 |
} else { |
| 21 |
// print it as it is |
| 22 |
fprintf(stdout, "%s ", argv[i]); |
| 23 |
} |
| 24 |
} |
| 25 |
fprintf(stdout, "\r\n"); |
| 26 |
fflush(stdout); |
| 27 |
|
| 28 |
#ifdef WIN32 |
| 29 |
Sleep(SECONDS_TO_SLEEP*1000); // Under Windows its in ms |
| 30 |
#else |
| 31 |
sleep(SECONDS_TO_SLEEP); // sleep for 100 seconds |
| 32 |
#endif |
| 33 |
return 0; |
| 34 |
} |