Commit 532ab108 authored by Max Lv's avatar Max Lv

fix the args

parent c7dd2f9a
......@@ -534,13 +534,35 @@ static void accept_cb (EV_P_ ev_io *w, int revents)
int main (int argc, char **argv)
{
if (argc < 5)
return -1;
char *server = NULL;
char *remote_port = NULL;
char *port = NULL;
char *key = NULL;
int c;
opterr = 0;
while ((c = getopt (argc, argv, "s:p:l:k:")) != -1) {
switch (c) {
case 's':
server = optarg;
break;
case 'p':
remote_port = optarg;
break;
case 'l':
port = optarg;
break;
case 'k':
key = optarg;
break;
}
}
const char *server = argv[1];
const char *remote_port = argv[2];
const char *port = argv[3];
const char *key = argv[4];
if (server == NULL || remote_port == NULL ||
port == NULL || key == NULL) {
exit(EXIT_FAILURE);
}
/* Our process ID and Session ID */
pid_t pid, sid;
......
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