You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-cvs@tcl.apache.org by ro...@apache.org on 2005/11/03 13:41:53 UTC
svn commit: r330538 - in /tcl/websh/trunk/src/generic: apchannel.c
interpool.c log.c logutl.c messages.c messages.h mod_websh.c request_ap.c
response_ap.c tclAppInit.c web.c webout.h
Author: ronnie
Date: Thu Nov 3 04:41:34 2005
New Revision: 330538
URL: http://svn.apache.org/viewcvs?rev=330538&view=rev
Log:
- removed unused variables
- proper Tcl_initStubs initialization
- some includes and WIN32 fixes
Modified:
tcl/websh/trunk/src/generic/apchannel.c
tcl/websh/trunk/src/generic/interpool.c
tcl/websh/trunk/src/generic/log.c
tcl/websh/trunk/src/generic/logutl.c
tcl/websh/trunk/src/generic/messages.c
tcl/websh/trunk/src/generic/messages.h
tcl/websh/trunk/src/generic/mod_websh.c
tcl/websh/trunk/src/generic/request_ap.c
tcl/websh/trunk/src/generic/response_ap.c
tcl/websh/trunk/src/generic/tclAppInit.c
tcl/websh/trunk/src/generic/web.c
tcl/websh/trunk/src/generic/webout.h
Modified: tcl/websh/trunk/src/generic/apchannel.c
URL: http://svn.apache.org/viewcvs/tcl/websh/trunk/src/generic/apchannel.c?rev=330538&r1=330537&r2=330538&view=diff
==============================================================================
--- tcl/websh/trunk/src/generic/apchannel.c (original)
+++ tcl/websh/trunk/src/generic/apchannel.c Thu Nov 3 04:41:34 2005
@@ -15,7 +15,11 @@
#include <stdio.h>
+#ifdef HAVE_SYS_ERRNO_H
#include <sys/errno.h>
+#else
+#include <errno.h>
+#endif
#include "tcl.h"
#include "httpd.h"
Modified: tcl/websh/trunk/src/generic/interpool.c
URL: http://svn.apache.org/viewcvs/tcl/websh/trunk/src/generic/interpool.c?rev=330538&r1=330537&r2=330538&view=diff
==============================================================================
--- tcl/websh/trunk/src/generic/interpool.c (original)
+++ tcl/websh/trunk/src/generic/interpool.c Thu Nov 3 04:41:34 2005
@@ -22,12 +22,14 @@
#include "modwebsh.h"
#include "tcl.h"
#include "webutl.h"
+#include "web.h"
#include "mod_websh.h"
#include "request.h"
#include <time.h>
#include <sys/stat.h>
+#ifndef WIN32
#include <unistd.h>
-
+#endif
/* init script for main interpreter */
@@ -118,6 +120,12 @@
}
+#ifdef USE_TCL_STUBS
+ if (Tcl_InitStubs(interp,"8.2.0",0) == NULL) {
+ return TCL_ERROR;
+ }
+#endif
+
/* now register here all websh modules */
result = Tcl_Init(webInterp->interp);
/* checkme: test result */
@@ -330,8 +338,13 @@
/* get last modified time for id */
if (strcmp(id, filename)) {
struct stat statPtr;
- if (Tcl_Access(id, R_OK) != 0 ||
+#ifdef WIN32
+ if (Tcl_Access(id, _S_IREAD) != 0 ||
Tcl_Stat(id, &statPtr) != TCL_OK)
+#else
+ if (Tcl_Access(id, R_OK) != 0 ||
+ Tcl_Stat(id, &statPtr) != TCL_OK)
+#endif
{
Tcl_MutexUnlock(&(conf->mainInterpLock));
Tcl_DecrRefCount(idObj);
@@ -569,8 +582,12 @@
if (mainInterp == NULL)
return NULL;
- /* init with tcl >= 8.2 is allowed */
- Tcl_InitStubs(mainInterp, "8.2", 0);
+#ifdef USE_TCL_STUBS
+ if (Tcl_InitStubs(mainInterp,"8.2.0",0) == NULL) {
+ Tcl_DeleteInterp(mainInterp);
+ return NULL;
+ }
+#endif
/* standard Init */
if (Tcl_Init(mainInterp) == TCL_ERROR) {
Modified: tcl/websh/trunk/src/generic/log.c
URL: http://svn.apache.org/viewcvs/tcl/websh/trunk/src/generic/log.c?rev=330538&r1=330537&r2=330538&view=diff
==============================================================================
--- tcl/websh/trunk/src/generic/log.c (original)
+++ tcl/websh/trunk/src/generic/log.c Thu Nov 3 04:41:34 2005
@@ -685,7 +685,6 @@
}
case DELETE:{
- /* HashTableIterator iterator; */
LogDest *logDest = NULL;
/* 0 1 2 */
@@ -852,7 +851,6 @@
case LEVELS:{
- HashTableIterator iterator;
LogLevel *logLevel = NULL;
int namesIsFirst = TCL_OK;
@@ -884,7 +882,6 @@
}
case DELETE:{
- /* HashTableIterator iterator; */
LogLevel *logLevel = NULL;
/* 0 1 2 */
Modified: tcl/websh/trunk/src/generic/logutl.c
URL: http://svn.apache.org/viewcvs/tcl/websh/trunk/src/generic/logutl.c?rev=330538&r1=330537&r2=330538&view=diff
==============================================================================
--- tcl/websh/trunk/src/generic/logutl.c (original)
+++ tcl/websh/trunk/src/generic/logutl.c Thu Nov 3 04:41:34 2005
@@ -113,7 +113,6 @@
{
LogDest *logDest = NULL;
- HashTableIterator iterator;
Tcl_Obj *fmsg = NULL;
Tcl_Obj *emsg = NULL; /* eval'd message */
Tcl_Obj *subst = NULL;
@@ -402,7 +401,6 @@
{
time_t t;
- struct tm ts;
char timeStr[2048];
char tmpStr[32] = "no pid";
char *c;
@@ -427,8 +425,11 @@
strftime(timeStr, sizeof(timeStr) - 1, fmt, badts);
}
#else
- localtime_r(&t, &ts);
- strftime(timeStr, sizeof(timeStr) - 1, fmt, &ts);
+ {
+ struct tm ts;
+ localtime_r(&t, &ts);
+ strftime(timeStr, sizeof(timeStr) - 1, fmt, &ts);
+ }
#endif
/* --------------------------------------------------------------------------
* add our special fields
Modified: tcl/websh/trunk/src/generic/messages.c
URL: http://svn.apache.org/viewcvs/tcl/websh/trunk/src/generic/messages.c?rev=330538&r1=330537&r2=330538&view=diff
==============================================================================
--- tcl/websh/trunk/src/generic/messages.c (original)
+++ tcl/websh/trunk/src/generic/messages.c Thu Nov 3 04:41:34 2005
@@ -45,7 +45,6 @@
int len = 0;
Tcl_Channel tc;
char *tmpStr = NULL;
- Tcl_DString ds;
/* ------------------------------------------------------------------------
* arg check
@@ -115,7 +114,6 @@
{
int mode = 0;
- Tcl_DString ds;
char *data = NULL;
TCLCONST char *res = NULL;
int cmdcode = 0;
@@ -228,7 +226,6 @@
TCLCONST char **argv;
int argc;
int count;
- Tcl_DString ds;
*flags = 0;
@@ -298,7 +295,7 @@
#endif
return (-1);
}
- if (ret != (size * sizeof(char))) {
+ if (ret != (int) (size * sizeof(char))) {
/*signal(SIGPIPE,origsig); */
#ifdef MSGDEBUG
printf("Could only write %d instead of %d bytes\n", ret,
@@ -367,7 +364,7 @@
}
if (ret != sizeof(MsgHeader) - sizeof(u_long)) {
#ifdef MSGDEBUG
- printf("Incomplete read: %d but expected %d\n", ret,
+ printf("Incomplete header read: %d but expected %d\n", ret,
sizeof(MsgHeader) - sizeof(u_long));
#endif
errno = EIO;
@@ -379,7 +376,12 @@
#ifdef MSGDEBUG
printf("Got unknown version %d\n", version);
#endif
- errno = EPROTONOSUPPORT;
+
+#ifdef EPROTONOSUPPORT
+ errno = EPROTONOSUPPORT;
+#else
+ errno = EIO;
+#endif
return (-1); /* unknown version */
}
@@ -417,7 +419,7 @@
}
if (ret != *size) {
#ifdef MSGDEBUG
- printf("Incomplete read: expected %d got %d\n", *size, ret);
+ printf("Incomplete data read: expected %d got %d (%d)\n", *size, ret, Tcl_Eof(f));
#endif
errno = EIO;
return (-1); /* incomplete read */
Modified: tcl/websh/trunk/src/generic/messages.h
URL: http://svn.apache.org/viewcvs/tcl/websh/trunk/src/generic/messages.h?rev=330538&r1=330537&r2=330538&view=diff
==============================================================================
--- tcl/websh/trunk/src/generic/messages.h (original)
+++ tcl/websh/trunk/src/generic/messages.h Thu Nov 3 04:41:34 2005
@@ -22,6 +22,10 @@
#include <stdio.h>
#include <tcl.h>
+#ifdef WIN32
+#include <windows.h> /* for u_long */
+#endif
+
#define WMSG_MAGIC 0xa5a53333
#define WMSG_VERSION 0x1
#define WMSG_TIMEOUT 100 /* seconds */
Modified: tcl/websh/trunk/src/generic/mod_websh.c
URL: http://svn.apache.org/viewcvs/tcl/websh/trunk/src/generic/mod_websh.c?rev=330538&r1=330537&r2=330538&view=diff
==============================================================================
--- tcl/websh/trunk/src/generic/mod_websh.c (original)
+++ tcl/websh/trunk/src/generic/mod_websh.c Thu Nov 3 04:41:34 2005
@@ -86,6 +86,7 @@
#include "web.h" /* websh headers */
#include "mod_websh.h" /* apchannel stuff */
#include "interpool.h"
+#include "logtoap.h"
#ifndef APACHE2
#include "http_conf_globals.h"
@@ -257,7 +258,7 @@
#else /* APACHE2 */
/* ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, "mtime of %s: %ld\n",r->filename,r->finfo.mtime); */
- webInterp = poolGetWebInterp(conf, r->filename, r->finfo.mtime, r);
+ webInterp = poolGetWebInterp(conf, r->filename, (long) r->finfo.mtime, r);
/* ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, "got pool %p", webInterp); */
if (webInterp == NULL || webInterp->interp == NULL) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r,
Modified: tcl/websh/trunk/src/generic/request_ap.c
URL: http://svn.apache.org/viewcvs/tcl/websh/trunk/src/generic/request_ap.c?rev=330538&r1=330537&r2=330538&view=diff
==============================================================================
--- tcl/websh/trunk/src/generic/request_ap.c (original)
+++ tcl/websh/trunk/src/generic/request_ap.c Thu Nov 3 04:41:34 2005
@@ -17,6 +17,7 @@
#include "hashutl.h"
#include "webutl.h"
#include "request.h"
+#include "paramlist.h"
#include "mod_websh.h"
Modified: tcl/websh/trunk/src/generic/response_ap.c
URL: http://svn.apache.org/viewcvs/tcl/websh/trunk/src/generic/response_ap.c?rev=330538&r1=330537&r2=330538&view=diff
==============================================================================
--- tcl/websh/trunk/src/generic/response_ap.c (original)
+++ tcl/websh/trunk/src/generic/response_ap.c Thu Nov 3 04:41:34 2005
@@ -22,6 +22,8 @@
#include "request.h"
+#include "apr_strings.h"
+
/* ----------------------------------------------------------------------------
* apHeaderHandler -- set headers in mod_websh case
* ------------------------------------------------------------------------- */
Modified: tcl/websh/trunk/src/generic/tclAppInit.c
URL: http://svn.apache.org/viewcvs/tcl/websh/trunk/src/generic/tclAppInit.c?rev=330538&r1=330537&r2=330538&view=diff
==============================================================================
--- tcl/websh/trunk/src/generic/tclAppInit.c (original)
+++ tcl/websh/trunk/src/generic/tclAppInit.c Thu Nov 3 04:41:34 2005
@@ -124,9 +124,14 @@
*----------------------------------------------------------------------
*/
-int Tcl_AppInit(interp)
- Tcl_Interp *interp; /* Interpreter for application. */
-{
+int Tcl_AppInit(Tcl_Interp *interp) {
+
+#ifdef USE_TCL_STUBS
+ if (Tcl_InitStubs(interp,"8.2.0",0) == NULL) {
+ return TCL_ERROR;
+ }
+#endif
+
if (Tcl_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
Modified: tcl/websh/trunk/src/generic/web.c
URL: http://svn.apache.org/viewcvs/tcl/websh/trunk/src/generic/web.c?rev=330538&r1=330537&r2=330538&view=diff
==============================================================================
--- tcl/websh/trunk/src/generic/web.c (original)
+++ tcl/websh/trunk/src/generic/web.c Thu Nov 3 04:41:34 2005
@@ -17,6 +17,7 @@
#include "web.h"
#include "nca_d.h"
#include <stdio.h>
+#include "messages.h"
/* ----------------------------------------------------------------------------
* init --
@@ -51,10 +52,8 @@
/* --------------------------------------------------------------------------
* messages on streams
* ----------------------------------------------------------------------- */
-#ifndef WIN32
if (messages_Init(interp) == TCL_ERROR)
return TCL_ERROR;
-#endif
/* --------------------------------------------------------------------------
* cryptography
Modified: tcl/websh/trunk/src/generic/webout.h
URL: http://svn.apache.org/viewcvs/tcl/websh/trunk/src/generic/webout.h?rev=330538&r1=330537&r2=330538&view=diff
==============================================================================
--- tcl/websh/trunk/src/generic/webout.h (original)
+++ tcl/websh/trunk/src/generic/webout.h Thu Nov 3 04:41:34 2005
@@ -89,7 +89,7 @@
int webout_eval_brace(Tcl_Interp * interp, ResponseObj * responseObj,
Tcl_Obj * in);
int webout_eval_tag(Tcl_Interp * interp, ResponseObj * responseObj,
- Tcl_Obj * in, const char *strstart, const char *strend);
+ Tcl_Obj * in, TCLCONST char *strstart, TCLCONST char *strend);
/* need this for all "real channel based" (vs apache) output */
int objectHeaderHandler(Tcl_Interp * interp, ResponseObj * responseObj,
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-cvs-help@tcl.apache.org