add network tools Added: trunk/reactos/base/applications/network/finger/ Added: trunk/reactos/base/applications/network/finger/LICENSE.txt Added: trunk/reactos/base/applications/network/finger/err.c Added: trunk/reactos/base/applications/network/finger/err.h Added: trunk/reactos/base/applications/network/finger/finger.c Added: trunk/reactos/base/applications/network/finger/finger.rbuild Added: trunk/reactos/base/applications/network/finger/finger.rc Added: trunk/reactos/base/applications/network/finger/getopt.c Added: trunk/reactos/base/applications/network/finger/getopt.h Added: trunk/reactos/base/applications/network/finger/net.c Added: trunk/reactos/base/applications/network/finger/various.h Added: trunk/reactos/base/applications/network/ftp/ Added: trunk/reactos/base/applications/network/ftp/cmds.c Added: trunk/reactos/base/applications/network/ftp/cmdtab.c Added: trunk/reactos/base/applications/network/ftp/domacro.c Added: trunk/reactos/base/applications/network/ftp/fake.c Added: trunk/reactos/base/applications/network/ftp/fake.h Added: trunk/reactos/base/applications/network/ftp/ftp.c Added: trunk/reactos/base/applications/network/ftp/ftp.mak Added: trunk/reactos/base/applications/network/ftp/ftp.mak.orig Added: trunk/reactos/base/applications/network/ftp/ftp.rbuild Added: trunk/reactos/base/applications/network/ftp/ftp.rc Added: trunk/reactos/base/applications/network/ftp/ftp_var.h Added: trunk/reactos/base/applications/network/ftp/main.c Added: trunk/reactos/base/applications/network/ftp/pathnames.h Added: trunk/reactos/base/applications/network/ftp/prototypes.h Added: trunk/reactos/base/applications/network/ftp/ruserpass.c Added: trunk/reactos/base/applications/network/ping/ Added: trunk/reactos/base/applications/network/ping/ping.c Added: trunk/reactos/base/applications/network/ping/ping.rbuild Added: trunk/reactos/base/applications/network/ping/ping.rc Added: trunk/reactos/base/applications/network/route/ Added: trunk/reactos/base/applications/network/route/route.c Added: trunk/reactos/base/applications/network/route/route.rbuild Added: trunk/reactos/base/applications/network/route/route.rc Added: trunk/reactos/base/applications/network/telnet/ Added: trunk/reactos/base/applications/network/telnet/Makefile.mingw Added: trunk/reactos/base/applications/network/telnet/doc/ Added: trunk/reactos/base/applications/network/telnet/doc/00readme.avs Added: trunk/reactos/base/applications/network/telnet/doc/bugs.txt Added: trunk/reactos/base/applications/network/telnet/doc/changes.txt Added: trunk/reactos/base/applications/network/telnet/doc/license.txt Added: trunk/reactos/base/applications/network/telnet/doc/options.txt Added: trunk/reactos/base/applications/network/telnet/doc/readme.txt Added: trunk/reactos/base/applications/network/telnet/doc/ssh.txt Added: trunk/reactos/base/applications/network/telnet/resource/ Added: trunk/reactos/base/applications/network/telnet/resource/tnmsg.h Added: trunk/reactos/base/applications/network/telnet/resource/tnmsg.rc Added: trunk/reactos/base/applications/network/telnet/src/ Added: trunk/reactos/base/applications/network/telnet/src/ansiprsr.cpp Added: trunk/reactos/base/applications/network/telnet/src/ansiprsr.h Added: trunk/reactos/base/applications/network/telnet/src/keytrans.cpp Added: trunk/reactos/base/applications/network/telnet/src/keytrans.h Added: trunk/reactos/base/applications/network/telnet/src/stl_bids.h Added: trunk/reactos/base/applications/network/telnet/src/tcharmap.cpp Added: trunk/reactos/base/applications/network/telnet/src/tcharmap.h Added: trunk/reactos/base/applications/network/telnet/src/tconsole.cpp Added: trunk/reactos/base/applications/network/telnet/src/tconsole.h Added: trunk/reactos/base/applications/network/telnet/src/telnet.h Added: trunk/reactos/base/applications/network/telnet/src/tkeydef.cpp Added: trunk/reactos/base/applications/network/telnet/src/tkeydef.h Added: trunk/reactos/base/applications/network/telnet/src/tkeymap.cpp Added: trunk/reactos/base/applications/network/telnet/src/tkeymap.h Added: trunk/reactos/base/applications/network/telnet/src/tmapldr.cpp Added: trunk/reactos/base/applications/network/telnet/src/tmapldr.h Added: trunk/reactos/base/applications/network/telnet/src/tmouse.cpp Added: trunk/reactos/base/applications/network/telnet/src/tmouse.h Added: trunk/reactos/base/applications/network/telnet/src/tnclass.cpp Added: trunk/reactos/base/applications/network/telnet/src/tnclass.h Added: trunk/reactos/base/applications/network/telnet/src/tnclip.cpp Added: trunk/reactos/base/applications/network/telnet/src/tnclip.h Added: trunk/reactos/base/applications/network/telnet/src/tncon.cpp Added: trunk/reactos/base/applications/network/telnet/src/tncon.h Added: trunk/reactos/base/applications/network/telnet/src/tnconfig.cpp Added: trunk/reactos/base/applications/network/telnet/src/tnconfig.h Added: trunk/reactos/base/applications/network/telnet/src/tnerror.cpp Added: trunk/reactos/base/applications/network/telnet/src/tnerror.h Added: trunk/reactos/base/applications/network/telnet/src/tnetwork.cpp Added: trunk/reactos/base/applications/network/telnet/src/tnetwork.h Added: trunk/reactos/base/applications/network/telnet/src/tnmain.cpp Added: trunk/reactos/base/applications/network/telnet/src/tnmain.h Added: trunk/reactos/base/applications/network/telnet/src/tnmisc.cpp Added: trunk/reactos/base/applications/network/telnet/src/tnmisc.h Added: trunk/reactos/base/applications/network/telnet/src/tnmsg.h Added: trunk/reactos/base/applications/network/telnet/src/tparams.h Added: trunk/reactos/base/applications/network/telnet/src/tparser.h Added: trunk/reactos/base/applications/network/telnet/src/tscript.cpp Added: trunk/reactos/base/applications/network/telnet/src/tscript.h Added: trunk/reactos/base/applications/network/telnet/src/tscroll.cpp Added: trunk/reactos/base/applications/network/telnet/src/tscroll.h Added: trunk/reactos/base/applications/network/telnet/src/ttelhndl.cpp Added: trunk/reactos/base/applications/network/telnet/src/ttelhndl.h Added: trunk/reactos/base/applications/network/telnet/telnet.cfg Added: trunk/reactos/base/applications/network/telnet/telnet.ico Added: trunk/reactos/base/applications/network/telnet/telnet.ini Added: trunk/reactos/base/applications/network/telnet/telnet.rbuild Added: trunk/reactos/base/applications/network/telnet/telnet.rc Added: trunk/reactos/base/applications/network/whois/ Added: trunk/reactos/base/applications/network/whois/LICENSE.txt Added: trunk/reactos/base/applications/network/whois/whois.c [truncated at 100 lines; 2 more skipped] _____
Added: trunk/reactos/base/applications/network/finger/LICENSE.txt --- trunk/reactos/base/applications/network/finger/LICENSE.txt 2006-02-04 12:21:58 UTC (rev 85) +++ trunk/reactos/base/applications/network/finger/LICENSE.txt 2006-02-04 12:39:36 UTC (rev 86) @@ -0,0 +1,23 @@
+July 22, 1999 + +To All Licensees, Distributors of Any Version of BSD: + +As you know, certain of the Berkeley Software Distribution ("BSD") source code files +require that further distributions of products containing all or portions of the +software, acknowledge within their advertising materials that such products contain +software developed by UC Berkeley and its contributors. + +Specifically, the provision reads: + + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + +Effective immediately, licensees and distributors are no longer required to include +the acknowledgement within advertising materials. Accordingly, the foregoing paragraph +of those BSD Unix files containing it is hereby deleted in its entirety. + +William Hoskins +Director, Office of Technology Licensing +University of California, Berkeley " _____
Added: trunk/reactos/base/applications/network/finger/err.c --- trunk/reactos/base/applications/network/finger/err.c 2006-02-04 12:21:58 UTC (rev 85) +++ trunk/reactos/base/applications/network/finger/err.c 2006-02-04 12:39:36 UTC (rev 86) @@ -0,0 +1,138 @@
+/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#include "err.h" +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif + +extern char *__progname; /* Program name, from crt0. */ + +void +err(int eval, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + verr(eval, fmt, ap); + va_end(ap); +} + +void +verr(int eval, const char *fmt, va_list ap) +{ + int sverrno; + + sverrno = errno; + (void)fprintf(stderr, "%s: ", __progname); + if (fmt != NULL) { + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, ": "); + } + (void)fprintf(stderr, "%s\n", strerror(sverrno)); + exit(eval); +} + +void +errx(int eval, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + verrx(eval, fmt, ap); + va_end(ap); +} + +void +verrx(int eval, const char *fmt, va_list ap) +{ + (void)fprintf(stderr, "%s: ", __progname); + if (fmt != NULL) + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, "\n"); + exit(eval); +} + +void +warn(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vwarn(fmt, ap); + va_end(ap); +} + +void +vwarn(fmt, ap) + const char *fmt; + va_list ap; +{ + int sverrno; + + sverrno = errno; + (void)fprintf(stderr, "%s: ", __progname); + if (fmt != NULL) { + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, ": "); + } + (void)fprintf(stderr, "%s\n", strerror(sverrno)); +} + +void +warnx(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vwarnx(fmt, ap); + va_end(ap); +} + +void +vwarnx(fmt, ap) + const char *fmt; + va_list ap; +{ + (void)fprintf(stderr, "%s: ", __progname); + if (fmt != NULL) + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, "\n"); +} _____
Added: trunk/reactos/base/applications/network/finger/err.h --- trunk/reactos/base/applications/network/finger/err.h 2006-02-04 12:21:58 UTC (rev 85) +++ trunk/reactos/base/applications/network/finger/err.h 2006-02-04 12:39:36 UTC (rev 86) @@ -0,0 +1,60 @@
+/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)err.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _ERR_H_ +#define _ERR_H_ + +/* + * Don't use va_list in the err/warn prototypes. Va_list is typedef'd in two + * places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one + * of them here we may collide with the utility's includes. It's unreasonable + * for utilities to have to include one of them to include err.h, so we get + * _BSD_VA_LIST_ from <machine/ansi.h> and use it. + */ +/*#include <machine/ansi.h>*/ +/*#include <sys/cdefs.h>*/ +#include "various.h" +#include <stdarg.h> + +void err __P((int, const char *, ...)); +void verr __P((int, const char *, va_list)); +void errx __P((int, const char *, ...)); +void verrx __P((int, const char *, va_list)); +void warn __P((const char *, ...)); +void vwarn __P((const char *, va_list)); +void warnx __P((const char *, ...)); +void vwarnx __P((const char *, va_list)); + +#endif /* !_ERR_H_ */ _____
Added: trunk/reactos/base/applications/network/finger/finger.c --- trunk/reactos/base/applications/network/finger/finger.c 2006-02-04 12:21:58 UTC (rev 85) +++ trunk/reactos/base/applications/network/finger/finger.c 2006-02-04 12:39:36 UTC (rev 86) @@ -0,0 +1,178 @@
+/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Tony Nardo of the Johns Hopkins University/Applied Physics Lab. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * 8/2/97 - Ted Felix tfelix@fred.net + * Ported to Win32 from 4.4BSD-LITE2 at wcarchive. + * NT Workstation already has finger, and it runs fine under + * Win95. Thought I'd do this anyways since not everyone has + * access to NT. + * Had to remove local handling. Otherwise, same as whois. + */ + +/* + * Finger prints out information about users. It is not portable since + * certain fields (e.g. the full user name, office, and phone numbers) are + * extracted from the gecos field of the passwd file which other UNIXes + * may not have or may use for other things. + * + * There are currently two output formats; the short format is one line + * per user and displays login name, tty, login time, real name, idle time, + * and office location/phone number. The long format gives the same + * information (in a more legible format) as well as home directory, shell, + * mail info, and .plan/.project files. + */ + +#include <winsock2.h> +#include "err.h" +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#include "various.h" +#include "getopt.h" + +char *__progname; + +time_t now; +int lflag, mflag, pplan, sflag; + +static void userlist(int, char **); +void usage(); + +int +main(int argc, char **argv) +{ + int ch; + + while ((ch = getopt(argc, argv, "lmps")) != EOF) + switch(ch) { + case 'l': + lflag = 1; /* long format */ + break; + case 'm': + mflag = 1; /* force exact match of names */ + break; + case 'p': + pplan = 1; /* don't show .plan/.project */ + break; + case 's': + sflag = 1; /* short format */ + break; + case '?': + default: + (void)fprintf(stderr, + "usage: finger [-lmps] login [...]\n"); + exit(1); + } + argc -= optind; + argv += optind; + + (void)time(&now); + if (!*argv) { + usage(); + } else { + userlist(argc, argv); + /* + * Assign explicit "large" format if names given and -s not + * explicitly stated. Force the -l AFTER we get names so any + * remote finger attempts specified won't be mishandled. + */ + if (!sflag) + lflag = 1; /* if -s not explicit, force -l */ + } + return 0; +} + + +static void +userlist(int argc, char **argv) +{ + int *used; + char **ap, **nargv, **np, **p; + WORD wVersionRequested; + WSADATA wsaData; + int iErr; + + + if ((nargv = malloc((argc+1) * sizeof(char *))) == NULL || + (used = calloc(argc, sizeof(int))) == NULL) + err(1, NULL); + + /* Pull out all network requests into nargv. */ + for (ap = p = argv, np = nargv; *p; ++p) + if (index(*p, '@')) + *np++ = *p; + else + *ap++ = *p; + + *np++ = NULL; + *ap++ = NULL; + + /* If there are local requests */ + if (*argv) + { + fprintf(stderr, "Warning: Can't do local finger\n"); + } + + /* Start winsock */ + wVersionRequested = MAKEWORD( 1, 1 ); + iErr = WSAStartup( wVersionRequested, &wsaData ); + if ( iErr != 0 ) + { + /* Tell the user that we couldn't find a usable */ + /* WinSock DLL. */ + fprintf(stderr, "WSAStartup failed\n"); + return; + } + + /* Handle network requests. */ + for (p = nargv; *p;) + netfinger(*p++); + + /* Bring down winsock */ + WSACleanup(); + exit(0); +} + +void usage() +{ + (void)fprintf(stderr, + "usage: finger [-lmps] login [...]\n"); + exit(1); +} + _____
Added: trunk/reactos/base/applications/network/finger/finger.rbuild --- trunk/reactos/base/applications/network/finger/finger.rbuild 2006-02-04 12:21:58 UTC (rev 85) +++ trunk/reactos/base/applications/network/finger/finger.rbuild 2006-02-04 12:39:36 UTC (rev 86) @@ -0,0 +1,16 @@
+<?xml version="1.0"?> +<rbuild xmlns:xi="http://www.w3.org/2001/XInclude"> + <module name="finger" type="win32cui" installbase="system32" installname="finger.exe"> + <include base="finger">.</include> + <define name="__USE_W32API" /> + <define name="__USE_W32_SOCKETS" /> + <library>kernel32</library> + <library>ws2_32</library> + <file>finger.c</file> + <file>err.c</file> + <file>getopt.c</file> + <file>net.c</file> + <file>finger.rc</file> + </module> + </module> +</rbuild> _____
Added: trunk/reactos/base/applications/network/finger/finger.rc --- trunk/reactos/base/applications/network/finger/finger.rc 2006-02-04 12:21:58 UTC (rev 85) +++ trunk/reactos/base/applications/network/finger/finger.rc 2006-02-04 12:39:36 UTC (rev 86) @@ -0,0 +1,6 @@
+/* $Id: finger.rc 12852 2005-01-06 13:58:04Z mf $ */ + +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 finger\0" +#define REACTOS_STR_INTERNAL_NAME "finger\0" +#define REACTOS_STR_ORIGINAL_FILENAME "finger.exe\0" +#include <reactos/version.rc> _____
Added: trunk/reactos/base/applications/network/finger/getopt.c --- trunk/reactos/base/applications/network/finger/getopt.c 2006-02-04 12:21:58 UTC (rev 85) +++ trunk/reactos/base/applications/network/finger/getopt.c 2006-02-04 12:39:36 UTC (rev 86) @@ -0,0 +1,122 @@
+/* + * Copyright (c) 1987 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Fri Jun 13 10:39:00 1997, tfelix@fred.net: + * Ported to Win32, changed index/rindex to strchr/strrchr + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getopt.c 4.13 (Berkeley) 2/23/91"; +#endif /* LIBC_SCCS and not lint */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "getopt.h" + +/* + * get option letter from argument vector + */ +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt; /* character checked for validity */ +const char *optarg; /* argument associated with option */ + +#define BADCH (int)'?' +#define EMSG "" + +int +getopt(int nargc, char * const *nargv, const char *ostr) +{ + static const char *place = EMSG; /* option letter processing */ + register char *oli; /* option letter list index */ + char *p; + + if (!*place) { /* update scanning pointer */ + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return(EOF); + } + if (place[1] && *++place == '-') { /* found "--" */ + ++optind; + place = EMSG; + return(EOF); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || + !(oli = strchr(ostr, optopt))) { + /* + * if the user didn't specify '-' as an option, + * assume it means EOF. + */ + if (optopt == (int)'-') + return(EOF); + if (!*place) + ++optind; + if (opterr) { + if (!(p = strrchr(*nargv, '/'))) + p = *nargv; + else + ++p; + (void)fprintf(stderr, "%s: illegal option -- %c\n", + p, optopt); + } + return(BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if (!(p = strrchr(*nargv, '/'))) + p = *nargv; + else + ++p; + if (opterr) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + p, optopt); + return(BADCH); + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return(optopt); /* dump back option letter */ +} _____
Added: trunk/reactos/base/applications/network/finger/getopt.h --- trunk/reactos/base/applications/network/finger/getopt.h 2006-02-04 12:21:58 UTC (rev 85) +++ trunk/reactos/base/applications/network/finger/getopt.h 2006-02-04 12:39:36 UTC (rev 86) @@ -0,0 +1,7 @@
+/* getopt.h */ + +extern const char *optarg; +extern int optind; + +int +getopt(int nargc, char * const *nargv, const char *ostr); _____
Added: trunk/reactos/base/applications/network/finger/net.c --- trunk/reactos/base/applications/network/finger/net.c 2006-02-04 12:21:58 UTC (rev 85) +++ trunk/reactos/base/applications/network/finger/net.c 2006-02-04 12:39:36 UTC (rev 86) @@ -0,0 +1,139 @@
+/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Tony Nardo of the Johns Hopkins University/Applied Physics Lab. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include <sys/types.h> +#include <winsock2.h> + +#include <stdio.h> +#include <ctype.h> +#include <string.h> + +#include "various.h" + +int close(int); + +void +netfinger(char *name) +{ + extern int lflag; + char c, lastc; + struct in_addr defaddr; + struct hostent *hp, def; + struct servent *sp; + struct sockaddr_in sin; + SOCKET s; + char *alist[1], *host; + + /* If this is a local request */ + if (!(host = rindex(name, '@'))) + return; + + *host++ = '\0'; + if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != (unsigned long)-1) { + def.h_name = host; + def.h_addr_list = alist; + def.h_addr = (char *)&defaddr; + def.h_length = sizeof(struct in_addr); + def.h_addrtype = AF_INET; + def.h_aliases = 0; + hp = &def; + } else if (!(hp = gethostbyname(host))) { + (void)fprintf(stderr, + "finger: unknown host: %s\n", host); + return; + } + if (!(sp = getservbyname("finger", "tcp"))) { + (void)fprintf(stderr, "finger: tcp/finger: unknown service\n"); + return; + } + sin.sin_family = hp->h_addrtype; + bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length); + sin.sin_port = sp->s_port; + if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) == INVALID_SOCKET) { + perror("finger: socket"); + return; + } + + /* have network connection; identify the host connected with */ + (void)printf("[%s]\n", hp->h_name); + if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { + fprintf(stderr, "finger: connect rc = %d", WSAGetLastError()); + (void)close(s); + return; + } + + /* -l flag for remote fingerd */ + if (lflag) + send(s, "/W ", 3, 0); + /* send the name followed by <CR><LF> */ + send(s, name, strlen(name), 0); + send(s, "\r\n", 2, 0); + + /* + * Read from the remote system; once we're connected, we assume some + * data. If none arrives, we hang until the user interrupts. + * + * If we see a <CR> or a <CR> with the high bit set, treat it as + * a newline; if followed by a newline character, only output one + * newline. + * + * Otherwise, all high bits are stripped; if it isn't printable and + * it isn't a space, we can simply set the 7th bit. Every ASCII + * character with bit 7 set is printable. + */ + lastc = 0; + while (recv(s, &c, 1, 0) == 1) { + c &= 0x7f; + if (c == 0x0d) { + if (lastc == '\r') /* ^M^M - skip dupes */ + continue; + c = '\n'; + lastc = '\r'; + } else { + if (!isprint(c) && !isspace(c)) + c |= 0x40; + if (lastc != '\r' || c != '\n') + lastc = c; + else { + lastc = '\n'; + continue; + } + } + putchar(c); + } + if (lastc != '\n') + putchar('\n'); + putchar('\n'); +} _____
Added: trunk/reactos/base/applications/network/finger/various.h --- trunk/reactos/base/applications/network/finger/various.h 2006-02-04 12:21:58 UTC (rev 85) +++ trunk/reactos/base/applications/network/finger/various.h 2006-02-04 12:39:36 UTC (rev 86) @@ -0,0 +1,36 @@
+// Various things you need when porting BSD and GNU utilities to +// Win32. + +#ifndef VARIOUS_H +#define VARIOUS_H + + +typedef float f4byte_t; +typedef double f8byte_t; +typedef long uid_t; // SunOS 5.5 + +#define __P(x) x + +/* utmp.h */ +#define UT_LINESIZE 8 +#define UT_HOSTSIZE 16 + +/* stat.h */ +#define S_ISREG(mode) (((mode)&0xF000) == 0x8000) +#define S_ISDIR(mode) (((mode)&0xF000) == 0x4000) + +#undef MIN //take care of windows default +#undef MAX //take care of windows default +#define MIN(a, b) ((a) <= (b) ? (a) : (b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + +#define bcopy(s1, s2, n) memmove(s2, s1, n) +#define bcmp(s1, s2, n) (memcmp(s1, s2, n) != 0) +#define bzero(s, n) memset(s, 0, n) + +#define index(s, c) strchr(s, c) +#define rindex(s, c) strrchr(s, c) + +void netfinger(char *); + +#endif _____
Added: trunk/reactos/base/applications/network/ftp/cmds.c --- trunk/reactos/base/applications/network/ftp/cmds.c 2006-02-04 12:21:58 UTC (rev 85) +++ trunk/reactos/base/applications/network/ftp/cmds.c 2006-02-04 12:39:36 UTC (rev 86) @@ -0,0 +1,2373 @@
+/* + * Copyright (c) 1985, 1989 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef lint +static char sccsid[] = "@(#)cmds.c 5.18 (Berkeley) 4/20/89"; +#endif /* not lint */ + +/* + * FTP User Program -- Command Routines. + */ +//#include <sys/param.h> +//#include <sys/wait.h> +#include <sys/stat.h> +#ifndef _WIN32 +#include <sys/socket.h> +#include <arpa/ftp.h> +#include <netinet/in.h> +#include <netdb.h> +#else +#include <winsock.h> +#endif + +#include <signal.h> +#include <direct.h> +#include <stdio.h> +#include <errno.h> +#include <ctype.h> +#include <time.h> + +#include "ftp_var.h" +#include "pathnames.h" +#include "prototypes.h" + +extern char *globerr; +extern char home[]; +extern char *remglob(); +extern char *getenv(); +extern int allbinary; +extern off_t restart_point; +extern char reply_string[]; + +const char *mname; +jmp_buf jabort; +const char *dotrans(), *domap(); + +extern short portnum; +extern char *hostname; +extern int autologin; +/* + * Connect to peer server and + * auto-login, if possible. + */ +void setpeer(int argc, const char *argv[]) +{ + char *host; + + if (connected) { + printf("Already connected to %s, use close first.\n", + hostname); + (void) fflush(stdout); + code = -1; + return; + } + if (argc < 2) { + (void) strcat(line, " "); + printf("(to) "); + (void) fflush(stdout); + (void) gets(&line[strlen(line)]); + makeargv(); + argc = margc; + argv = margv; + } + if (argc > 3) { + printf("usage: %s host-name [port]\n", argv[0]); + (void) fflush(stdout); + code = -1; + return; + } + if (argc > 2) { + portnum = atoi(argv[2]); + if (portnum <= 0) { + printf("%s: bad port number-- %s\n", argv[1], argv[2]); + printf ("usage: %s host-name [port]\n", argv[0]); + (void) fflush(stdout); + code = -1; + return; + } + portnum = htons(portnum); + } + host = hookup(argv[1], portnum); + if (host) { +#if defined(unix) && NBBY == 8 + int overbose; +#endif + connected = 1; + if (autologin) + (void) login(argv[1]); + +#if defined(unix) && NBBY == 8 +/* + * this ifdef is to keep someone form "porting" this to an incompatible + * system and not checking this out. This way they have to think about it. + */ + overbose = verbose; + if (debug == 0) + verbose = -1; + allbinary = 0; + if (command("SYST") == COMPLETE && overbose) { + register char *cp, c; + cp = index(reply_string+4, ' '); + if (cp == NULL) + cp = index(reply_string+4, '\r'); + if (cp) { + if (cp[-1] == '.') + cp--; + c = *cp; + *cp = '\0'; + } + + printf("Remote system type is %s.\n", + reply_string+4); + if (cp) + *cp = c; + } + if (!strncmp(reply_string, "215 UNIX Type: L8", 17)) { + setbinary(); + /* allbinary = 1; this violates the RFC */ + if (overbose) + printf("Using %s mode to transfer files.\n", + typename); + } else if (overbose && + !strncmp(reply_string, "215 TOPS20", 10)) { + printf( +"Remember to set tenex mode when transfering binary files from this machine.\n"); + } + verbose = overbose; +#endif /* unix */ + } + (void) fflush(stdout); +} + +struct types { + const char *t_name; + const char *t_mode; + int t_type; + char *t_arg; +} types[] = { + { "ascii", "A", TYPE_A, 0 }, + { "binary", "I", TYPE_I, 0 }, + { "image", "I", TYPE_I, 0 }, + { "ebcdic", "E", TYPE_E, 0 }, + { "tenex", "L", TYPE_L, bytename }, + {0 } +}; + +/* + * Set transfer type. + */ +void settype(argc, argv) + const char *argv[]; +{ + register struct types *p; + int comret; + + if (argc > 2) { + const char *sep; + + printf("usage: %s [", argv[0]); + sep = " "; + for (p = types; p->t_name; p++) { + printf("%s%s", sep, p->t_name); + if (*sep == ' ') + sep = " | "; + } + printf(" ]\n"); + (void) fflush(stdout); + code = -1; + return; + } + if (argc < 2) { + printf("Using %s mode to transfer files.\n", typename); + (void) fflush(stdout); + code = 0; + return; + } + for (p = types; p->t_name; p++) + if (strcmp(argv[1], p->t_name) == 0) + break; + if (p->t_name == 0) { + printf("%s: unknown mode\n", argv[1]); + (void) fflush(stdout); + code = -1; + return; + } + if ((p->t_arg != NULL) && (*(p->t_arg) != '\0')) + comret = command ("TYPE %s %s", p->t_mode, p->t_arg); + else + comret = command("TYPE %s", p->t_mode); + if (comret == COMPLETE) { + (void) strcpy(typename, p->t_name); + type = p->t_type; + } +} + +const char *stype[] = { + "type", [truncated at 1000 lines; 22260 more skipped]