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) ...@@ -534,13 +534,35 @@ static void accept_cb (EV_P_ ev_io *w, int revents)
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
if (argc < 5) char *server = NULL;
return -1; 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]; if (server == NULL || remote_port == NULL ||
const char *remote_port = argv[2]; port == NULL || key == NULL) {
const char *port = argv[3]; exit(EXIT_FAILURE);
const char *key = argv[4]; }
/* Our process ID and Session ID */ /* Our process ID and Session ID */
pid_t pid, sid; 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