Skip to content
Browse files

Add in-place string sed function, strsed

git-svn-id: d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
Jordan K. Hubbard
Jordan K. Hubbard committed Aug 20, 2002
1 parent 813ba6b commit ac630b9254315a1985e0df518021bc25f50e6025
Showing with 1,577 additions and 0 deletions.
  1. +22 −0 Tcl/port1.0/Pextlib.c
  2. +1,555 −0 Tcl/port1.0/strsed.c
@@ -225,11 +225,33 @@ int ReaddirCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CON
return TCL_OK;

int StrsedCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
char *pattern, *string, *res;
Tcl_Obj *tcl_result;

if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "pattern string");
return TCL_ERROR;

pattern = Tcl_GetString(objv[1]);
string = Tcl_GetString(objv[2]);
res = strsed(string, pattern, 0);
if (!res) {
Tcl_SetResult(interp, "strsed failed", TCL_STATIC);
return TCL_ERROR;
Tcl_SetResult(interp, res, free);
return TCL_OK;

int Pextlib_Init(Tcl_Interp *interp)
Tcl_CreateObjCommand(interp, "system", SystemCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "flock", FlockCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "readdir", ReaddirCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "strsed", StrsedCmd, NULL, NULL);
if(Tcl_PkgProvide(interp, "Pextlib", "1.0") != TCL_OK)
return TCL_ERROR;
return TCL_OK;

0 comments on commit ac630b9

Please sign in to comment.
You can’t perform that action at this time.