X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=networking%2Ftelnet.c;h=c835c7a4525b2450fdc820428e4cdc551614852c;hb=5929edc1fac4340f99ed84e92bf3a2bedd4177c2;hp=24160057bbd9df946fafbe466381c41eca35eabf;hpb=f2ddc05ee77a2f5ab9a2be318c694d2f3d4e852c;p=oweals%2Fbusybox.git diff --git a/networking/telnet.c b/networking/telnet.c index 24160057b..c835c7a45 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -8,19 +8,7 @@ * Created: Thu Apr 7 13:29:41 1994 too * Last modified: Fri Jun 9 14:34:24 2000 too * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. * * HISTORY * Revision 3.1 1994/04/17 11:31:54 too @@ -47,7 +35,7 @@ #include "busybox.h" #if 0 -static const int DOTRACE = 1; +enum { DOTRACE = 1 }; #endif #ifdef DOTRACE @@ -57,24 +45,17 @@ static const int DOTRACE = 1; #define TRACE(x, y) #endif -#if 0 -#define USE_POLL -#include -#else -#include -#endif - #define DATABUFSIZE 128 #define IACBUFSIZE 128 -static const int CHM_TRY = 0; -static const int CHM_ON = 1; -static const int CHM_OFF = 2; +enum { + CHM_TRY = 0, + CHM_ON = 1, + CHM_OFF = 2, -static const int UF_ECHO = 0x01; -static const int UF_SGA = 0x02; + UF_ECHO = 0x01, + UF_SGA = 0x02, -enum { TS_0 = 1, TS_IAC = 2, TS_OPT = 3, @@ -216,7 +197,7 @@ static void handlenetoutput(int len) */ int i, j; - byte * p = G.buf; + byte * p = (byte*)G.buf; byte outbuf[4*DATABUFSIZE]; for (i = len, j = 0; i > 0; i--, p++) @@ -625,7 +606,7 @@ static void cookmode(void) if (G.do_termios) tcsetattr(0, TCSADRAIN, &G.termios_def); } -extern int telnet_main(int argc, char** argv) +int telnet_main(int argc, char** argv) { int len; struct sockaddr_in s_in; @@ -636,10 +617,6 @@ extern int telnet_main(int argc, char** argv) int maxfd; #endif -#ifdef CONFIG_FEATURE_TELNET_AUTOLOGIN - int opt; -#endif - #ifdef CONFIG_FEATURE_AUTOWIDTH get_terminal_width_height(0, &win_width, &win_height); #endif @@ -661,20 +638,9 @@ extern int telnet_main(int argc, char** argv) bb_show_usage(); #ifdef CONFIG_FEATURE_TELNET_AUTOLOGIN - autologin = NULL; - while ((opt = getopt(argc, argv, "al:")) != EOF) { - switch (opt) { - case 'l': - autologin = optarg; - break; - case 'a': - autologin = getenv("USER"); - break; - case '?': - bb_show_usage(); - break; - } - } + if (1 & bb_getopt_ulflags(argc, argv, "al:", &autologin)) + autologin = getenv("USER"); + if (optind < argc) { bb_lookup_host(&s_in, argv[optind++]); s_in.sin_port = bb_lookup_port((optind < argc) ? argv[optind++] : @@ -761,11 +727,3 @@ extern int telnet_main(int argc, char** argv) } } } - -/* -Local Variables: -c-file-style: "linux" -c-basic-offset: 4 -tab-width: 4 -End: -*/