diff -pruN starfish/starfishCmd.c starfish-patched/starfishCmd.c --- starfish/starfishCmd.c 2003-03-11 01:47:59.000000000 +0100 +++ starfish-patched/starfishCmd.c 2007-10-19 01:55:36.880301248 +0200 @@ -53,27 +53,12 @@ #include "starfishInt.h" -#if defined(sun) && defined (__SVR4) -#include -#else -#include -#endif - -#if defined(__OpenBSD__) -#include -#endif - -#include - #include #include #include #define KEEPALIVE 1 -#define YP_SUCC 0 -#define YP_FAIL 1 - #define SYS_ERROR -1 #define BUFLEN 256 @@ -115,33 +100,6 @@ static int Starfish_NetdbMap char *cmd, char *subcmd)); /************************************************************************/ -/* Support functions. */ -/************************************************************************/ - -static int Callback(int status, char *key, int keylen, char *val, int vallen, - char *data) - { - Tcl_Interp *interp = (Tcl_Interp *) data; - - switch (status) - { - case YP_TRUE: - key[keylen] = 0; - val[vallen] = 0; - Tcl_AppendResult(interp, "{", key, " ", val, "}", (char *) NULL); - return YP_SUCC; - break; - case YP_NOMORE: - break; - default: - Tcl_AppendResult(interp, "cannot lookup NIS map", (char *) NULL); - break; - } - - return YP_FAIL; - } - -/************************************************************************/ /* Subcommand functions. */ /************************************************************************/ @@ -860,91 +818,6 @@ Starfish_NetdbIp(Tcl_Interp *interp, int return TCL_ERROR; } -/* - *---------------------------------------------------------------------- - * - * Starfish_NetdbMap -- - * - * This procedure is invoked to process the default case of the - * "netdb" command. - * See the user documentation for details on what it does. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * See the user documentation. - * - *---------------------------------------------------------------------- - */ - -static int -Starfish_NetdbMap(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], - char *cmd, char *subcmd) -{ - struct ypall_callback obj; - char *self, *domain, *map, *key, *val; - int result, keylen, vallen; - - /* - * Process the default "netdb" command option: - */ - - result = yp_get_default_domain(&domain); - - if (result != YP_SUCC) { - Tcl_AppendResult(interp, "NIS domain not set", (char *) NULL); - return TCL_ERROR; - } - - switch (objc) - { - case 2: - map = Tcl_GetString(objv[1]); - - obj.foreach = Callback; - obj.data = (char *) interp; - - result = yp_all(domain, map, &obj); - - if (result != YP_SUCC) - { - Tcl_AppendResult(interp, - "cannot lookup NIS map \"", map, "\"", - (char *) NULL); - return TCL_ERROR; - } - - return TCL_OK; - break; - - case 3: - map = Tcl_GetString(objv[1]); - key = Tcl_GetString(objv[2]); - - result = yp_match(domain, map, key, strlen(key), &val, &vallen); - - if (result != YP_SUCC) - { - Tcl_AppendResult(interp, - "cannot match NIS map \"", map, "\"", - (char *) NULL); - return TCL_ERROR; - } - - val[vallen] = 0; - Tcl_AppendResult(interp, val, (char *) NULL); - return TCL_OK; - break; - - default: - Tcl_AppendResult(interp, "wrong # args: should be \"", - cmd, " map ?key?\"", (char *) NULL); - return TCL_ERROR; - break; - } -} - /************************************************************************/ /* Entry points. */ /************************************************************************/ @@ -995,7 +868,9 @@ Starfish_NetdbCmd(ClientData clientData, } else if (strcmp(subcmd, "ip") == 0) { result = Starfish_NetdbIp(interp, objc, objv, cmd, subcmd); } else { - result = Starfish_NetdbMap(interp, objc, objv, cmd, subcmd); + Tcl_AppendResult(interp, "wrong # args: should be \"", + cmd, " map ?key?\"", (char *) NULL); + result = TCL_ERROR; } #ifdef TCL_THREADS diff -pruN starfish/starfishInit.c starfish-patched/starfishInit.c --- starfish/starfishInit.c 2003-03-11 01:48:05.000000000 +0100 +++ starfish-patched/starfishInit.c 2007-10-19 01:55:36.880301248 +0200 @@ -86,14 +86,10 @@ Starfish_Init(Tcl_Interp *interp) } #endif -#ifdef STARFISH_FORCE_PACKAGE - /* Ordinarily we are loaded as part of an enclosing package definition. - */ result = Tcl_PkgProvide(interp, STARFISH_PACKAGE, STARFISH_VERSION); if (result != TCL_OK) { return result; } -#endif Starfish_Limit(); Starfish_InitSafeCmds(interp); @@ -115,14 +111,10 @@ Starfish_SafeInit(Tcl_Interp *interp) { int result; -#ifdef STARFISH_FORCE_PACKAGE - /* Ordinarily we are loaded as part of an enclosing package definition. - */ result = Tcl_PkgProvide(interp, STARFISH_PACKAGE, STARFISH_VERSION); if (result != TCL_OK) { return result; } -#endif Starfish_Limit(); Starfish_InitSafeCmds(interp);