aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-05-14 20:45:55 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-05-14 20:45:55 +0200
commit1465a8668ddb925494d5a1ef5adffc864a924459 (patch)
tree5e9f77e463f7c51e5583169a98d041948681b635
parent5083c2ab6ddd1748b1bb0391e55775f00ca224c9 (diff)
ipaccess: Default to port 3210 for the telnet session
No need to remember the CLI port of the BTS, it is static anyway
-rw-r--r--util/telnet-client.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/util/telnet-client.c b/util/telnet-client.c
index 15f4aed..3b2547a 100644
--- a/util/telnet-client.c
+++ b/util/telnet-client.c
@@ -159,6 +159,7 @@ int main(int argc, char **argv) {
char buffer[512];
int rs;
int sock;
+ const char *port;
struct sockaddr_in addr;
struct pollfd pfd[2];
struct addrinfo *ai;
@@ -166,17 +167,19 @@ int main(int argc, char **argv) {
struct termios tios;
/* check usage */
- if (argc != 3) {
- fprintf(stderr, "Usage:\n %s <host> <port>\n",
+ if (argc < 2) {
+ fprintf(stderr, "Usage:\n %s <host> [<port>]\n",
basename(argv[0]));
return 1;
}
+ port = argc > 2 ? argv[2] : "3210";
+
/* look up server host */
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
- if ((rs = getaddrinfo(argv[1], argv[2], &hints, &ai)) != 0) {
+ if ((rs = getaddrinfo(argv[1], port, &hints, &ai)) != 0) {
fprintf(stderr, "getaddrinfo() failed for %s: %s\n", argv[1],
gai_strerror(rs));
return 1;