From: Vlad S. <vl...@cr...> - 2005-06-10 15:51:49
|
Second try :-))) int NsTclReturnObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Ns_Conn *conn; unsigned char *data = 0, *type = 0; int result, param = 1, status = 0, len = 0, binary = 0; if (!strcmp(Tcl_GetString(objv[param]),"-binary")) { binary = 1; param++; } if (Tcl_GetIntFromObj(interp, objv[param++], &status) != TCL_OK) { return TCL_ERROR; } type = Tcl_GetString(objv[param++]); if (binary != 0) { data = Tcl_GetByteArrayFromObj(objv[param], &len); } else { data = Tcl_GetStringFromObj(objv[param], &len); } if (data == NULL || type == NULL || status == 0) { Tcl_WrongNumArgs(interp, 1, objv, "?-binary? status type string"); return TCL_ERROR; } if (GetConn(arg, interp, &conn) != TCL_OK) { return TCL_ERROR; } if(binary != 0) { result = Ns_ConnReturnData(conn, status, data, len, type); } else { result = Ns_ConnReturnCharData(conn, status, data, len, type); } return Result(interp, result); } Zoran Vasiljevic wrote: > > Am 10.06.2005 um 17:23 schrieb Vlad Seryakov: > >> How about this, i tested it : >> >> int >> NsTclReturnObjCmd(ClientData arg, Tcl_Interp *interp, int objc, >> Tcl_Obj *CONST objv[]) >> > > Hm... I would say, if somebody wanted to do: > > ns_return 200 text/plain -binary > > you'd have a problem, right? > > Zoran > > > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. How far can you > shotput > a projector? How fast can you ride your desk chair down the office luge > track? > If you want to score the big prize, get to know the little guy. Play to > win an NEC 61" plasma display: http://www.necitguy.com/?r=20 > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel -- Vlad Seryakov 571 262-8608 office vl...@cr... http://www.crystalballinc.com/vlad/ |