3 Copyright 2004 by the Massachusetts Institute of Technology
7 Permission to use, copy, modify, and distribute this software and its
8 documentation for any purpose and without fee is hereby granted,
9 provided that the above copyright notice appear in all copies and that
10 both that copyright notice and this permission notice appear in
11 supporting documentation, and that the name of the Massachusetts
12 Institute of Technology (M.I.T.) not be used in advertising or publicity
13 pertaining to distribution of the software without specific, written
16 M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
17 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
18 M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
19 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
33 #include "loopbackutils.h"
35 #undef REDIRECT_STDOUT
40 printf("instloop [-i [name [ip mask]] | -u]\n\n");
41 printf(" -i install the %s\n", DRIVER_DESC);
42 _tprintf(_T(" (if unspecified, uses name %s,\n"), DEFAULT_NAME);
43 _tprintf(_T(" ip %s, and mask %s)\n"), DEFAULT_IP, DEFAULT_MASK);
44 printf(" -u uninstall the %s\n", DRIVER_DESC);
48 DisplayStartup(BOOL bInstall)
50 printf("%snstalling the %s\n"
51 " (Note: This may take up to a minute or two...)\n",
52 bInstall ? "I" : "Un",
58 DisplayResult(BOOL bInstall, DWORD rc)
62 printf("Could not %sinstall the %s\n", bInstall ? "" : "un",
70 int _tmain(int argc, TCHAR *argv[])
73 #ifdef REDIRECT_STDOUT
79 #ifdef REDIRECT_STDOUT
80 fh = freopen("instlog.txt","a+", stdout);
85 if (_tcsicmp(argv[1], _T("-i")) == 0)
87 TCHAR* name = DEFAULT_NAME;
88 TCHAR* ip = DEFAULT_IP;
89 TCHAR* mask = DEFAULT_MASK;
99 #ifdef REDIRECT_STDOUT
100 fflush(fh); fclose(fh);
111 DisplayStartup(TRUE);
112 if(IsLoopbackInstalled()) {
113 printf("Loopback already installed\n");
114 rc = 0; /* don't signal an error. */
116 rc = InstallLoopBack(name, ip, mask);
118 DisplayResult(TRUE, rc);
119 #ifdef REDIRECT_STDOUT
120 fflush(fh); fclose(fh);
124 else if (_tcsicmp(argv[1], _T("-u")) == 0)
126 DisplayStartup(FALSE);
127 rc = UnInstallLoopBack();
128 DisplayResult(FALSE, rc);
129 #ifdef REDIRECT_STDOUT
130 fflush(fh); fclose(fh);
135 #ifdef REDIRECT_STDOUT
136 fflush(fh); fclose(fh);
141 #ifdef REDIRECT_STDOUT
142 fflush(fh); fclose(fh);