From 3a9b7529f72b47355aa105185be4de0c58783922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Thu, 3 Sep 1998 06:21:34 +0200 Subject: [PATCH] Added verbose option. Rev: src/lsh.c:1.5 Rev: src/lshd.c:1.3 --- src/lsh.c | 6 ++++-- src/lshd.c | 29 +++++++++++++++-------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/lsh.c b/src/lsh.c index 7f398910b..0ccd43fbe 100644 --- a/src/lsh.c +++ b/src/lsh.c @@ -28,7 +28,6 @@ int main(int argc, char **argv) { char *host = NULL; char *port = "ssh"; - /* int verbose; */ int option; struct sockaddr_in remote; @@ -37,7 +36,7 @@ int main(int argc, char **argv) * strings to and from UTF8. */ setlocale(LC_CTYPE, ""); - while((option = getopt(argc, argv, "dp:q")) != -1) + while((option = getopt(argc, argv, "dp:qv")) != -1) switch(option) { case 'p': @@ -49,6 +48,9 @@ int main(int argc, char **argv) case 'd': debug_flag = 1; break; + case 'v': + verbose_flag = 1; + break; default: usage(); } diff --git a/src/lshd.c b/src/lshd.c index 281ca070e..56d6f8c4e 100644 --- a/src/lshd.c +++ b/src/lshd.c @@ -3,12 +3,17 @@ * main server program. */ -#include <getopt.h> +#include <stdio.h> +#include <locale.h> + +#include "getopt.h" #include "io.h" #include "werror.h" #include "server.h" +#define BLOCK_SIZE 32768 + /* Global variable */ struct io_backend backend; @@ -23,7 +28,6 @@ int main(int argc, char **argv) { char *host = NULL; /* Interface to bind */ char *port = "ssh"; - int verbose; int option; struct sockaddr_in local; @@ -32,7 +36,7 @@ int main(int argc, char **argv) * strings to and from UTF8. */ setlocale(LC_CTYPE, ""); - while((option = getopt(argc, argv, "dp:qi:")) != -1) + while((option = getopt(argc, argv, "dp:qi:v")) != -1) switch(option) { case 'p': @@ -47,6 +51,9 @@ int main(int argc, char **argv) case 'i': host = optarg; break; + case 'v': + verbose_flag = 1; + break; default: usage(); } @@ -60,18 +67,12 @@ int main(int argc, char **argv) exit(1); } - { - struct server_callback connected = { - { (fd_callback_f) server_initiate }, - &backend, - BLOCK_SIZE; - }; - - io_listen(&backend, &local, - make_server_callback(backend, BLOCK_SIZE)); - } + io_listen(&backend, &local, + make_server_callback(&backend, + "lsh - a free ssh", + BLOCK_SIZE)); - io_run(); + io_run(&backend); return 0; } -- GitLab