source:
trunk/kitgen/starfish-noyp.patch@
187
Last change on this file since 187 was 175, checked in by , 12 years ago | |
---|---|
File size: 5.1 KB |
-
starfishCmd.c
diff -pruN starfish/starfishCmd.c starfish-patched/starfishCmd.c
old new 53 53 54 54 #include "starfishInt.h" 55 55 56 #if defined(sun) && defined (__SVR4)57 #include <rpc/rpcent.h>58 #else59 #include <rpc/rpc.h>60 #endif61 62 #if defined(__OpenBSD__)63 #include <rpcsvc/ypclnt.h>64 #endif65 66 #include <rpcsvc/yp_prot.h>67 68 56 #include <sys/ioctl.h> 69 57 #include <netinet/in.h> 70 58 #include <net/if.h> 71 59 72 60 #define KEEPALIVE 1 73 61 74 #define YP_SUCC 075 #define YP_FAIL 176 77 62 #define SYS_ERROR -1 78 63 79 64 #define BUFLEN 256 … … static int Starfish_NetdbMap 115 100 char *cmd, char *subcmd)); 116 101 117 102 /************************************************************************/ 118 /* Support functions. */119 /************************************************************************/120 121 static int Callback(int status, char *key, int keylen, char *val, int vallen,122 char *data)123 {124 Tcl_Interp *interp = (Tcl_Interp *) data;125 126 switch (status)127 {128 case YP_TRUE:129 key[keylen] = 0;130 val[vallen] = 0;131 Tcl_AppendResult(interp, "{", key, " ", val, "}", (char *) NULL);132 return YP_SUCC;133 break;134 case YP_NOMORE:135 break;136 default:137 Tcl_AppendResult(interp, "cannot lookup NIS map", (char *) NULL);138 break;139 }140 141 return YP_FAIL;142 }143 144 /************************************************************************/145 103 /* Subcommand functions. */ 146 104 /************************************************************************/ 147 105 … … Starfish_NetdbIp(Tcl_Interp *interp, int 860 818 return TCL_ERROR; 861 819 } 862 820 863 /*864 *----------------------------------------------------------------------865 *866 * Starfish_NetdbMap --867 *868 * This procedure is invoked to process the default case of the869 * "netdb" command.870 * See the user documentation for details on what it does.871 *872 * Results:873 * A standard Tcl result.874 *875 * Side effects:876 * See the user documentation.877 *878 *----------------------------------------------------------------------879 */880 881 static int882 Starfish_NetdbMap(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[],883 char *cmd, char *subcmd)884 {885 struct ypall_callback obj;886 char *self, *domain, *map, *key, *val;887 int result, keylen, vallen;888 889 /*890 * Process the default "netdb" command option:891 */892 893 result = yp_get_default_domain(&domain);894 895 if (result != YP_SUCC) {896 Tcl_AppendResult(interp, "NIS domain not set", (char *) NULL);897 return TCL_ERROR;898 }899 900 switch (objc)901 {902 case 2:903 map = Tcl_GetString(objv[1]);904 905 obj.foreach = Callback;906 obj.data = (char *) interp;907 908 result = yp_all(domain, map, &obj);909 910 if (result != YP_SUCC)911 {912 Tcl_AppendResult(interp,913 "cannot lookup NIS map \"", map, "\"",914 (char *) NULL);915 return TCL_ERROR;916 }917 918 return TCL_OK;919 break;920 921 case 3:922 map = Tcl_GetString(objv[1]);923 key = Tcl_GetString(objv[2]);924 925 result = yp_match(domain, map, key, strlen(key), &val, &vallen);926 927 if (result != YP_SUCC)928 {929 Tcl_AppendResult(interp,930 "cannot match NIS map \"", map, "\"",931 (char *) NULL);932 return TCL_ERROR;933 }934 935 val[vallen] = 0;936 Tcl_AppendResult(interp, val, (char *) NULL);937 return TCL_OK;938 break;939 940 default:941 Tcl_AppendResult(interp, "wrong # args: should be \"",942 cmd, " map ?key?\"", (char *) NULL);943 return TCL_ERROR;944 break;945 }946 }947 948 821 /************************************************************************/ 949 822 /* Entry points. */ 950 823 /************************************************************************/ … … Starfish_NetdbCmd(ClientData clientData, 995 868 } else if (strcmp(subcmd, "ip") == 0) { 996 869 result = Starfish_NetdbIp(interp, objc, objv, cmd, subcmd); 997 870 } else { 998 result = Starfish_NetdbMap(interp, objc, objv, cmd, subcmd); 871 Tcl_AppendResult(interp, "wrong # args: should be \"", 872 cmd, " map ?key?\"", (char *) NULL); 873 result = TCL_ERROR; 999 874 } 1000 875 1001 876 #ifdef TCL_THREADS -
starfishInit.c
diff -pruN starfish/starfishInit.c starfish-patched/starfishInit.c
old new Starfish_Init(Tcl_Interp *interp) 86 86 } 87 87 #endif 88 88 89 #ifdef STARFISH_FORCE_PACKAGE90 /* Ordinarily we are loaded as part of an enclosing package definition.91 */92 89 result = Tcl_PkgProvide(interp, STARFISH_PACKAGE, STARFISH_VERSION); 93 90 if (result != TCL_OK) { 94 91 return result; 95 92 } 96 #endif97 93 98 94 Starfish_Limit(); 99 95 Starfish_InitSafeCmds(interp); … … Starfish_SafeInit(Tcl_Interp *interp) 115 111 { 116 112 int result; 117 113 118 #ifdef STARFISH_FORCE_PACKAGE119 /* Ordinarily we are loaded as part of an enclosing package definition.120 */121 114 result = Tcl_PkgProvide(interp, STARFISH_PACKAGE, STARFISH_VERSION); 122 115 if (result != TCL_OK) { 123 116 return result; 124 117 } 125 #endif126 118 127 119 Starfish_Limit(); 128 120 Starfish_InitSafeCmds(interp);
Note:
See TracBrowser
for help on using the repository browser.