Usermode/telnet - Added default port number
authorJohn Hodge <[email protected]>
Sat, 6 Aug 2011 00:37:14 +0000 (08:37 +0800)
committerJohn Hodge <[email protected]>
Sat, 6 Aug 2011 00:37:14 +0000 (08:37 +0800)
Usermode/Applications/telnet_src/main.c

index d1f8d17..0d12c1c 100644 (file)
@@ -7,7 +7,7 @@
 #include <readline.h>\r
 #include <string.h>\r
 \r
-#define BUFSIZ 128\r
+#define BUFSIZ 2048\r
 \r
 // === PROTOTYPES ===\r
  int   main(int argc, char *argv[], char *envp[]);\r
@@ -20,9 +20,20 @@ int main(int argc, char *argv[], char *envp[])
         int    client_running = 1;\r
         int    bUseReadline = !!argv[3];       // HACK: If third argument is present, use ReadLine\r
        tReadline       *readline_info;\r
+        int    port;\r
+       \r
+       if( argc < 2 || argc > 3 ) {\r
+               fprintf(stderr, "Usage: telnet <host> [<port>]\n Port defaults to 23\n");\r
+               return 0;\r
+       }\r
+       \r
+       if(argc == 3)\r
+               port = atoi(argv[2]);\r
+       else\r
+               port = 23;\r
        \r
        // Connect to the remove server\r
-       server_fd = OpenTCP( argv[1], atoi(argv[2]) );\r
+       server_fd = OpenTCP( argv[1], port );\r
        if( server_fd == -1 ) {\r
                fprintf(stderr, "Unable to create socket\n");\r
                return -1;\r

UCC git Repository :: git.ucc.asn.au