source: trunk/kitgen/starfish-noyp.patch@ 199

Last change on this file since 199 was 175, checked in by demin, 12 years ago

initial commit

File size: 5.1 KB
RevLine 
[175]1diff -pruN starfish/starfishCmd.c starfish-patched/starfishCmd.c
2--- starfish/starfishCmd.c 2003-03-11 01:47:59.000000000 +0100
3+++ starfish-patched/starfishCmd.c 2007-10-19 01:55:36.880301248 +0200
4@@ -53,27 +53,12 @@
5
6 #include "starfishInt.h"
7
8-#if defined(sun) && defined (__SVR4)
9-#include <rpc/rpcent.h>
10-#else
11-#include <rpc/rpc.h>
12-#endif
13-
14-#if defined(__OpenBSD__)
15-#include <rpcsvc/ypclnt.h>
16-#endif
17-
18-#include <rpcsvc/yp_prot.h>
19-
20 #include <sys/ioctl.h>
21 #include <netinet/in.h>
22 #include <net/if.h>
23
24 #define KEEPALIVE 1
25
26-#define YP_SUCC 0
27-#define YP_FAIL 1
28-
29 #define SYS_ERROR -1
30
31 #define BUFLEN 256
32@@ -115,33 +100,6 @@ static int Starfish_NetdbMap
33 char *cmd, char *subcmd));
34
35 /************************************************************************/
36-/* Support functions. */
37-/************************************************************************/
38-
39-static int Callback(int status, char *key, int keylen, char *val, int vallen,
40- char *data)
41- {
42- Tcl_Interp *interp = (Tcl_Interp *) data;
43-
44- switch (status)
45- {
46- case YP_TRUE:
47- key[keylen] = 0;
48- val[vallen] = 0;
49- Tcl_AppendResult(interp, "{", key, " ", val, "}", (char *) NULL);
50- return YP_SUCC;
51- break;
52- case YP_NOMORE:
53- break;
54- default:
55- Tcl_AppendResult(interp, "cannot lookup NIS map", (char *) NULL);
56- break;
57- }
58-
59- return YP_FAIL;
60- }
61-
62-/************************************************************************/
63 /* Subcommand functions. */
64 /************************************************************************/
65
66@@ -860,91 +818,6 @@ Starfish_NetdbIp(Tcl_Interp *interp, int
67 return TCL_ERROR;
68 }
69
70-/*
71- *----------------------------------------------------------------------
72- *
73- * Starfish_NetdbMap --
74- *
75- * This procedure is invoked to process the default case of the
76- * "netdb" command.
77- * See the user documentation for details on what it does.
78- *
79- * Results:
80- * A standard Tcl result.
81- *
82- * Side effects:
83- * See the user documentation.
84- *
85- *----------------------------------------------------------------------
86- */
87-
88-static int
89-Starfish_NetdbMap(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[],
90- char *cmd, char *subcmd)
91-{
92- struct ypall_callback obj;
93- char *self, *domain, *map, *key, *val;
94- int result, keylen, vallen;
95-
96- /*
97- * Process the default "netdb" command option:
98- */
99-
100- result = yp_get_default_domain(&domain);
101-
102- if (result != YP_SUCC) {
103- Tcl_AppendResult(interp, "NIS domain not set", (char *) NULL);
104- return TCL_ERROR;
105- }
106-
107- switch (objc)
108- {
109- case 2:
110- map = Tcl_GetString(objv[1]);
111-
112- obj.foreach = Callback;
113- obj.data = (char *) interp;
114-
115- result = yp_all(domain, map, &obj);
116-
117- if (result != YP_SUCC)
118- {
119- Tcl_AppendResult(interp,
120- "cannot lookup NIS map \"", map, "\"",
121- (char *) NULL);
122- return TCL_ERROR;
123- }
124-
125- return TCL_OK;
126- break;
127-
128- case 3:
129- map = Tcl_GetString(objv[1]);
130- key = Tcl_GetString(objv[2]);
131-
132- result = yp_match(domain, map, key, strlen(key), &val, &vallen);
133-
134- if (result != YP_SUCC)
135- {
136- Tcl_AppendResult(interp,
137- "cannot match NIS map \"", map, "\"",
138- (char *) NULL);
139- return TCL_ERROR;
140- }
141-
142- val[vallen] = 0;
143- Tcl_AppendResult(interp, val, (char *) NULL);
144- return TCL_OK;
145- break;
146-
147- default:
148- Tcl_AppendResult(interp, "wrong # args: should be \"",
149- cmd, " map ?key?\"", (char *) NULL);
150- return TCL_ERROR;
151- break;
152- }
153-}
154-
155 /************************************************************************/
156 /* Entry points. */
157 /************************************************************************/
158@@ -995,7 +868,9 @@ Starfish_NetdbCmd(ClientData clientData,
159 } else if (strcmp(subcmd, "ip") == 0) {
160 result = Starfish_NetdbIp(interp, objc, objv, cmd, subcmd);
161 } else {
162- result = Starfish_NetdbMap(interp, objc, objv, cmd, subcmd);
163+ Tcl_AppendResult(interp, "wrong # args: should be \"",
164+ cmd, " map ?key?\"", (char *) NULL);
165+ result = TCL_ERROR;
166 }
167
168 #ifdef TCL_THREADS
169diff -pruN starfish/starfishInit.c starfish-patched/starfishInit.c
170--- starfish/starfishInit.c 2003-03-11 01:48:05.000000000 +0100
171+++ starfish-patched/starfishInit.c 2007-10-19 01:55:36.880301248 +0200
172@@ -86,14 +86,10 @@ Starfish_Init(Tcl_Interp *interp)
173 }
174 #endif
175
176-#ifdef STARFISH_FORCE_PACKAGE
177- /* Ordinarily we are loaded as part of an enclosing package definition.
178- */
179 result = Tcl_PkgProvide(interp, STARFISH_PACKAGE, STARFISH_VERSION);
180 if (result != TCL_OK) {
181 return result;
182 }
183-#endif
184
185 Starfish_Limit();
186 Starfish_InitSafeCmds(interp);
187@@ -115,14 +111,10 @@ Starfish_SafeInit(Tcl_Interp *interp)
188 {
189 int result;
190
191-#ifdef STARFISH_FORCE_PACKAGE
192- /* Ordinarily we are loaded as part of an enclosing package definition.
193- */
194 result = Tcl_PkgProvide(interp, STARFISH_PACKAGE, STARFISH_VERSION);
195 if (result != TCL_OK) {
196 return result;
197 }
198-#endif
199
200 Starfish_Limit();
201 Starfish_InitSafeCmds(interp);
Note: See TracBrowser for help on using the repository browser.