Update of /cvsroot/naviserver/naviserver/nsd
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22857/nsd
Modified Files:
tclcmds.c tclfile.c
Log Message:
Re-born ns_normalizepath as C command
Index: tclcmds.c
===================================================================
RCS file: /cvsroot/naviserver/naviserver/nsd/tclcmds.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** tclcmds.c 21 Oct 2005 06:22:14 -0000 1.22
--- tclcmds.c 21 Oct 2005 10:07:26 -0000 1.23
***************
*** 1,7 ****
/*
! * The contents of this file are subject to the AOLserver Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
! * http://aolserver.com/.
*
* Software distributed under the License is distributed on an "AS IS"
--- 1,7 ----
/*
! * The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
! * http://mozilla.org/.
*
* Software distributed under the License is distributed on an "AS IS"
***************
*** 106,109 ****
--- 106,110 ----
NsTclModulePathObjCmd,
NsTclMutexObjCmd,
+ NsTclNormalizePathObjCmd,
NsTclNsvAppendObjCmd,
NsTclNsvArrayObjCmd,
***************
*** 279,282 ****
--- 280,284 ----
{"ns_logctl", NULL, NsTclLogCtlObjCmd},
{"ns_logroll", NULL, NsTclLogRollObjCmd},
+ {"ns_normalizepath", NULL, NsTclNormalizePathObjCmd},
{"ns_mktemp", NsTclMkTempCmd, NULL},
{"ns_modulepath", NULL, NsTclModulePathObjCmd},
***************
*** 378,381 ****
--- 380,384 ----
{"ns_ictl", NULL, NsTclICtlObjCmd},
{"ns_library", NsTclLibraryCmd, NULL},
+ {"ns_normalizepath", NULL, NsTclNormalizePathObjCmd},
{"ns_moduleload", NULL, NsTclModuleLoadObjCmd},
{"ns_puts", NULL, NsTclAdpPutsObjCmd},
Index: tclfile.c
===================================================================
RCS file: /cvsroot/naviserver/naviserver/nsd/tclfile.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** tclfile.c 15 Oct 2005 14:47:52 -0000 1.8
--- tclfile.c 21 Oct 2005 10:07:26 -0000 1.9
***************
*** 551,554 ****
--- 551,590 ----
return TCL_OK;
}
+
+ /*
+ *----------------------------------------------------------------------
+ *
+ * NsTclNormalizePathObjCmd --
+ *
+ * Implements ns_normalizepath as obj command.
+ *
+ * Results:
+ * Tcl result.
+ *
+ * Side effects:
+ * See docs.
+ *
+ *----------------------------------------------------------------------
+ */
+
+ int
+ NsTclNormalizePathObjCmd(ClientData arg, Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[])
+ {
+ Ns_DString ds;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "path");
+ return TCL_ERROR;
+ }
+
+ Ns_DStringInit(&ds);
+ Ns_NormalizePath(&ds, Tcl_GetString(objv[1]));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(Ns_DStringValue(&ds),
+ Ns_DStringLength(&ds)));
+ Ns_DStringFree(&ds);
+
+ return TCL_OK;
+ }
|