Commit 8e458d9c authored by Cedric Roux's avatar Cedric Roux

add a very basic step mechanism to replay.c

parent c5b126f5
......@@ -92,7 +92,8 @@ void usage(void)
printf(
"options:\n"
" -i <input file> this option is mandatory\n"
" -p <port> wait connection on given port (default %d)\n",
" -p <port> wait connection on given port (default %d)\n"
" -w user must press a key after each sent event\n",
DEFAULT_REMOTE_PORT
);
exit(1);
......@@ -108,6 +109,7 @@ int main(int n, char **v)
int socket;
FILE *in;
int do_send;
int do_wait = 0;
for (i = 1; i < n; i++) {
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
......@@ -115,6 +117,7 @@ int main(int n, char **v)
{ if (i > n-2) usage(); input_filename = v[++i]; continue; }
if (!strcmp(v[i], "-p"))
{ if (i > n-2) usage(); port = atoi(v[++i]); continue; }
if (!strcmp(v[i], "-w")) { do_wait = 1; continue; }
usage();
}
......@@ -169,6 +172,8 @@ int main(int n, char **v)
if (do_send)
if (socket_send(socket, v, vpos) != 0)
{ printf("ERROR: socket writing failed\n"); abort(); }
if (do_send && do_wait) getchar();
}
fclose(in);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment