+++ /dev/null
-/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "bison.simple"
-
-/* Skeleton output parser for bison,
- Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-#ifndef alloca
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else /* not GNU C. */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
-#include <alloca.h>
-#else /* not sparc */
-#if defined (MSDOS) && !defined (__TURBOC__)
-#include <malloc.h>
-#else /* not MSDOS, or __TURBOC__ */
-#if defined(_AIX)
-#include <malloc.h>
- #pragma alloca
-#else /* not MSDOS, __TURBOC__, or _AIX */
-#ifdef __hpux
-#ifdef __cplusplus
-extern "C" {
-void *alloca (unsigned int);
-};
-#else /* not __cplusplus */
-void *alloca ();
-#endif /* not __cplusplus */
-#endif /* __hpux */
-#endif /* not _AIX */
-#endif /* not MSDOS, or __TURBOC__ */
-#endif /* not sparc. */
-#endif /* not GNU C. */
-#endif /* alloca not defined. */
-
-/* This is the parser code that is written into each bison parser
- when the %semantic_parser declaration is not specified in the grammar.
- It was written by Richard Stallman by simplifying the hairy parser
- used when %semantic_parser is specified. */
-
-/* Note: there must be only one dollar sign in this file.
- It is replaced by the list of actions, each action
- as one case of the switch. */
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY -2
-#define YYEOF 0
-#define YYACCEPT return(0)
-#define YYABORT return(1)
-#define YYERROR goto yyerrlab1
-/* Like YYERROR except do call yyerror.
- This remains here temporarily to ease the
- transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
-#define YYFAIL goto yyerrlab
-#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(token, value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { yychar = (token), yylval = (value); \
- yychar1 = YYTRANSLATE (yychar); \
- YYPOPSTACK; \
- goto yybackup; \
- } \
- else \
- { yyerror ("syntax error: cannot back up"); YYERROR; } \
-while (0)
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-#ifndef YYPURE
-#define YYLEX yylex()
-#endif
-
-#ifdef YYPURE
-#ifdef YYLSP_NEEDED
-#ifdef YYLEX_PARAM
-#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
-#else
-#define YYLEX yylex(&yylval, &yylloc)
-#endif
-#else /* not YYLSP_NEEDED */
-#ifdef YYLEX_PARAM
-#define YYLEX yylex(&yylval, YYLEX_PARAM)
-#else
-#ifdef PHP3_THREAD_SAFE /* PHP 3 Specific useage */
-#define YYLEX yylex(&yylval,php3_globals,php_gbl)
-#else
-#define YYLEX yylex(&yylval)
-#endif /* not using tls */
-#endif
-#endif /* not YYLSP_NEEDED */
-#endif
-
-/* If nonreentrant, generate the variables here */
-
-#ifndef YYPURE
-
-int yychar; /* the lookahead symbol */
-YYSTYPE yylval; /* the semantic value of the */
- /* lookahead symbol */
-
-#ifdef YYLSP_NEEDED
-YYLTYPE yylloc; /* location data for the lookahead */
- /* symbol */
-#endif
-
-int yynerrs; /* number of parse errors so far */
-#endif /* not YYPURE */
-
-#if YYDEBUG != 0
-int yydebug; /* nonzero means print parse trace */
-/* Since this is uninitialized, it does not stop multiple parsers
- from coexisting. */
-#endif
-
-/* YYINITDEPTH indicates the initial size of the parser's stacks */
-
-#ifndef YYINITDEPTH
-#define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH is the maximum size the stacks can grow to
- (effective only if the built-in stack extension method is used). */
-
-#if YYMAXDEPTH == 0
-#undef YYMAXDEPTH
-#endif
-
-#ifndef YYMAXDEPTH
-#define YYMAXDEPTH 10000
-#endif
-
-/* Prevent warning if -Wstrict-prototypes. */
-#ifdef __GNUC__
-/* int yyparse (void); */
-#endif
-\f
-#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
-#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
-#else /* not GNU C or C++ */
-#ifndef __cplusplus
-
-/* This is the most reliable way to avoid incompatibilities
- in available built-in functions on various systems. */
-static void
-__yy_memcpy (to, from, count)
- char *to;
- char *from;
- int count;
-{
- register char *f = from;
- register char *t = to;
- register int i = count;
-
- while (i-- > 0)
- *t++ = *f++;
-}
-
-#else /* __cplusplus */
-
-/* This is the most reliable way to avoid incompatibilities
- in available built-in functions on various systems. */
-static void
-__yy_memcpy (char *to, char *from, int count)
-{
- register char *f = from;
- register char *t = to;
- register int i = count;
-
- while (i-- > 0)
- *t++ = *f++;
-}
-
-#endif
-#endif
-\f
-#line 196 "bison.simple"
-
-/* The user can define YYPARSE_PARAM as the name of an argument to be passed
- into yyparse. The argument should have type void *.
- It should actually point to an object.
- Grammar actions can access the variable by casting it
- to the proper pointer type. */
-
-#ifdef YYPARSE_PARAM
-#ifdef __cplusplus
-#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL
-#else /* not __cplusplus */
-#define YYPARSE_PARAM_ARG YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
-#endif /* not __cplusplus */
-#else /* not YYPARSE_PARAM */
-#define YYPARSE_PARAM_ARG
-#define YYPARSE_PARAM_DECL
-#endif /* not YYPARSE_PARAM */
-
-#ifndef TLS_VARS
-#define TLS_VARS
-#endif
-#ifndef YY_TLS_VARS
-#define YY_TLS_VARS
-#endif
-
-int
-yyparse(YYPARSE_PARAM_ARG)
- YYPARSE_PARAM_DECL
-{
- register int yystate;
- register int yyn;
- register short *yyssp;
- register YYSTYPE *yyvsp;
- int yyerrstatus; /* number of tokens to shift before error messages enabled */
- int yychar1 = 0; /* lookahead token as an internal (translated) token number */
-
- short yyssa[YYINITDEPTH]; /* the state stack */
- YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
-
- short *yyss = yyssa; /* refer to the stacks thru separate pointers */
- YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
-
-#ifdef YYLSP_NEEDED
- YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
- YYLTYPE *yyls = yylsa;
- YYLTYPE *yylsp;
-
-#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
-#else
-#define YYPOPSTACK (yyvsp--, yyssp--)
-#endif
-
- int yystacksize = YYINITDEPTH;
-
-#ifdef YYPURE
- int yychar;
- YYSTYPE yylval;
- int yynerrs;
-#ifdef YYLSP_NEEDED
- YYLTYPE yylloc;
-#endif
-#endif
-
- YYSTYPE yyval; /* the variable used to return */
- /* semantic values from the action */
- /* routines */
-
- int yylen;
- YY_TLS_VARS;
- TLS_VARS;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Starting parse\n");
-#endif
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
-
- yyssp = yyss - 1;
- yyvsp = yyvs;
-#ifdef YYLSP_NEEDED
- yylsp = yyls;
-#endif
-
-/* Push a new state, which is found in yystate . */
-/* In all cases, when you get here, the value and location stacks
- have just been pushed. so pushing a state here evens the stacks. */
-yynewstate:
-
- *++yyssp = yystate;
-
- if (yyssp >= yyss + yystacksize - 1)
- {
- /* Give user a chance to reallocate the stack */
- /* Use copies of these so that the &'s don't force the real ones into memory. */
- YYSTYPE *yyvs1 = yyvs;
- short *yyss1 = yyss;
-#ifdef YYLSP_NEEDED
- YYLTYPE *yyls1 = yyls;
-#endif
-
- /* Get the current used size of the three stacks, in elements. */
- int size = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- /* Each stack pointer address is followed by the size of
- the data in use in that stack, in bytes. */
-#ifdef YYLSP_NEEDED
- /* This used to be a conditional around just the two extra args,
- but that might be undefined if yyoverflow is a macro. */
- yyoverflow("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yyls1, size * sizeof (*yylsp),
- &yystacksize);
-#else
- yyoverflow("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yystacksize);
-#endif
-
- yyss = yyss1; yyvs = yyvs1;
-#ifdef YYLSP_NEEDED
- yyls = yyls1;
-#endif
-#else /* no yyoverflow */
- /* Extend the stack our own way. */
- if (yystacksize >= YYMAXDEPTH)
- {
- yyerror("parser stack overflow");
- return 2;
- }
- yystacksize *= 2;
- if (yystacksize > YYMAXDEPTH)
- yystacksize = YYMAXDEPTH;
- yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
- __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
- yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
- __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
-#ifdef YYLSP_NEEDED
- yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
- __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
-#endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + size - 1;
- yyvsp = yyvs + size - 1;
-#ifdef YYLSP_NEEDED
- yylsp = yyls + size - 1;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Stack size increased to %d\n", yystacksize);
-#endif
-
- if (yyssp >= yyss + yystacksize - 1)
- YYABORT;
- }
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Entering state %d\n", yystate);
-#endif
-
- goto yybackup;
- yybackup:
-
-/* Do appropriate processing given the current state. */
-/* Read a lookahead token if we need one and don't already have one. */
-/* yyresume: */
-
- /* First try to decide what to do without reference to lookahead token. */
-
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* yychar is either YYEMPTY or YYEOF
- or a valid token in external form. */
-
- if (yychar == YYEMPTY)
- {
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Reading a token: ");
-#endif
- yychar = YYLEX;
- }
-
- /* Convert token to internal form (in yychar1) for indexing tables with */
-
- if (yychar <= 0) /* This means end of input. */
- {
- yychar1 = 0;
- yychar = YYEOF; /* Don't call YYLEX any more */
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Now at end of input.\n");
-#endif
- }
- else
- {
- yychar1 = YYTRANSLATE(yychar);
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
- /* Give the individual parser a way to print the precise meaning
- of a token, for further debugging info. */
-#ifdef YYPRINT
- YYPRINT (stderr, yychar, yylval);
-#endif
- fprintf (stderr, ")\n");
- }
-#endif
- }
-
- yyn += yychar1;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
- goto yydefault;
-
- yyn = yytable[yyn];
-
- /* yyn is what to do for this token type in this state.
- Negative => reduce, -yyn is rule number.
- Positive => shift, yyn is new state.
- New state is final state => don't bother to shift,
- just return success.
- 0, or most negative number => error. */
-
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrlab;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- /* Shift the lookahead token. */
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
-#endif
-
- /* Discard the token being shifted unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
- *++yyvsp = yylval;
-#ifdef YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- /* count tokens shifted since error; after three, turn off error status. */
- if (yyerrstatus) yyerrstatus--;
-
- yystate = yyn;
- goto yynewstate;
-
-/* Do the default action for the current state. */
-yydefault:
-
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
-
-/* Do a reduction. yyn is the number of a rule to reduce with. */
-yyreduce:
- yylen = yyr2[yyn];
- if (yylen > 0)
- yyval = yyvsp[1-yylen]; /* implement default value of the action */
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- int i;
-
- fprintf (stderr, "Reducing via rule %d (line %d), ",
- yyn, yyrline[yyn]);
-
- /* Print the symbols being reduced, and their result. */
- for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
- fprintf (stderr, "%s ", yytname[yyrhs[i]]);
- fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
- }
-#endif
-
-$ /* the action file gets copied in in place of this dollarsign */
-#line 498 "bison.simple"
-\f
- yyvsp -= yylen;
- yyssp -= yylen;
-#ifdef YYLSP_NEEDED
- yylsp -= yylen;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- short *ssp1 = yyss - 1;
- fprintf (stderr, "state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "\n");
- }
-#endif
-
- *++yyvsp = yyval;
-
-#ifdef YYLSP_NEEDED
- yylsp++;
- if (yylen == 0)
- {
- yylsp->first_line = yylloc.first_line;
- yylsp->first_column = yylloc.first_column;
- yylsp->last_line = (yylsp-1)->last_line;
- yylsp->last_column = (yylsp-1)->last_column;
- yylsp->text = 0;
- }
- else
- {
- yylsp->last_line = (yylsp+yylen-1)->last_line;
- yylsp->last_column = (yylsp+yylen-1)->last_column;
- }
-#endif
-
- /* Now "shift" the result of the reduction.
- Determine what state that goes to,
- based on the state we popped back to
- and the rule number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
- if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTBASE];
-
- goto yynewstate;
-
-yyerrlab: /* here on detecting error */
-
- if (! yyerrstatus)
- /* If not already recovering from an error, report this error. */
- {
- ++yynerrs;
-
-#ifdef YYERROR_VERBOSE
- yyn = yypact[yystate];
-
- if (yyn > YYFLAG && yyn < YYLAST)
- {
- int size = 0;
- char *msg;
- int x, count;
-
- count = 0;
- /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
- for (x = (yyn < 0 ? -yyn : 0);
- x < (sizeof(yytname) / sizeof(char *)); x++)
- if (yycheck[x + yyn] == x)
- size += strlen(yytname[x]) + 15, count++;
- msg = (char *) malloc(size + 15);
- if (msg != 0)
- {
- strcpy(msg, "parse error");
-
- if (count < 5)
- {
- count = 0;
- for (x = (yyn < 0 ? -yyn : 0);
- x < (sizeof(yytname) / sizeof(char *)); x++)
- if (yycheck[x + yyn] == x)
- {
- strcat(msg, count == 0 ? ", expecting `" : " or `");
- strcat(msg, yytname[x]);
- strcat(msg, "'");
- count++;
- }
- }
- yyerror(msg);
- free(msg);
- }
- else
- yyerror ("parse error; also virtual memory exceeded");
- }
- else
-#endif /* YYERROR_VERBOSE */
- yyerror("parse error");
- }
-
- goto yyerrlab1;
-yyerrlab1: /* here on error raised explicitly by an action */
-
- if (yyerrstatus == 3)
- {
- /* if just tried and failed to reuse lookahead token after an error, discard it. */
-
- /* return failure if at end of input */
- if (yychar == YYEOF)
- YYABORT;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
-#endif
-
- yychar = YYEMPTY;
- }
-
- /* Else will try to reuse lookahead token
- after shifting the error token. */
-
- yyerrstatus = 3; /* Each real token shifted decrements this */
-
- goto yyerrhandle;
-
-yyerrdefault: /* current state does not do anything special for the error token. */
-
-#if 0
- /* This is wrong; only states that explicitly want error tokens
- should shift them. */
- yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
- if (yyn) goto yydefault;
-#endif
-
-yyerrpop: /* pop the current state because it cannot handle the error token */
-
- if (yyssp == yyss) YYABORT;
- yyvsp--;
- yystate = *--yyssp;
-#ifdef YYLSP_NEEDED
- yylsp--;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- short *ssp1 = yyss - 1;
- fprintf (stderr, "Error: state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "\n");
- }
-#endif
-
-yyerrhandle:
-
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yyerrdefault;
-
- yyn += YYTERROR;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
- goto yyerrdefault;
-
- yyn = yytable[yyn];
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrpop;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrpop;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Shifting error token, ");
-#endif
-
- *++yyvsp = yylval;
-#ifdef YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- yystate = yyn;
- goto yynewstate;
-}
+++ /dev/null
-/*
- +----------------------------------------------------------------------+
- | PHP HTML Embedded Scripting Language Version 3.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
- +----------------------------------------------------------------------+
- | This program is free software; you can redistribute it and/or modify |
- | it under the terms of one of the following licenses: |
- | |
- | A) the GNU General Public License as published by the Free Software |
- | Foundation; either version 2 of the License, or (at your option) |
- | any later version. |
- | |
- | B) the PHP License as published by the PHP Development Team and |
- | included in the distribution in the file: LICENSE |
- | |
- | This program is distributed in the hope that it will be useful, |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- | GNU General Public License for more details. |
- | |
- | You should have received a copy of both licenses referred to here. |
- | If you did not, or have any questions about PHP licensing, please |
- | contact core@php.net. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-
-#ifndef _CONTROL_STRUCTURES_H
-#define _CONTROL_STRUCTURES_H
-
-#ifndef THREAD_SAFE
-extern unsigned int param_index;
-extern char *class_name;
-extern HashTable *class_symbol_table;
-#endif
-
-extern inline void start_display_source(int start_in_php INLINE_TLS);
-
-#endif
pval *arg_name,*arg_val;
char *note_val;
int arg_count = ARG_COUNT(ht);
-TLS_VARS;
if (arg_count<1 || arg_count>2 ||
getParameters(ht,arg_count,&arg_name,&arg_val) == FAILURE ) {
}
convert_to_string(arg_name);
- note_val = (char *) table_get(GLOBAL(php3_rqst)->notes,arg_name->value.str.val);
+ note_val = (char *) table_get(php3_rqst->notes,arg_name->value.str.val);
if (arg_count == 2) {
convert_to_string(arg_val);
- table_set(GLOBAL(php3_rqst)->notes,arg_name->value.str.val,arg_val->value.str.val);
+ table_set(php3_rqst->notes,arg_name->value.str.val,arg_val->value.str.val);
}
if (note_val) {
char name[64];
char *p;
#endif
- server_rec *serv = GLOBAL(php3_rqst)->server;
+ server_rec *serv = php3_rqst->server;
extern char server_root[MAX_STRING_LEN];
extern uid_t user_id;
extern char *user_name;
{
pval *filename;
request_rec *rr = NULL;
-TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&filename) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_string(filename);
- if (!(rr = sub_req_lookup_uri (filename->value.str.val, GLOBAL(php3_rqst)))) {
+ if (!(rr = sub_req_lookup_uri (filename->value.str.val, php3_rqst))) {
php3_error(E_WARNING, "Unable to include '%s' - URI lookup failed", filename->value.str.val);
if (rr) destroy_sub_req (rr);
RETURN_FALSE;
}
convert_to_string(filename);
- if(!(rr = sub_req_lookup_uri(filename->value.str.val, GLOBAL(php3_rqst)))) {
+ if(!(rr = sub_req_lookup_uri(filename->value.str.val, php3_rqst))) {
php3_error(E_WARNING, "URI lookup failed", filename->value.str.val);
RETURN_FALSE;
}
}
convert_to_string(filename);
- if(!(rr = ap_sub_req_lookup_uri(filename->value.str.val, GLOBAL(php3_rqst)))) {
+ if(!(rr = ap_sub_req_lookup_uri(filename->value.str.val, php3_rqst))) {
php3_error(E_WARNING, "URI lookup failed", filename->value.str.val);
RETURN_FALSE;
}
int php3_rinit_bcmath(INIT_FUNC_ARGS)
{
- TLS_VARS;
-
init_numbers();
- if (cfg_get_long("bcmath.scale",&GLOBAL(bc_precision))==FAILURE) {
- GLOBAL(bc_precision)=0;
+ if (cfg_get_long("bcmath.scale",&bc_precision)==FAILURE) {
+ bc_precision=0;
}
return SUCCESS;
}
{
pval *left, *right,*scale_param;
bc_num first, second, result;
- int scale=GLOBAL(bc_precision);
+ int scale=bc_precision;
switch (ARG_COUNT(ht)) {
case 2:
{
pval *left, *right,*scale_param;
bc_num first, second, result;
- int scale=GLOBAL(bc_precision);
+ int scale=bc_precision;
switch (ARG_COUNT(ht)) {
case 2:
{
pval *left, *right,*scale_param;
bc_num first, second, result;
- int scale=GLOBAL(bc_precision);
+ int scale=bc_precision;
switch (ARG_COUNT(ht)) {
case 2:
{
pval *left, *right,*scale_param;
bc_num first, second, result;
- int scale=GLOBAL(bc_precision);
+ int scale=bc_precision;
switch (ARG_COUNT(ht)) {
case 2:
{
pval *left, *right,*scale_param;
bc_num first, second, result;
- int scale=GLOBAL(bc_precision);
+ int scale=bc_precision;
switch (ARG_COUNT(ht)) {
case 2:
{
pval *left,*scale_param;
bc_num result;
- int scale=GLOBAL(bc_precision);
+ int scale=bc_precision;
switch (ARG_COUNT(ht)) {
case 1:
{
pval *left, *right, *scale_param;
bc_num first, second;
- int scale=GLOBAL(bc_precision);
+ int scale=bc_precision;
switch (ARG_COUNT(ht)) {
case 2:
}
convert_to_long(new_scale);
- GLOBAL(bc_precision) = new_scale->value.lval;
+ bc_precision = new_scale->value.lval;
RETURN_TRUE;
}
/* }}} */
/* Intitialize the number package! */
-void
-init_numbers (void)
+void init_numbers (void)
{
- TLS_VARS;
-
- GLOBAL(_zero_) = new_num (1,0);
- GLOBAL(_one_) = new_num (1,0);
- GLOBAL(_one_)->n_value[0] = 1;
- GLOBAL(_two_) = new_num (1,0);
- GLOBAL(_two_)->n_value[0] = 2;
+ _zero_ = new_num (1,0);
+ _one_ = new_num (1,0);
+ _one_->n_value[0] = 1;
+ _two_ = new_num (1,0);
+ _two_->n_value[0] = 2;
}
/* Intitialize the number package! */
void
destruct_numbers ()
{
- TLS_VARS;
-
- free_num(&GLOBAL(_zero_));
- free_num(&GLOBAL(_one_));
- free_num(&GLOBAL(_two_));
+ free_num(&_zero_);
+ free_num(&_one_);
+ free_num(&_two_);
}
/* Make a copy of a number! Just increments the reference count! */
init_num (num)
bc_num *num;
{
- TLS_VARS;
- *num = copy_num (GLOBAL(_zero_));
+ *num = copy_num (_zero_);
}
{
int count;
char *nptr;
- TLS_VARS;
/* Quick check. */
- if (num == GLOBAL(_zero_)) return TRUE;
+ if (num == _zero_) return TRUE;
/* Initialize */
count = num->n_len + num->n_scale;
{
bc_num power, exponent, parity, temp;
int rscale;
- TLS_VARS;
/* Check for correct numbers. */
if (is_zero(mod)) return -1;
/* Set initial values. */
power = copy_num (base);
exponent = copy_num (expo);
- temp = copy_num (GLOBAL(_one_));
+ temp = copy_num (_one_);
init_num (&parity);
/* Check the exponent for scale digits. */
if (exponent->n_scale != 0)
{
rt_warn ("non-zero scale in exponent");
- bc_divide (exponent, GLOBAL(_one_), &exponent, 0); /*truncate */
+ bc_divide (exponent, _one_, &exponent, 0); /*truncate */
}
/* Check the modulus for scale digits. */
rscale = MAX(scale, base->n_scale);
while ( !is_zero(exponent) )
{
- (void) bc_divmod (exponent, GLOBAL(_two_), &exponent, &parity, 0);
+ (void) bc_divmod (exponent, _two_, &exponent, &parity, 0);
if ( !is_zero(parity) )
{
bc_multiply (temp, power, &temp, rscale);
long exponent;
int rscale;
char neg;
- TLS_VARS;
/* Check the exponent for scale digits and convert to a long. */
if (num2->n_scale != 0)
if (exponent == 0)
{
free_num (result);
- *result = copy_num (GLOBAL(_one_));
+ *result = copy_num (_one_);
return;
}
/* Assign the value. */
if (neg)
{
- bc_divide (GLOBAL(_one_), temp, result, rscale);
+ bc_divide (_one_, temp, result, rscale);
free_num (&temp);
}
else
int rscale, cmp_res, done;
int cscale;
bc_num guess, guess1, point5, diff;
- TLS_VARS;
/* Initial checks. */
- cmp_res = bc_compare (*num, GLOBAL(_zero_));
+ cmp_res = bc_compare (*num, _zero_);
if (cmp_res < 0)
return 0; /* error */
else
if (cmp_res == 0)
{
free_num (num);
- *num = copy_num (GLOBAL(_zero_));
+ *num = copy_num (_zero_);
return 1;
}
}
- cmp_res = bc_compare (*num, GLOBAL(_one_));
+ cmp_res = bc_compare (*num, _one_);
if (cmp_res == 0)
{
free_num (num);
- *num = copy_num (GLOBAL(_one_));
+ *num = copy_num (_one_);
return 1;
}
/* Calculate the initial guess. */
if (cmp_res < 0)
/* The number is between 0 and 1. Guess should start at 1. */
- guess = copy_num (GLOBAL(_one_));
+ guess = copy_num (_one_);
else
{
/* The number is greater than 1. Guess should start at 10^(exp/2). */
/* Assign the number and clean up. */
free_num (num);
- bc_divide (guess,GLOBAL(_one_),num,rscale);
+ bc_divide (guess,_one_,num,rscale);
free_num (&guess);
free_num (&guess1);
free_num (&point5);
int digits, strscale;
char *ptr, *nptr;
char zero_int;
- TLS_VARS;
/* Prepare num. */
free_num (num);
while (isdigit(*ptr)) ptr++, strscale++; /* digits */
if ((*ptr != '\0') || (digits+strscale == 0))
{
- *num = copy_num (GLOBAL(_zero_));
+ *num = copy_num (_zero_);
return;
}
off_t start, end;
char *buf = NULL;
char *string = NULL;
- TLS_VARS;
if (icase)
copts |= REG_ICASE;
RETURN_FALSE;
}
- pval_destructor(array _INLINE_TLS); /* start with clean array */
+ pval_destructor(array); /* start with clean array */
array_init(array);
for (i = 0; i < NS; i++) {
char *string;
char *replace;
char *ret;
- TLS_VARS;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg_pattern, &arg_replace, &arg_string) == FAILURE) {
WRONG_PARAM_COUNT;
regmatch_t subs[1];
char *strp, *endp;
int err, size, count;
- TLS_VARS;
switch (ARG_COUNT(ht)) {
case 2:
#if APACHE
{
int j;
- array_header *arr = table_elts(GLOBAL(php3_rqst)->subprocess_env);
+ array_header *arr = table_elts(php3_rqst->subprocess_env);
table_entry *elts = (table_entry *)arr->elts;
for (j=0; j < arr->nelts; j++) {
hw_connection *ptr;
int do_swap;
int version = 0;
- TLS_VARS;
argc = ARG_COUNT(ht);
switch(argc) {
pval *arg1;
int id, type;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
int id, type;
hw_connection *ptr;
char *str;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
pval *arg1;
int id, type;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
int id, type;
hw_connection *ptr;
char errstr[100];
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
Returns object id of root collection */
void php3_hw_root(INTERNAL_FUNCTION_PARAMETERS)
{
- TLS_VARS;
return_value->value.lval = 0;
return_value->type = IS_LONG;
}
pval *arg1;
int link, type;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
return NULL;
pval *arg1, *arg2, *arg3;
int link, id, type, msgid;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
WRONG_PARAM_COUNT;
pval *arg1, *arg2;
int link, id, type;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
int link, type;
char *objrec, *parms;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
WRONG_PARAM_COUNT;
pval *arg1, *arg2;
int link, id, type;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
pval *arg1, *arg2;
int link, id, type;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
pval *arg1, *arg2;
int link, id, type;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
hw_connection *ptr;
char *modification, *oldobjrec, buf[200];
HashTable *newobjarr;
- TLS_VARS;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
WRONG_PARAM_COUNT;
HashTable *src_arr;
hw_connection *ptr;
int collIDcount, docIDcount, i, *docIDs, *collIDs;
- TLS_VARS;
switch(mvcp) {
case MOVE: /* Move also has fromID */
int rootid = 0;
hw_document *doc;
hw_connection *ptr;
- TLS_VARS;
argc = ARG_COUNT(ht);
if((argc > 3) || (argc < 2))
int link, id, doc, type;
hw_connection *ptr;
hw_document *docptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
hw_document *doc;
hw_connection *ptr;
char cgi_env_str[1000];
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
getenv("QUERY_STRING"));
#else
sprintf(cgi_env_str, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
- GLOBAL(request_info).request_method,
- GLOBAL(request_info).path_info,
- GLOBAL(request_info).query_string);
+ request_info.request_method,
+ request_info.path_info,
+ request_info.query_string);
#endif
/* !!!! memory for object and attributes is allocated with malloc !!!! */
if (0 != (ptr->lasterror = send_getcgi(ptr->socket, id, cgi_env_str, &attributes, &object, &count)))
int link, id, type;
hw_document *doc;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
int link, type, i;
hw_connection *ptr;
char *objrec;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
pval *arg1, *arg2;
int link, type, rootid;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
hw_connection *ptr;
hw_document *doc;
#if APACHE
- server_rec *serv = GLOBAL(php3_rqst)->server;
+ server_rec *serv = php3_rqst->server;
#endif
- TLS_VARS;
argc = ARG_COUNT(ht);
if((argc > 2) || (argc < 2))
hw_document *doc;
char cgi_env_str[1000];
#if APACHE
- server_rec *serv = GLOBAL(php3_rqst)->server;
+ server_rec *serv = php3_rqst->server;
#endif
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
getenv("QUERY_STRING"));
#else
sprintf(cgi_env_str, "CGI_REQUEST_METHOD=%s\nCGI_PATH_INFO=%s\nCGI_QUERY_STRING=%s",
- GLOBAL(request_info).request_method,
- GLOBAL(request_info).path_info,
- GLOBAL(request_info).query_string);
+ request_info.request_method,
+ request_info.path_info,
+ request_info.query_string);
#endif
/* !!!! memory for object, bodytag and attributes is allocated with malloc !!!! */
if (0 != (ptr->lasterror = send_pipecgi(ptr->socket,
hw_connection *ptr;
hw_document *docptr;
#if APACHE
- server_rec *serv = GLOBAL(php3_rqst)->server;
+ server_rec *serv = php3_rqst->server;
#endif
- TLS_VARS;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
WRONG_PARAM_COUNT;
pval *arg1;
int id, type;
hw_document *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
int id, type, count;
hw_document *ptr;
char *ptr1;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
int id, type, argc;
hw_document *ptr;
char *temp, *str = NULL;
- TLS_VARS;
argc = ARG_COUNT(ht);
if((argc > 2) || (argc < 1))
pval *argv[1];
int id, type, argc;
hw_document *ptr;
- TLS_VARS;
argc = ARG_COUNT(ht);
if(argc != 1)
pval *arg1;
int id, type;
hw_document *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
pval *arg1;
int id, type;
hw_document *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
int count;
char **childObjRecs = NULL;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
int link, id, type;
int count;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
int link, id, type;
int count;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
int count;
char **childObjRecs = NULL;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
int link, id, type;
int count;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
int count;
char **childObjRecs = NULL;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
pval *arg1, *arg2;
int link, id, type;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
pval *arg1, *arg2;
int link, id, type;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
int count, i;
int *childIDs = NULL;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
WRONG_PARAM_COUNT;
int count;
char **childObjRecs = NULL;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
WRONG_PARAM_COUNT;
int count, i;
hw_connection *ptr;
int *childIDs = NULL;
- TLS_VARS;
if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
WRONG_PARAM_COUNT;
int count;
hw_connection *ptr;
char **childObjRecs = NULL;
- TLS_VARS;
if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
WRONG_PARAM_COUNT;
int count, i;
int *childIDs = NULL;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
int count;
char **childObjRecs = NULL;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
int count, i;
int *anchorIDs = NULL;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
int count;
char **anchorObjRecs = NULL;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
pval *arg1;
int link, type;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
int link, type;
char *name, *passwd, *userdata;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
WRONG_PARAM_COUNT;
Returns object array of object record*/
void php3_hw_objrec2array(INTERNAL_FUNCTION_PARAMETERS) {
pval *arg1;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
void php3_hw_array2objrec(INTERNAL_FUNCTION_PARAMETERS) {
pval *arg1;
char *objrec, *retobj;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
int type, link, i;
hw_connection *ptr;
int cobjids, ccollids, *objectIDs, *collIDs, cretids, *retIDs, retcoll;
- TLS_VARS;
if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
WRONG_PARAM_COUNT;
char *objrec;
int id, newid, type, link;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
WRONG_PARAM_COUNT;
char *objrec, *text;
int id, newid, type, link, argc;
hw_connection *ptr;
- TLS_VARS;
argc = ARG_COUNT(ht);
if((argc < 3) || (argc > 4))
int count;
char **childObjRecs = NULL;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
int rootid, destid, sourceid;
char *anchorstr;
hw_connection *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
WRONG_PARAM_COUNT;
UDWORD crow;
UWORD RowStatus[1];
#endif
-#if !defined(COMPILE_DL) && defined(THREAD_SAFE)
- TLS_VARS;
-#endif
field_ind = -1;
field = NULL;
UDWORD crow;
UWORD RowStatus[1];
#endif
-#if !defined(COMPILE_DL) && defined(THREAD_SAFE)
- TLS_VARS
-#endif
numArgs = ARG_COUNT(ht);
if (numArgs == 1){
pval *string;
unsigned char *result;
int ret_length;
- TLS_VARS;
if (ARG_COUNT(ht)!=1 || getParameters(ht,1,&string) == FAILURE) {
WRONG_PARAM_COUNT;
pval *string;
unsigned char *result;
int ret_length;
- TLS_VARS;
if (ARG_COUNT(ht)!=1 || getParameters(ht,1,&string) == FAILURE) {
WRONG_PARAM_COUNT;
int php3_rinit_basic(INIT_FUNC_ARGS)
{
- TLS_VARS;
- GLOBAL(strtok_string) = NULL;
+ strtok_string = NULL;
#if HAVE_PUTENV
if (_php3_hash_init(&putenv_ht, 1, NULL, (void (*)(void *)) _php3_putenv_destructor, 0) == FAILURE) {
return FAILURE;
int php3_rshutdown_basic(SHUTDOWN_FUNC_ARGS)
{
- TLS_VARS;
- STR_FREE(GLOBAL(strtok_string));
+ STR_FREE(strtok_string);
#if HAVE_PUTENV
_php3_hash_destroy(&putenv_ht);
#endif
#endif
pval *str;
char *ptr;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
WRONG_PARAM_COUNT;
if (str->type == IS_STRING &&
#if APACHE
- ((ptr = (char *)table_get(GLOBAL(php3_rqst)->subprocess_env, str->value.str.val)) || (ptr = getenv(str->value.str.val)))
+ ((ptr = (char *)table_get(php3_rqst->subprocess_env, str->value.str.val)) || (ptr = getenv(str->value.str.val)))
#endif
#if CGI_BINARY
(ptr = getenv(str->value.str.val))
#endif
#if USE_SAPI
- (ptr = GLOBAL(sapi_rqst)->getenv(GLOBAL(sapi_rqst)->scid,str->value.str.val))
+ (ptr = sapi_rqst->getenv(sapi_rqst->scid,str->value.str.val))
#endif
#endif
) {
{
pval *str;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
WRONG_PARAM_COUNT;
#if 0
pval *value;
int ret;
- TLS_VARS;
ret = php3_ini.short_open_tag;
{
pval *array;
HashTable *target_hash;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *array;
HashTable *target_hash;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *array;
HashTable *target_hash;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *array;
HashTable *target_hash;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *array;
HashTable *target_hash;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
pval *array;
pval *old_compare_func;
HashTable *target_hash;
- TLS_VARS;
old_compare_func = user_compare_func_name;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &user_compare_func_name) == FAILURE) {
pval *array;
pval *old_compare_func;
HashTable *target_hash;
- TLS_VARS;
old_compare_func = user_compare_func_name;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &user_compare_func_name) == FAILURE) {
pval *array;
pval *old_compare_func;
HashTable *target_hash;
- TLS_VARS;
old_compare_func = user_compare_func_name;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &user_compare_func_name) == FAILURE) {
#endif
{
#if APACHE
- TLS_VARS;
# if MODULE_MAGIC_NUMBER > 19970110
- rflush(GLOBAL(php3_rqst));
+ rflush(php3_rqst);
# else
- bflush(GLOBAL(php3_rqst)->connection->client);
+ bflush(php3_rqst->connection->client);
# endif
#endif
#if FHTTPD
fflush(stdout);
#endif
#if USE_SAPI
- TLS_VARS;
- GLOBAL(sapi_rqst)->flush(GLOBAL(sapi_rqst)->scid);
+ sapi_rqst->flush(sapi_rqst->scid);
#endif
}
void php3_gettype(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *var, *type;
char *new_type;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &var, &type) ==
FAILURE) {
void php3_array_walk(INTERNAL_FUNCTION_PARAMETERS) {
pval *array, *old_walk_func_name;
HashTable *target_hash;
- TLS_VARS;
old_walk_func_name = php3_array_walk_func_name;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &php3_array_walk_func_name) == FAILURE) {
pval **argv;
int argc, i;
unsigned short max_type = IS_LONG;
- TLS_VARS;
argc = ARG_COUNT(ht);
/* if there is one parameter and this parameter is an array of
void php3_get_current_user(INTERNAL_FUNCTION_PARAMETERS)
{
- TLS_VARS;
-
RETURN_STRING(_php3_get_current_user(),1);
}
pval *string, *erropt = NULL, *option = NULL, *emailhead = NULL;
int opt_err = 0;
char *message, *opt=NULL, *headers=NULL;
- TLS_VARS;
switch(ARG_COUNT(ht)) {
case 1:
{
pval *browser_name;
regex_t r;
- TLS_VARS;
- if (GLOBAL(found_browser_entry)) { /* already found */
+ if (found_browser_entry) { /* already found */
return 0;
}
_php3_hash_find(browser->value.ht,"browser_name_pattern",sizeof("browser_name_pattern"),(void **) &browser_name);
if (regcomp(&r,browser_name->value.str.val,REG_NOSUB)!=0) {
return 0;
}
- if (regexec(&r,GLOBAL(lookup_browser_name),0,NULL,0)==0) {
- GLOBAL(found_browser_entry) = browser;
+ if (regexec(&r,lookup_browser_name,0,NULL,0)==0) {
+ found_browser_entry = browser;
}
regfree(&r);
return 0;
convert_to_string(agent_name);
- if (_php3_hash_find(&GLOBAL(browser_hash), agent_name->value.str.val, agent_name->value.str.len+1, (void **) &agent)==FAILURE) {
- GLOBAL(lookup_browser_name) = agent_name->value.str.val;
- GLOBAL(found_browser_entry) = NULL;
- _php3_hash_apply(&GLOBAL(browser_hash),(int (*)(void *)) browser_reg_compare);
+ if (_php3_hash_find(&browser_hash, agent_name->value.str.val, agent_name->value.str.len+1, (void **) &agent)==FAILURE) {
+ lookup_browser_name = agent_name->value.str.val;
+ found_browser_entry = NULL;
+ _php3_hash_apply(&browser_hash,(int (*)(void *)) browser_reg_compare);
- if (GLOBAL(found_browser_entry)) {
- agent = GLOBAL(found_browser_entry);
- } else if (_php3_hash_find(&GLOBAL(browser_hash), "Default Browser", sizeof("Default Browser"), (void **) &agent)==FAILURE) {
+ if (found_browser_entry) {
+ agent = found_browser_entry;
+ } else if (_php3_hash_find(&browser_hash, "Default Browser", sizeof("Default Browser"), (void **) &agent)==FAILURE) {
RETURN_FALSE;
}
}
return_value->value.ht->pDestructor = PVAL_DESTRUCTOR;
while (_php3_hash_find(agent->value.ht, "parent", sizeof("parent"), (void **) &agent_name)==SUCCESS) {
- if (_php3_hash_find(&GLOBAL(browser_hash), agent_name->value.str.val, agent_name->value.str.len+1, (void **) &agent)==FAILURE) {
+ if (_php3_hash_find(&browser_hash, agent_name->value.str.val, agent_name->value.str.len+1, (void **) &agent)==FAILURE) {
break;
}
_php3_hash_merge(return_value->value.ht,agent->value.ht,(void (*)(void *pData)) pval_copy_constructor, (void *) &tmp, sizeof(pval));
struct tm *ta;
int i, size = 0, length, h;
char tmp_buff[16];
- TLS_VARS;
switch(ARG_COUNT(ht)) {
case 1:
{
pval *month, *day, *year;
int m, d, y;
- TLS_VARS;
if (ARG_COUNT(ht) != 3 ||
getParameters(ht, 3, &month, &day, &year) == FAILURE) {
int php3_minit_dir(INIT_FUNC_ARGS)
{
- TLS_VARS;
-
- GLOBAL(le_dirp) = register_list_destructors(closedir,NULL);
+ le_dirp = register_list_destructors(closedir,NULL);
return SUCCESS;
}
pval *arg;
DIR *dirp;
int ret;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
php3_error(E_WARNING, "OpenDir: %s (errno %d)", strerror(errno),errno);
RETURN_FALSE;
}
- ret = php3_list_insert(dirp, GLOBAL(le_dirp));
- GLOBAL(dirp_id) = ret;
+ ret = php3_list_insert(dirp, le_dirp);
+ dirp_id = ret;
RETURN_LONG(ret);
}
/* }}} */
int id_to_find;
DIR *dirp;
int dirp_type;
- TLS_VARS;
if (ARG_COUNT(ht) == 0) {
if (getThis(&id) == SUCCESS) {
}
id_to_find = tmp->value.lval;
} else {
- id_to_find = GLOBAL(dirp_id);
+ id_to_find = dirp_id;
}
} else if ((ARG_COUNT(ht) != 1) || getParameters(ht, 1, &id) == FAILURE) {
WRONG_PARAM_COUNT;
}
dirp = (DIR *)php3_list_find(id_to_find, &dirp_type);
- if (!dirp || dirp_type != GLOBAL(le_dirp)) {
+ if (!dirp || dirp_type != le_dirp) {
php3_error(E_WARNING, "unable to find identifier (%d)", id_to_find);
RETURN_FALSE;
}
{
pval *arg;
int ret;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
int id_to_find;
DIR *dirp;
int dirp_type;
- TLS_VARS;
if (ARG_COUNT(ht) == 0) {
if (getThis(&id) == SUCCESS) {
}
id_to_find = tmp->value.lval;
} else {
- id_to_find = GLOBAL(dirp_id);
+ id_to_find = dirp_id;
}
} else if ((ARG_COUNT(ht) != 1) || getParameters(ht, 1, &id) == FAILURE) {
WRONG_PARAM_COUNT;
}
dirp = (DIR *)php3_list_find(id_to_find, &dirp_type);
- if (!dirp || dirp_type != GLOBAL(le_dirp)) {
+ if (!dirp || dirp_type != le_dirp) {
php3_error(E_WARNING, "unable to find identifier (%d)", id_to_find);
RETURN_FALSE;
}
DIR *dirp;
int dirp_type;
struct dirent *direntp;
- TLS_VARS;
if (ARG_COUNT(ht) == 0) {
if (getThis(&id) == SUCCESS) {
}
id_to_find = tmp->value.lval;
} else {
- id_to_find = GLOBAL(dirp_id);
+ id_to_find = dirp_id;
}
} else if ((ARG_COUNT(ht) != 1) || getParameters(ht, 1, &id) == FAILURE) {
WRONG_PARAM_COUNT;
}
dirp = (DIR *)php3_list_find(id_to_find, &dirp_type);
- if (!dirp || dirp_type != GLOBAL(le_dirp)) {
+ if (!dirp || dirp_type != le_dirp) {
php3_error(E_WARNING, "unable to find identifier (%d)", id_to_find);
RETURN_FALSE;
}
pval *arg;
DIR *dirp;
int ret;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
php3_error(E_WARNING, "OpenDir: %s (errno %d)", strerror(errno), errno);
RETURN_FALSE;
}
- ret = php3_list_insert(dirp, GLOBAL(le_dirp));
- GLOBAL(dirp_id) = ret;
+ ret = php3_list_insert(dirp, le_dirp);
+ dirp_id = ret;
/* construct an object with some methods */
object_init(return_value);
}
/* update the .request_started property... */
- if (_php3_hash_find(&GLOBAL(module_registry),module_entry->name,strlen(module_entry->name)+1,(void **) &tmp)==FAILURE) {
+ if (_php3_hash_find(&module_registry,module_entry->name,strlen(module_entry->name)+1,(void **) &tmp)==FAILURE) {
php3_error(E_ERROR,"%s: Loaded module got lost",module_entry->name);
RETURN_FALSE;
}
RETURN_TRUE;
}
-void php3_info_dl(void){
- TLS_VARS;
+
+void php3_info_dl(void)
+{
PUTS("Dynamic Library support enabled.\n");
}
void php3_gethostbyaddr(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
void php3_gethostbyname(INTERNAL_FUNCTION_PARAMETERS)
{
pval *arg;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
struct hostent *hp;
struct in_addr in;
int i;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
#define MAXPACKET 8192 /* max packet size used internally by BIND */
#endif
u_char ans[MAXPACKET];
- TLS_VARS;
switch (ARG_COUNT(ht)) {
case 1:
RETURN_FALSE;
}
need_weight = 1;
- pval_destructor(weight_list _INLINE_TLS); /* start with clean array */
+ pval_destructor(weight_list); /* start with clean array */
if ( array_init(weight_list) == FAILURE ) {
RETURN_FALSE;
}
}
convert_to_string( host );
- pval_destructor(mx_list _INLINE_TLS); /* start with clean array */
+ pval_destructor(mx_list); /* start with clean array */
if ( array_init(mx_list) == FAILURE ) {
RETURN_FALSE;
}
buf[0] = '\0';
if (type==2) {
if (array->type != IS_ARRAY) {
- pval_destructor(array _INLINE_TLS);
+ pval_destructor(array);
array_init(array);
}
}
if (output) PUTS(buf);
#if APACHE
# if MODULE_MAGIC_NUMBER > 19970110
- if (output) rflush(GLOBAL(php3_rqst));
+ if (output) rflush(php3_rqst);
# else
- if (output) bflush(GLOBAL(php3_rqst)->connection->client);
+ if (output) bflush(php3_rqst->connection->client);
# endif
#endif
#if CGI_BINARY
/* fhttpd doesn't flush */
#endif
#if USE_SAPI
- GLOBAL(sapi_rqst)->flush(GLOBAL(sapi_rqst)->scid);
+ sapi_rqst->flush(sapi_rqst->scid);
#endif
}
else if (type == 2) {
{
pval *arg1;
char *cmd;
- TLS_VARS;
if (getParameters(ht, 1, &arg1) == FAILURE) {
WRONG_PARAM_COUNT;
int issock=0;
int *sock, fd=0;
int act = 0;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
convert_to_long(arg2);
fp = php3_list_find(arg1->value.lval, &type);
- if (type == GLOBAL(wsa_fp)){
+ if (type == wsa_fp){
issock = 1;
sock = php3_list_find(arg1->value.lval, &type);
fd = *sock;
}
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!fd || type!=GLOBAL(wsa_fp))) {
+ if ((!fp || (type!=le_fp && type!=le_pp)) && (!fd || type!=wsa_fp)) {
php3_error(E_WARNING,"Unable to find file identifier %d",arg1->value.lval);
RETURN_FALSE;
}
static void __pclose(FILE *pipe)
{
- GLOBAL(pclose_ret) = pclose(pipe);
+ pclose_ret = pclose(pipe);
}
int php3_minit_file(INIT_FUNC_ARGS)
{
- GLOBAL(le_fp) = register_list_destructors(fclose,NULL);
- GLOBAL(le_pp) = register_list_destructors(__pclose,NULL);
- GLOBAL(wsa_fp) = register_list_destructors(_php3_closesocket,NULL);
- GLOBAL(le_uploads) = register_list_destructors(_php3_unlink_uploaded_file,NULL);
+ le_fp = register_list_destructors(fclose,NULL);
+ le_pp = register_list_destructors(__pclose,NULL);
+ wsa_fp = register_list_destructors(_php3_closesocket,NULL);
+ le_uploads = register_list_destructors(_php3_unlink_uploaded_file,NULL);
return SUCCESS;
}
efree(p);
RETURN_FALSE;
}
- GLOBAL(fgetss_state)=0;
+ fgetss_state=0;
if (issock) {
sock=emalloc(sizeof(int));
*sock=socketd;
- id = php3_list_insert(sock,GLOBAL(wsa_fp));
+ id = php3_list_insert(sock,wsa_fp);
} else {
- id = php3_list_insert(fp,GLOBAL(le_fp));
+ id = php3_list_insert(fp,le_fp);
}
efree(p);
RETURN_LONG(id);
convert_to_long(arg1);
id=arg1->value.lval;
fp = php3_list_find(id,&type);
- if (!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(wsa_fp))) {
+ if (!fp || (type!=le_fp && type!=wsa_fp)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
RETURN_FALSE;
}
}
- id = php3_list_insert(fp,GLOBAL(le_pp));
+ id = php3_list_insert(fp,le_pp);
efree(p);
RETURN_LONG(id);
}
id = arg1->value.lval;
fp = php3_list_find(id,&type);
- if (!fp || type!=GLOBAL(le_pp)) {
+ if (!fp || type!=le_pp) {
php3_error(E_WARNING,"Unable to find pipe identifier %d",id);
RETURN_FALSE;
}
php3_list_delete(id);
- RETURN_LONG(GLOBAL(pclose_ret));
+ RETURN_LONG(pclose_ret);
}
/* }}} */
convert_to_long(arg1);
id = arg1->value.lval;
fp = php3_list_find(id,&type);
- if (type==GLOBAL(wsa_fp)){
+ if (type==wsa_fp){
issock=1;
sock = php3_list_find(id,&type);
socketd=*sock;
}
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) {
+ if ((!fp || (type!=le_fp && type!=le_pp)) && (!socketd || type!=wsa_fp)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
/* we're at the eof if the file doesn't exist */
RETURN_TRUE;
block = arg2->value.lval;
sock = php3_list_find(id,&type);
- if (type!=GLOBAL(wsa_fp)) {
+ if (type!=wsa_fp) {
php3_error(E_WARNING,"%d is not a socket id",id);
RETURN_FALSE;
}
convert_to_long(timeout);
sock = php3_list_find(socket->value.lval, &type);
- if (type!=GLOBAL(wsa_fp)) {
+ if (type!=wsa_fp) {
php3_error(E_WARNING,"%d is not a socket id",socket->value.lval);
RETURN_FALSE;
}
len = arg2->value.lval;
fp = php3_list_find(id,&type);
- if (type==GLOBAL(wsa_fp)){
+ if (type==wsa_fp){
issock=1;
sock = php3_list_find(id,&type);
socketd=*sock;
}
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) {
+ if ((!fp || (type!=le_fp && type!=le_pp)) && (!socketd || type!=wsa_fp)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
id = arg1->value.lval;
fp = php3_list_find(id,&type);
- if (type==GLOBAL(wsa_fp)){
+ if (type==wsa_fp){
issock=1;
sock = php3_list_find(id,&type);
socketd = *sock;
}
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) {
+ if ((!fp || (type!=le_fp && type!=le_pp)) && (!socketd || type!=wsa_fp)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
len = bytes->value.lval;
fp = php3_list_find(id,&type);
- if (type==GLOBAL(wsa_fp)){
+ if (type==wsa_fp){
issock=1;
sock = php3_list_find(id,&type);
socketd=*sock;
}
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) {
+ if ((!fp || (type!=le_fp && type!=le_pp)) && (!socketd || type!=wsa_fp)) {
php3_error(E_WARNING, "Unable to find file identifier %d", id);
RETURN_FALSE;
}
while (c) {
switch (c) {
case '<':
- if (GLOBAL(fgetss_state) == 0) {
+ if (fgetss_state == 0) {
lc = '<';
- GLOBAL(fgetss_state) = 1;
+ fgetss_state = 1;
}
break;
case '(':
- if (GLOBAL(fgetss_state) == 2) {
+ if (fgetss_state == 2) {
if (lc != '\"') {
lc = '(';
br++;
}
- } else if (GLOBAL(fgetss_state) == 0) {
+ } else if (fgetss_state == 0) {
*(rp++) = c;
}
break;
case ')':
- if (GLOBAL(fgetss_state) == 2) {
+ if (fgetss_state == 2) {
if (lc != '\"') {
lc = ')';
br--;
}
- } else if (GLOBAL(fgetss_state) == 0) {
+ } else if (fgetss_state == 0) {
*(rp++) = c;
}
break;
case '>':
- if (GLOBAL(fgetss_state) == 1) {
+ if (fgetss_state == 1) {
lc = '>';
- GLOBAL(fgetss_state) = 0;
- } else if (GLOBAL(fgetss_state) == 2) {
+ fgetss_state = 0;
+ } else if (fgetss_state == 2) {
if (!br && lc != '\"') {
- GLOBAL(fgetss_state) = 0;
+ fgetss_state = 0;
}
}
break;
case '\"':
- if (GLOBAL(fgetss_state) == 2) {
+ if (fgetss_state == 2) {
if (lc == '\"') {
lc = '\0';
} else if (lc != '\\') {
lc = '\"';
}
- } else if (GLOBAL(fgetss_state) == 0) {
+ } else if (fgetss_state == 0) {
*(rp++) = c;
}
break;
case '?':
- if (GLOBAL(fgetss_state)==1) {
+ if (fgetss_state==1) {
br=0;
- GLOBAL(fgetss_state)=2;
+ fgetss_state=2;
break;
}
/* fall-through */
default:
- if (GLOBAL(fgetss_state) == 0) {
+ if (fgetss_state == 0) {
*(rp++) = c;
}
}
id = arg1->value.lval;
fp = php3_list_find(id,&type);
- if (type==GLOBAL(wsa_fp)){
+ if (type==wsa_fp){
issock=1;
sock = php3_list_find(id,&type);
socketd=*sock;
}
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) {
+ if ((!fp || (type!=le_fp && type!=le_pp)) && (!socketd || type!=wsa_fp)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
convert_to_long(arg1);
id = arg1->value.lval;
fp = php3_list_find(id,&type);
- if (!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) {
+ if (!fp || (type!=le_fp && type!=le_pp)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
convert_to_long(arg1);
id = arg1->value.lval;
fp = php3_list_find(id,&type);
- if (!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) {
+ if (!fp || (type!=le_fp && type!=le_pp)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
pos = arg2->value.lval;
id = arg1->value.lval;
fp = php3_list_find(id,&type);
- if (!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) {
+ if (!fp || (type!=le_fp && type!=le_pp)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
convert_to_long(arg1);
id = arg1->value.lval;
fp = php3_list_find(id,&type);
- if (type==GLOBAL(wsa_fp)){
+ if (type==wsa_fp){
issock=1;
sock = php3_list_find(id,&type);
socketd=*sock;
}
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) {
+ if ((!fp || (type!=le_fp && type!=le_pp)) && (!socketd || type!=wsa_fp)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
len = arg2->value.lval;
fp = php3_list_find(id,&type);
- if (type==GLOBAL(wsa_fp)){
+ if (type==wsa_fp){
issock=1;
sock = php3_list_find(id,&type);
socketd=*sock;
}
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) {
+ if ((!fp || (type!=le_fp && type!=le_pp)) && (!socketd || type!=wsa_fp)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
/* aparently needed for pdf to be compiled as a module under windows */
PHPAPI int php3i_get_le_fp(void)
{
- return GLOBAL(le_fp);
+ return le_fp;
}
/*
int php3_init_filestat(INIT_FUNC_ARGS)
{
- GLOBAL(CurrentStatFile)=NULL;
- GLOBAL(CurrentStatLength)=0;
+ CurrentStatFile=NULL;
+ CurrentStatLength=0;
return SUCCESS;
}
int php3_shutdown_filestat(SHUTDOWN_FUNC_ARGS)
{
- if (GLOBAL(CurrentStatFile)) {
- efree (GLOBAL(CurrentStatFile));
+ if (CurrentStatFile) {
+ efree (CurrentStatFile);
}
return SUCCESS;
}
void php3_clearstatcache(INTERNAL_FUNCTION_PARAMETERS)
{
- if (GLOBAL(CurrentStatFile)) {
- efree(GLOBAL(CurrentStatFile));
- GLOBAL(CurrentStatFile) = NULL;
+ if (CurrentStatFile) {
+ efree(CurrentStatFile);
+ CurrentStatFile = NULL;
}
}
static void _php3_stat(const char *filename, int type, pval *return_value)
{
- struct stat *stat_sb = &GLOBAL(sb);
-
- if (!GLOBAL(CurrentStatFile) || strcmp(filename,GLOBAL(CurrentStatFile))) {
- if (!GLOBAL(CurrentStatFile)
- || strlen(filename) > GLOBAL(CurrentStatLength)) {
- if (GLOBAL(CurrentStatFile)) efree(GLOBAL(CurrentStatFile));
- GLOBAL(CurrentStatLength) = strlen(filename);
- GLOBAL(CurrentStatFile) = estrndup(filename,GLOBAL(CurrentStatLength));
+ struct stat *stat_sb = &sb;
+
+ if (!CurrentStatFile || strcmp(filename,CurrentStatFile)) {
+ if (!CurrentStatFile
+ || strlen(filename) > CurrentStatLength) {
+ if (CurrentStatFile) efree(CurrentStatFile);
+ CurrentStatLength = strlen(filename);
+ CurrentStatFile = estrndup(filename,CurrentStatLength);
} else {
- strcpy(GLOBAL(CurrentStatFile),filename);
+ strcpy(CurrentStatFile,filename);
}
#if HAVE_SYMLINK
- GLOBAL(lsb).st_mode = 0; /* mark lstat buf invalid */
+ lsb.st_mode = 0; /* mark lstat buf invalid */
#endif
- if (stat(GLOBAL(CurrentStatFile),&GLOBAL(sb))==-1) {
+ if (stat(CurrentStatFile,&sb)==-1) {
if (type != 15 || errno != ENOENT) { /* fileexists() test must print no error */
- php3_error(E_NOTICE,"stat failed for %s (errno=%d - %s)",GLOBAL(CurrentStatFile),errno,strerror(errno));
+ php3_error(E_NOTICE,"stat failed for %s (errno=%d - %s)",CurrentStatFile,errno,strerror(errno));
}
- efree(GLOBAL(CurrentStatFile));
- GLOBAL(CurrentStatFile)=NULL;
+ efree(CurrentStatFile);
+ CurrentStatFile=NULL;
RETURN_FALSE;
}
}
/* do lstat if the buffer is empty */
- if (!GLOBAL(lsb).st_mode) {
- if (lstat(GLOBAL(CurrentStatFile),&GLOBAL(lsb)) == -1) {
- php3_error(E_NOTICE,"lstat failed for %s (errno=%d - %s)",GLOBAL(CurrentStatFile),errno,strerror(errno));
+ if (!lsb.st_mode) {
+ if (lstat(CurrentStatFile,&lsb) == -1) {
+ php3_error(E_NOTICE,"lstat failed for %s (errno=%d - %s)",CurrentStatFile,errno,strerror(errno));
RETURN_FALSE;
}
}
switch(type) {
case 0: /* fileperms */
- RETURN_LONG((long)GLOBAL(sb).st_mode);
+ RETURN_LONG((long)sb.st_mode);
case 1: /* fileinode */
- RETURN_LONG((long)GLOBAL(sb).st_ino);
+ RETURN_LONG((long)sb.st_ino);
case 2: /* filesize */
- RETURN_LONG((long)GLOBAL(sb).st_size);
+ RETURN_LONG((long)sb.st_size);
case 3: /* fileowner */
- RETURN_LONG((long)GLOBAL(sb).st_uid);
+ RETURN_LONG((long)sb.st_uid);
case 4: /* filegroup */
- RETURN_LONG((long)GLOBAL(sb).st_gid);
+ RETURN_LONG((long)sb.st_gid);
case 5: /* fileatime */
- RETURN_LONG((long)GLOBAL(sb).st_atime);
+ RETURN_LONG((long)sb.st_atime);
case 6: /* filemtime */
- RETURN_LONG((long)GLOBAL(sb).st_mtime);
+ RETURN_LONG((long)sb.st_mtime);
case 7: /* filectime */
- RETURN_LONG((long)GLOBAL(sb).st_ctime);
+ RETURN_LONG((long)sb.st_ctime);
case 8: /* filetype */
#if HAVE_SYMLINK
- if (S_ISLNK(GLOBAL(lsb).st_mode)) {
+ if (S_ISLNK(lsb.st_mode)) {
RETURN_STRING("link",1);
}
#endif
- switch(GLOBAL(sb).st_mode&S_IFMT) {
+ switch(sb.st_mode&S_IFMT) {
case S_IFIFO: RETURN_STRING("fifo",1);
case S_IFCHR: RETURN_STRING("char",1);
case S_IFDIR: RETURN_STRING("dir",1);
case S_IFBLK: RETURN_STRING("block",1);
case S_IFREG: RETURN_STRING("file",1);
}
- php3_error(E_WARNING,"Unknown file type (%d)",GLOBAL(sb).st_mode&S_IFMT);
+ php3_error(E_WARNING,"Unknown file type (%d)",sb.st_mode&S_IFMT);
RETURN_STRING("unknown",1);
case 9: /*is writable*/
- RETURN_LONG((GLOBAL(sb).st_mode&S_IWRITE)!=0);
+ RETURN_LONG((sb.st_mode&S_IWRITE)!=0);
case 10: /*is readable*/
- RETURN_LONG((GLOBAL(sb).st_mode&S_IREAD)!=0);
+ RETURN_LONG((sb.st_mode&S_IREAD)!=0);
case 11: /*is executable*/
- RETURN_LONG((GLOBAL(sb).st_mode&S_IEXEC)!=0 && !S_ISDIR(GLOBAL(sb).st_mode));
+ RETURN_LONG((sb.st_mode&S_IEXEC)!=0 && !S_ISDIR(sb.st_mode));
case 12: /*is file*/
- RETURN_LONG(S_ISREG(GLOBAL(sb).st_mode));
+ RETURN_LONG(S_ISREG(sb.st_mode));
case 13: /*is dir*/
- RETURN_LONG(S_ISDIR(GLOBAL(sb).st_mode));
+ RETURN_LONG(S_ISDIR(sb.st_mode));
case 14: /*is link*/
#if HAVE_SYMLINK
- RETURN_LONG(S_ISLNK(GLOBAL(lsb).st_mode));
+ RETURN_LONG(S_ISLNK(lsb.st_mode));
#else
RETURN_FALSE;
#endif
RETURN_TRUE; /* the false case was done earlier */
case 16: /* lstat */
#if HAVE_SYMLINK
- stat_sb = &GLOBAL(lsb);
+ stat_sb = &lsb;
#endif
/* FALLTHROUGH */
case 17: /* stat */
#ifndef THREAD_SAFE
static char cvt_buf[NDIG];
#endif
- TLS_VARS;
if (ndigits >= NDIG - 1)
ndigits = NDIG - 2;
r2 = 0;
*sign = 0;
- p = &STATIC(cvt_buf)[0];
+ p = &cvt_buf[0];
if (arg < 0) {
*sign = 1;
arg = -arg;
}
arg = modf(arg, &fi);
- p1 = &STATIC(cvt_buf)[NDIG];
+ p1 = &cvt_buf[NDIG];
/*
* Do integer part
*/
if (fi != 0) {
- p1 = &STATIC(cvt_buf)[NDIG];
+ p1 = &cvt_buf[NDIG];
while (fi != 0) {
fj = modf(fi / 10, &fi);
*--p1 = (int) ((fj + .03) * 10) + '0';
r2++;
}
- while (p1 < &STATIC(cvt_buf)[NDIG])
+ while (p1 < &cvt_buf[NDIG])
*p++ = *p1++;
} else if (arg > 0) {
while ((fj = arg * 10) < 1) {
r2--;
}
}
- p1 = &STATIC(cvt_buf)[ndigits];
+ p1 = &cvt_buf[ndigits];
if (eflag == 0)
p1 += r2;
*decpt = r2;
- if (p1 < &STATIC(cvt_buf)[0]) {
- STATIC(cvt_buf)[0] = '\0';
- return (STATIC(cvt_buf));
+ if (p1 < &cvt_buf[0]) {
+ cvt_buf[0] = '\0';
+ return (cvt_buf);
}
- while (p <= p1 && p < &STATIC(cvt_buf)[NDIG]) {
+ while (p <= p1 && p < &cvt_buf[NDIG]) {
arg *= 10;
arg = modf(arg, &fj);
*p++ = (int) fj + '0';
}
- if (p1 >= &STATIC(cvt_buf)[NDIG]) {
- STATIC(cvt_buf)[NDIG - 1] = '\0';
- return (STATIC(cvt_buf));
+ if (p1 >= &cvt_buf[NDIG]) {
+ cvt_buf[NDIG - 1] = '\0';
+ return (cvt_buf);
}
p = p1;
*p1 += 5;
while (*p1 > '9') {
*p1 = '0';
- if (p1 > STATIC(cvt_buf))
+ if (p1 > cvt_buf)
++ * --p1;
else {
*p1 = '1';
(*decpt)++;
if (eflag == 0) {
- if (p > STATIC(cvt_buf))
+ if (p > cvt_buf)
*p = '0';
p++;
}
}
}
*p = '\0';
- return (STATIC(cvt_buf));
+ return (cvt_buf);
}
{
char *result;
int len;
- TLS_VARS;
if ((result=php3_formatted_print(ht,&len))==NULL) {
RETURN_FALSE;
{
char *result;
int len;
- TLS_VARS;
if ((result=php3_formatted_print(ht,&len))==NULL) {
RETURN_FALSE;
int socketd = -1;
unsigned short portno;
char *key = NULL;
- TLS_VARS;
if (arg_count > 4 || arg_count < 2 || getParametersArray(ht,arg_count,args)==FAILURE) {
FREE_SOCK;
(void *) &sockp) == SUCCESS) {
efree(key);
*sock = *sockp;
- RETURN_LONG(php3_list_insert(sock, GLOBAL(wsa_fp)));
+ RETURN_LONG(php3_list_insert(sock, wsa_fp));
}
if (portno) {
key, strlen(key) + 1, NULL);
}
if(key) efree(key);
- id = php3_list_insert(sock,GLOBAL(wsa_fp));
+ id = php3_list_insert(sock,wsa_fp);
RETURN_LONG(id);
}
/* }}} */
int php3_init_head(INIT_FUNC_ARGS)
{
- TLS_VARS;
- GLOBAL(php3_HeaderPrinted) = 0;
- if (GLOBAL(header_called) == 0)
- GLOBAL(php3_PrintHeader) = 1;
- GLOBAL(top) = NULL;
- GLOBAL(cont_type) = NULL;
+ php3_HeaderPrinted = 0;
+ if (header_called == 0)
+ php3_PrintHeader = 1;
+ top = NULL;
+ cont_type = NULL;
return SUCCESS;
}
void php3_noheader(void)
{
- TLS_VARS;
- GLOBAL(php3_PrintHeader) = 0;
- GLOBAL(header_called) = 1;
+ php3_PrintHeader = 0;
+ header_called = 1;
}
char temp2[32];
#endif
- if (GLOBAL(php3_HeaderPrinted) == 1) {
+ if (php3_HeaderPrinted == 1) {
#if DEBUG
php3_error(E_WARNING, "Cannot add more header information - the header was already sent "
"(header information may be added only before any output is generated from the script - "
*r = '\0';
if (!strcasecmp(header_information, "Content-type")) {
if (*(r + 1) == ' ')
- GLOBAL(php3_rqst)->content_type = pstrdup(GLOBAL(php3_rqst)->pool,r + 2);
+ php3_rqst->content_type = pstrdup(php3_rqst->pool,r + 2);
else
- GLOBAL(php3_rqst)->content_type = pstrdup(GLOBAL(php3_rqst)->pool,r + 1);
- GLOBAL(cont_type) = (char *)GLOBAL(php3_rqst)->content_type;
+ php3_rqst->content_type = pstrdup(php3_rqst->pool,r + 1);
+ cont_type = (char *)php3_rqst->content_type;
} else {
if (*(r + 1) == ' ') {
rr = r + 2;
temp = _php3_regreplace("$", temp2, rr, 0, 0);
}
}
- table_set(GLOBAL(php3_rqst)->headers_out, header_information, temp);
+ table_set(php3_rqst->headers_out, header_information, temp);
} else
- table_set(GLOBAL(php3_rqst)->headers_out, header_information, rr);
+ table_set(php3_rqst->headers_out, header_information, rr);
}
if (!strcasecmp(header_information, "location")) {
- GLOBAL(php3_rqst)->status = REDIRECT;
+ php3_rqst->status = REDIRECT;
}
*r = ':';
- GLOBAL(php3_HeaderPrinted) = 2;
+ php3_HeaderPrinted = 2;
}
if (!strncasecmp(header_information, "http/", 5)) {
if (strlen(header_information) > 9) {
- GLOBAL(php3_rqst)->status = atoi(&((header_information)[9]));
+ php3_rqst->status = atoi(&((header_information)[9]));
}
/* Use a pstrdup here to get the memory straight from Apache's per-request pool to
* avoid having our own memory manager complain about this memory not being freed
* because it really shouldn't be freed until the end of the request and it isn't
* easy for us to figure out when we allocated it vs. when something else might have.
*/
- GLOBAL(php3_rqst)->status_line = pstrdup(GLOBAL(php3_rqst)->pool,&((header_information)[9]));
+ php3_rqst->status_line = pstrdup(php3_rqst->pool,&((header_information)[9]));
}
#else
r = strchr(header_information, ':');
if (r) {
*r = '\0';
if (!strcasecmp(header_information, "Content-type")) {
- if (GLOBAL(cont_type)) efree(GLOBAL(cont_type));
- GLOBAL(cont_type) = estrdup(r + 1);
+ if (cont_type) efree(cont_type);
+ cont_type = estrdup(r + 1);
#if 0 /*WIN32|WINNT / *M$ does us again*/
- if (!strcmp(GLOBAL(cont_type)," text/html")){
+ if (!strcmp(cont_type," text/html")){
*r=':';
PUTS_H(header_information);
PUTS_H("\015\012");
char *tempstr=emalloc(strlen(header_information)+2);
sprintf(tempstr,"%s\015\012",tempstr);
- GLOBAL(sapi_rqst)->header(GLOBAL(sapi_rqst)->scid,tempstr);
+ sapi_rqst->header(sapi_rqst->scid,tempstr);
efree(tempstr);
}
#elif FHTTPD
{
char *tempstr=emalloc(strlen(header_information)+2);
sprintf(tempstr,"%s\015\012",tempstr);
- GLOBAL(sapi_rqst)->header(GLOBAL(sapi_rqst)->scid,tempstr);
+ sapi_rqst->header(sapi_rqst->scid,tempstr);
efree(tempstr);
}
#elif FHTTPD
}
#if APACHE
- if (!GLOBAL(php3_rqst)) { /* we're not in a request, allow output */
+ if (!php3_rqst) { /* we're not in a request, allow output */
PG(header_is_being_sent) = 0;
return 1;
}
- if ((GLOBAL(php3_PrintHeader) && !GLOBAL(php3_HeaderPrinted)) || (GLOBAL(php3_PrintHeader) && GLOBAL(php3_HeaderPrinted) == 2)) {
+ if ((php3_PrintHeader && !php3_HeaderPrinted) || (php3_PrintHeader && php3_HeaderPrinted == 2)) {
cookie = php3_PopCookieList();
while (cookie) {
if (cookie->name)
if (cookie->secure) {
strcat(tempstr, "; secure");
}
- table_add(GLOBAL(php3_rqst)->headers_out, "Set-Cookie", tempstr);
+ table_add(php3_rqst->headers_out, "Set-Cookie", tempstr);
if (cookie->domain) efree(cookie->domain);
if (cookie->path) efree(cookie->path);
if (cookie->name) efree(cookie->name);
cookie = php3_PopCookieList();
efree(tempstr);
}
- GLOBAL(php3_HeaderPrinted) = 1;
- GLOBAL(header_called) = 1;
- send_http_header(GLOBAL(php3_rqst));
- if (GLOBAL(php3_rqst)->header_only) {
+ php3_HeaderPrinted = 1;
+ header_called = 1;
+ send_http_header(php3_rqst);
+ if (php3_rqst->header_only) {
set_header_request(1);
PG(header_is_being_sent) = 0;
return(0);
}
}
#else
- if (GLOBAL(php3_PrintHeader) && !GLOBAL(php3_HeaderPrinted)) {
- if (!GLOBAL(cont_type)) {
+ if (php3_PrintHeader && !php3_HeaderPrinted) {
+ if (!cont_type) {
#if USE_SAPI
- GLOBAL(sapi_rqst)->header(GLOBAL(sapi_rqst)->scid,"Content-type: text/html\015\012\015\012");
+ sapi_rqst->header(sapi_rqst->scid,"Content-type: text/html\015\012\015\012");
#elif FHTTPD
php3_fhttpd_puts_header("Content-type: text/html\r\n");
#else
#endif
} else {
#if 0 /*WIN32|WINNT / *M$ does us again*/
- if (!strcmp(GLOBAL(cont_type),"text/html")){
+ if (!strcmp(cont_type,"text/html")){
#endif
#if USE_SAPI
- tempstr=emalloc(strlen(GLOBAL(cont_type))+18);
- sprintf(tempstr,"Content-type: %s\015\012\015\012",GLOBAL(cont_type));
- GLOBAL(sapi_rqst)->header(GLOBAL(sapi_rqst)->scid,tempstr);
+ tempstr=emalloc(strlen(cont_type)+18);
+ sprintf(tempstr,"Content-type: %s\015\012\015\012",cont_type);
+ sapi_rqst->header(sapi_rqst->scid,tempstr);
efree(tempstr);
#elif FHTTPD
- tempstr = emalloc(strlen(GLOBAL(cont_type))
+ tempstr = emalloc(strlen(cont_type)
+ sizeof("Content-type:") + 2);
if(tempstr) {
strcpy(tempstr, "Content-type:");
strcpy(tempstr + sizeof("Content-type:") - 1,
- GLOBAL(cont_type));
+ cont_type);
strcat(tempstr, "\r\n");
php3_fhttpd_puts_header(tempstr);
efree(tempstr);
}
#else
PUTS_H("Content-type:");
- PUTS_H(GLOBAL(cont_type));
+ PUTS_H(cont_type);
PUTS_H("\015\012\015\012");
#endif
- efree(GLOBAL(cont_type));
+ efree(cont_type);
#if 0 /*WIN32|WINNT / *M$ does us again*/
} else {
PUTS_H("\015\012");
#endif
}
#if USE_SAPI
- GLOBAL(sapi_rqst)->flush(GLOBAL(sapi_rqst)->scid);
+ sapi_rqst->flush(sapi_rqst->scid);
#else
fflush(stdout);
#endif
- GLOBAL(php3_HeaderPrinted) = 1;
- GLOBAL(header_called) = 1;
+ php3_HeaderPrinted = 1;
+ header_called = 1;
}
#endif
PG(header_is_being_sent) = 0;
void php3_PushCookieList(char *name, char *value, time_t expires, char *path, char *domain, int secure)
{
CookieList *new;
- TLS_VARS;
new = emalloc(sizeof(CookieList));
- new->next = GLOBAL(top);
+ new->next = top;
new->name = name;
new->value = value;
new->expires = expires;
new->path = path;
new->domain = domain;
new->secure = secure;
- GLOBAL(top) = new;
+ top = new;
}
CookieList *php3_PopCookieList(void)
{
CookieList *ret;
- TLS_VARS;
- ret = GLOBAL(top);
- if (GLOBAL(top))
- GLOBAL(top) = GLOBAL(top)->next;
+ ret = top;
+ if (top)
+ top = top->next;
return (ret);
}
int secure = 0;
pval *arg[6];
int arg_count;
- TLS_VARS;
arg_count = ARG_COUNT(ht);
if (arg_count < 1 || arg_count > 6 || getParametersArray(ht, arg_count, arg) == FAILURE) {
WRONG_PARAM_COUNT;
}
- if (GLOBAL(php3_HeaderPrinted) == 1) {
+ if (php3_HeaderPrinted == 1) {
php3_error(E_WARNING, "Oops, php3_SetCookie called after header has been sent\n");
return;
}
{
char *tempstr2=emalloc(strlen(tempstr)+14);
sprintf(tempstr2,"Set-Cookie: %s\015\012",tempstr);
- GLOBAL(sapi_rqst)->header(GLOBAL(sapi_rqst)->scid,tempstr2);
+ sapi_rqst->header(sapi_rqst->scid,tempstr2);
efree(tempstr2);
}
#elif FHTTPD
int php3_headers_unsent(void)
{
- TLS_VARS;
- if (GLOBAL(php3_HeaderPrinted)!=1 || !GLOBAL(php3_PrintHeader)) {
+ if (php3_HeaderPrinted!=1 || !php3_PrintHeader) {
return 1;
} else {
return 0;
int i, len, maxlen;
unsigned char *old;
char *new;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
RETURN_FALSE;
}
- pval_destructor(info _INLINE_TLS);
+ pval_destructor(info);
if (array_init(info) == FAILURE) {
return;
}
PUTS("<img src=\"");
- /*PUTS(GLOBAL(php3_rqst)->uri);*/
+ /*PUTS(php3_rqst->uri);*/
PUTS("?=PHPE9568F34-D428-11d2-A769-00AA001ACF42\" border=\"0\" width=\"100\" height=\"56\" align=\"right\">\n");
php3_printf("<center><h1>PHP Version %s</h1></center>\n", PHP_VERSION);
PUTS("<p>by <a href=\"mailto:rasmus@lerdorf.on.ca\">Rasmus Lerdorf</a>,\n");
PUTS("HSREGEX=" PHP_HSREGEX "</td></tr>\n");
#endif
- _php3_hash_apply(&GLOBAL(module_registry),(int (*)(void *))_display_module_info);
+ _php3_hash_apply(&module_registry,(int (*)(void *))_display_module_info);
PUTS("</table>\n");
SECTION("Configuration");
PUTS("</table>");
#if USE_SAPI /* call a server module specific info function */
- GLOBAL(sapi_rqst)->info(GLOBAL(sapi_rqst));
+ sapi_rqst->info(sapi_rqst);
#endif
SECTION("Environment");
#if APACHE
{
register int i;
- array_header *arr = table_elts(GLOBAL(php3_rqst)->subprocess_env);
+ array_header *arr = table_elts(php3_rqst->subprocess_env);
table_entry *elts = (table_entry *)arr->elts;
SECTION("Apache Environment");
PUTS("<table border=5 width=\"600\">\n");
PUTS(" <tr><th colspan=2 bgcolor=\"" HEADER_COLOR "\">HTTP Request Headers</th></tr>\n");
PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">HTTP Request</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS(GLOBAL(php3_rqst)->the_request);
+ PUTS(php3_rqst->the_request);
PUTS(" </td></tr>\n");
- env_arr = table_elts(GLOBAL(php3_rqst)->headers_in);
+ env_arr = table_elts(php3_rqst->headers_in);
env = (table_entry *)env_arr->elts;
for (i = 0; i < env_arr->nelts; ++i) {
if (env[i].key) {
}
}
PUTS(" <tr><th colspan=2 bgcolor=\"" HEADER_COLOR "\">HTTP Response Headers</th></tr>\n");
- env_arr = table_elts(GLOBAL(php3_rqst)->headers_out);
+ env_arr = table_elts(php3_rqst->headers_out);
env = (table_entry *)env_arr->elts;
for(i = 0; i < env_arr->nelts; ++i) {
if (env[i].key) {
PUTS("<table width=\"100%%\"><tr>\n");
php3_printf("<td><h2>Zend</h2>This program makes use of the Zend scripting language engine:<br><pre>%s</pre></td>", get_zend_version());
PUTS("<td width=\"100\"><a href=\"http://www.zend.com/\"><img src=\"");
- /*PUTS(GLOBAL(php3_rqst)->uri);*/
+ /*PUTS(php3_rqst->uri);*/
PUTS("?=PHPE9568F35-D428-11d2-A769-00AA001ACF42\" border=\"0\" width=\"100\" height=\"89\"></a></td>\n");
PUTS("</tr></table>\n");
Output a page of useful information about PHP and the current request */
void php3_info(INTERNAL_FUNCTION_PARAMETERS)
{
- TLS_VARS;
-
_php3_info();
RETURN_TRUE;
}
Return the current PHP version */
void php3_version(INTERNAL_FUNCTION_PARAMETERS)
{
- TLS_VARS;
-
RETURN_STRING(PHP_VERSION,1);
}
/* }}} */
pval *argv[4];
char *to=NULL, *message=NULL, *headers=NULL, *subject=NULL;
int argc;
- TLS_VARS;
argc = ARG_COUNT(ht);
if (argc < 3 || argc > 4 || getParametersArray(ht, argc, argv) == FAILURE) {
Return the absolute value of the number */
void php3_abs(INTERNAL_FUNCTION_PARAMETERS) {
pval *value;
- TLS_VARS;
if (ARG_COUNT(ht)!=1||getParameters(ht,1,&value)==FAILURE) {
WRONG_PARAM_COUNT;
Returns the next highest integer value of the number */
void php3_ceil(INTERNAL_FUNCTION_PARAMETERS) {
pval *value;
- TLS_VARS;
if (ARG_COUNT(ht)!=1||getParameters(ht,1,&value)==FAILURE) {
WRONG_PARAM_COUNT;
Returns the next lowest integer value from the number */
void php3_floor(INTERNAL_FUNCTION_PARAMETERS) {
pval *value;
- TLS_VARS;
if (ARG_COUNT(ht)!=1||getParameters(ht,1,&value)==FAILURE) {
WRONG_PARAM_COUNT;
void php3_round(INTERNAL_FUNCTION_PARAMETERS)
{
pval *value;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &value) == FAILURE) {
WRONG_PARAM_COUNT;
void php3_pow(INTERNAL_FUNCTION_PARAMETERS)
{
pval *num1, *num2;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&num1,&num2) == FAILURE) {
WRONG_PARAM_COUNT;
void php3_deg2rad(INTERNAL_FUNCTION_PARAMETERS)
{
pval *deg;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, °) == FAILURE) {
WRONG_PARAM_COUNT;
void php3_rad2deg(INTERNAL_FUNCTION_PARAMETERS)
{
pval *rad;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &rad) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *arg;
long ret;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *arg;
long ret;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *arg;
long ret;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
unsigned char digest[16];
int i;
char *r;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
long sec = 0L;
double msec = 0.0;
char ret[100];
- TLS_VARS;
if (gettimeofday((struct timeval *) &tp, (NUL)) == 0) {
msec = (double) (tp.tv_usec / MICRO_IN_SEC);
}
bytes = fwrite(ptr, 1, loc - ptr - 4, fp);
fclose(fp);
- php3_list_insert(fn,GLOBAL(le_uploads)); /* Tell PHP about the file so the destructor can unlink it later */
+ php3_list_insert(fn,le_uploads); /* Tell PHP about the file so the destructor can unlink it later */
if (bytes < (loc - ptr - 4)) {
php3_error(E_WARNING, "Only %d bytes were written, expected to write %ld", bytes, loc - ptr - 4);
}
int formatcount = 0;
int outputpos = 0, outputsize = 0;
char *output;
- TLS_VARS;
argc = ARG_COUNT(ht);
int formatlen;
int inputpos, inputlen;
int i;
- TLS_VARS;
if ((ARG_COUNT(ht) != 2) || getParameters(ht, 2, &formatarg, &inputarg) == FAILURE) {
WRONG_PARAM_COUNT;
{
int machine_endian_check = 1;
int i;
- TLS_VARS;
machine_little_endian = ((char *)&machine_endian_check)[0];
char *path;
struct stat sb;
#endif
- TLS_VARS;
#if APACHE
/* Apache has already gone through the trouble of doing
values. We can afford it, and it means we don't have to
worry about resetting the static variables after every
hit. */
- GLOBAL(page_uid) = GLOBAL(php3_rqst)->finfo.st_uid;
- GLOBAL(page_inode) = GLOBAL(php3_rqst)->finfo.st_ino;
- GLOBAL(page_mtime) = GLOBAL(php3_rqst)->finfo.st_mtime;
+ page_uid = php3_rqst->finfo.st_uid;
+ page_inode = php3_rqst->finfo.st_ino;
+ page_mtime = php3_rqst->finfo.st_mtime;
#else
- if (GLOBAL(page_uid) == -1) {
- path = GLOBAL(request_info).filename;
+ if (page_uid == -1) {
+ path = request_info.filename;
if (path != NULL) {
if (stat(path, &sb) == -1) {
php3_error(E_WARNING, "Unable to find file: '%s'", path);
return;
}
- GLOBAL(page_uid) = sb.st_uid;
- GLOBAL(page_inode) = sb.st_ino;
- GLOBAL(page_mtime) = sb.st_mtime;
+ page_uid = sb.st_uid;
+ page_inode = sb.st_ino;
+ page_mtime = sb.st_mtime;
}
}
#endif
long _php3_getuid(void)
{
- TLS_VARS;
_php3_statpage();
- return (GLOBAL(page_uid));
+ return (page_uid);
}
/* {{{ proto int getmyuid(void)
void php3_getmyuid(INTERNAL_FUNCTION_PARAMETERS)
{
long uid;
- TLS_VARS;
uid = _php3_getuid();
if (uid < 0) {
void php3_getmypid(INTERNAL_FUNCTION_PARAMETERS)
{
int pid;
- TLS_VARS;
pid = getpid();
if (pid < 0) {
Get the inode of the current script being parsed */
void php3_getmyinode(INTERNAL_FUNCTION_PARAMETERS)
{
- TLS_VARS;
-
_php3_statpage();
- if (GLOBAL(page_inode) < 0) {
+ if (page_inode < 0) {
RETURN_FALSE;
} else {
- RETURN_LONG(GLOBAL(page_inode));
+ RETURN_LONG(page_inode);
}
}
/* }}} */
Get time of last page modification */
void php3_getlastmod(INTERNAL_FUNCTION_PARAMETERS)
{
- TLS_VARS;
-
_php3_statpage();
- if (GLOBAL(page_mtime) < 0) {
+ if (page_mtime < 0) {
RETURN_FALSE;
} else {
- RETURN_LONG(GLOBAL(page_mtime));
+ RETURN_LONG(page_mtime);
}
}
/* }}} */
int file_upload = 0;
char *mb;
char boundary[100];
- TLS_VARS;
- ctype = GLOBAL(request_info).content_type;
+ ctype = request_info.content_type;
if (!ctype) {
php3_error(E_WARNING, "POST Error: content-type missing");
return NULL;
return NULL;
}
}
- length = GLOBAL(request_info).content_length;
+ length = request_info.content_length;
cnt = length;
buf = (char *) emalloc((length + 1) * sizeof(char));
if (!buf) {
buf[length]=0;
#else
#if MODULE_MAGIC_NUMBER > 19961007
- if (should_client_block(GLOBAL(php3_rqst))) {
+ if (should_client_block(php3_rqst)) {
void (*handler) (int);
int dbsize, len_read, dbpos = 0;
- hard_timeout("copy script args", GLOBAL(php3_rqst)); /* start timeout timer */
+ hard_timeout("copy script args", php3_rqst); /* start timeout timer */
handler = signal(SIGPIPE, SIG_IGN); /* Ignore sigpipes for now */
- while ((len_read = get_client_block(GLOBAL(php3_rqst), argsbuffer, HUGE_STRING_LEN)) > 0) {
+ while ((len_read = get_client_block(php3_rqst, argsbuffer, HUGE_STRING_LEN)) > 0) {
if ((dbpos + len_read) > length)
dbsize = length - dbpos;
else
dbsize = len_read;
- reset_timeout(GLOBAL(php3_rqst)); /* Make sure we don't timeout */
+ reset_timeout(php3_rqst); /* Make sure we don't timeout */
memcpy(buf + dbpos, argsbuffer, dbsize);
dbpos += dbsize;
}
signal(SIGPIPE, handler); /* restore normal sigpipe handling */
- kill_timeout(GLOBAL(php3_rqst)); /* stop timeout timer */
+ kill_timeout(php3_rqst); /* stop timeout timer */
}
#else
cnt = 0;
bytes = fread(buf + cnt, 1, length - cnt, stdin);
#endif
#if USE_SAPI
- bytes = GLOBAL(sapi_rqst)->readclient(GLOBAL(sapi_rqst)->scid,buf + cnt, 1, length - cnt);
+ bytes = sapi_rqst->readclient(sapi_rqst->scid,buf + cnt, 1, length - cnt);
#endif
cnt += bytes;
} while (bytes && cnt < length);
postdata_ptr->value.str.len = cnt;
postdata_ptr->refcount=1;
postdata_ptr->is_ref=0;
- _php3_hash_add(&GLOBAL(symbol_table), "HTTP_FDF_DATA", sizeof("HTTP_FDF_DATA"), postdata_ptr, sizeof(pval *),NULL);
+ _php3_hash_add(&symbol_table, "HTTP_FDF_DATA", sizeof("HTTP_FDF_DATA"), postdata_ptr, sizeof(pval *),NULL);
}
#endif
return (buf);
if (arg == PARSE_POST) {
res = php3_getpost(array_ptr PLS_CC);
} else if (arg == PARSE_GET) { /* Get data */
- var = GLOBAL(request_info).query_string;
+ var = request_info.query_string;
if (var && *var) {
res = (char *) estrdup(var);
}
} else if (arg == PARSE_COOKIE) { /* Cookie data */
- var = (char *)GLOBAL(request_info).cookies;
+ var = (char *)request_info.cookies;
if (var && *var) {
res = (char *) estrdup(var);
}
char *escaped_str;
PLS_FETCH();
- if (GLOBAL(php3_rqst)->headers_in)
- s = table_get(GLOBAL(php3_rqst)->headers_in, "Authorization");
+ if (php3_rqst->headers_in)
+ s = table_get(php3_rqst->headers_in, "Authorization");
if (!s)
return;
/* Check to make sure that this URL isn't authenticated
using a traditional auth module mechanism */
- if (auth_type(GLOBAL(php3_rqst))) {
+ if (auth_type(php3_rqst)) {
/*php3_error(E_WARNING, "Authentication done by server module\n");*/
return;
}
- if (strcmp(t=getword(GLOBAL(php3_rqst)->pool, &s, ' '), "Basic")) {
+ if (strcmp(t=getword(php3_rqst->pool, &s, ' '), "Basic")) {
/* Client tried to authenticate using wrong auth scheme */
php3_error(E_WARNING, "client used wrong authentication scheme (%s)", t);
return;
}
- t = uudecode(GLOBAL(php3_rqst)->pool, s);
+ t = uudecode(php3_rqst->pool, s);
#if MODULE_MAGIC_NUMBER > 19961007
- user = getword_nulls_nc(GLOBAL(php3_rqst)->pool, &t, ':');
+ user = getword_nulls_nc(php3_rqst->pool, &t, ':');
#else
- user = getword(GLOBAL(php3_rqst)->pool, &t, ':');
+ user = getword(php3_rqst->pool, &t, ':');
#endif
type = "Basic";
off_t start, end;
char *buf = NULL;
char *string = NULL;
- TLS_VARS;
if (icase)
copts |= REG_ICASE;
RETURN_FALSE;
}
- pval_destructor(array _INLINE_TLS); /* start with clean array */
+ pval_destructor(array); /* start with clean array */
array_init(array);
for (i = 0; i < NS; i++) {
char *string;
char *replace;
char *ret;
- TLS_VARS;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg_pattern, &arg_replace, &arg_string) == FAILURE) {
WRONG_PARAM_COUNT;
regmatch_t subs[1];
char *strp, *endp;
int err, size, count;
- TLS_VARS;
switch (ARG_COUNT(ht)) {
case 2:
void php3_strlen(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *str;
register int i;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *str;
register int i;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *str;
register int i;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *arg1, *arg2, *delim, *tmp, *arr;
int len = 0, count = 0;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
char *token = NULL, *tokp=NULL;
char *first = NULL;
int argc;
- TLS_VARS;
argc = ARG_COUNT(ht);
if (argc == 2) {
convert_to_string(str);
- STR_FREE(GLOBAL(strtok_string));
- GLOBAL(strtok_string) = estrndup(str->value.str.val,str->value.str.len);
- STATIC(strtok_pos1) = GLOBAL(strtok_string);
- STATIC(strtok_pos2) = NULL;
+ STR_FREE(strtok_string);
+ strtok_string = estrndup(str->value.str.val,str->value.str.len);
+ strtok_pos1 = strtok_string;
+ strtok_pos2 = NULL;
}
- if (STATIC(strtok_pos1) && *STATIC(strtok_pos1)) {
+ if (strtok_pos1 && *strtok_pos1) {
for ( /* NOP */ ; token && *token; token++) {
- STATIC(strtok_pos2) = strchr(STATIC(strtok_pos1), (int) *token);
- if (!first || (STATIC(strtok_pos2) && STATIC(strtok_pos2) < first)) {
- first = STATIC(strtok_pos2);
+ strtok_pos2 = strchr(strtok_pos1, (int) *token);
+ if (!first || (strtok_pos2 && strtok_pos2 < first)) {
+ first = strtok_pos2;
}
} /* NB: token is unusable now */
- STATIC(strtok_pos2) = first;
- if (STATIC(strtok_pos2)) {
- *STATIC(strtok_pos2) = '\0';
+ strtok_pos2 = first;
+ if (strtok_pos2) {
+ *strtok_pos2 = '\0';
}
- RETVAL_STRING(STATIC(strtok_pos1),1);
+ RETVAL_STRING(strtok_pos1,1);
#if 0
/* skip 'token' white space for next call to strtok */
- while (STATIC(strtok_pos2) &&
- strchr(tokp, *(STATIC(strtok_pos2)+1))) {
- STATIC(strtok_pos2)++;
+ while (strtok_pos2 &&
+ strchr(tokp, *(strtok_pos2+1))) {
+ strtok_pos2++;
}
#endif
- if (STATIC(strtok_pos2))
- STATIC(strtok_pos1) = STATIC(strtok_pos2) + 1;
+ if (strtok_pos2)
+ strtok_pos1 = strtok_pos2 + 1;
else
- STATIC(strtok_pos1) = NULL;
+ strtok_pos1 = NULL;
} else {
RETVAL_FALSE;
}
{
pval *arg;
char *ret;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg)) {
WRONG_PARAM_COUNT;
{
pval *str;
char *ret;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str)) {
WRONG_PARAM_COUNT;
{
pval *str;
char *ret, *c;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str)) {
WRONG_PARAM_COUNT;
{
pval *str;
char *ret;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str)) {
WRONG_PARAM_COUNT;
{
pval *haystack, *needle;
char *found = NULL;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &haystack, &needle) ==
FAILURE) {
{
pval *haystack, *needle;
char *found = NULL;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &haystack, &needle) ==
FAILURE) {
pval *haystack, *needle, *OFFSET;
int offset = 0;
char *found = NULL;
- TLS_VARS;
switch(ARG_COUNT(ht)) {
case 2:
{
pval *haystack, *needle;
char *found = NULL;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &haystack, &needle) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *haystack, *needle;
char *found = NULL;
- TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &haystack, &needle) ==
FAILURE) {
char *end = "\r\n";
int endlen = 2;
int chunklen = 76;
- TLS_VARS;
argc = ARG_COUNT(ht);
pval *string, *from, *len;
int argc, l;
int f;
- TLS_VARS;
argc = ARG_COUNT(ht);
char *str, *old;
char *p, *q;
char c;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
void php3_ord(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *num;
char temp[2];
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
WRONG_PARAM_COUNT;
unsigned char xlat[256];
unsigned char *str_from, *str_to, *string;
int i, len1, len2;
- TLS_VARS;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &str, &from, &to) ==
FAILURE) {
void php3_stripslashes(INTERNAL_FUNCTION_PARAMETERS)
{
pval *str;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
WRONG_PARAM_COUNT;
#endif
if ((unsigned int)errnum < sys_nerr) return(sys_errlist[errnum]);
- (void)sprintf(STATIC(str_ebuf), "Unknown error: %d", errnum);
- return(STATIC(str_ebuf));
+ (void)sprintf(str_ebuf, "Unknown error: %d", errnum);
+ return(str_ebuf);
}
#endif
#endif
{
#ifdef HAVE_GETTIMEOFDAY
pval *prefix;
-
char uniqid[128];
int sec, usec;
struct timeval tv;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&prefix)==FAILURE) {
WRONG_PARAM_COUNT;
{
pval *string;
url *resource;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &string) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *arg;
char *str;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *arg;
int len;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *arg;
char *str;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
{
pval *arg;
int len;
- TLS_VARS;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
}
}
-void fhttpd_flush( /*GLOBAL(php3_rqst)->connection */ void)
+void fhttpd_flush( /*php3_rqst->connection */ void)
{
}
#include "php_globals.h"
int php3_request_startup(CLS_D ELS_DC PLS_DC);
-extern void php3_request_shutdown(void *dummy INLINE_TLS);
+extern void php3_request_shutdown(void *dummy);
extern void php3_request_shutdown_for_exec(void *dummy);
extern int php3_module_startup();
extern void php3_module_shutdown();
}
#if WIN32|WINNT
{
- if (GLOBAL(php3_ini_path)) {
- default_location = GLOBAL(php3_ini_path);
+ if (php3_ini_path) {
+ default_location = php3_ini_path;
} else {
default_location = (char *) malloc(512);
}
}
#else
- if (!GLOBAL(php3_ini_path)) {
+ if (!php3_ini_path) {
default_location = CONFIGURATION_FILE_PATH;
} else {
- default_location = GLOBAL(php3_ini_path);
+ default_location = php3_ini_path;
}
#endif
/* build a path */
php_ini_path = (char *) malloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1);
- if (!GLOBAL(php3_ini_path)) {
+ if (!php3_ini_path) {
#if WIN32|WINNT
sprintf(php_ini_path,".;%s;%s",env_location,default_location);
#else
char *browscap = INI_STR("browscap");
if (browscap) {
- if (_php3_hash_init(&GLOBAL(browser_hash), 0, NULL, (void (*)(void *))pvalue_browscap_destructor, 1)==FAILURE) {
+ if (_php3_hash_init(&browser_hash, 0, NULL, (void (*)(void *))pvalue_browscap_destructor, 1)==FAILURE) {
return FAILURE;
}
return FAILURE;
}
init_cfg_scanner();
- active__php3_hash_table = &GLOBAL(browser_hash);
+ active__php3_hash_table = &browser_hash;
parsing_mode = PARSING_MODE_BROWSCAP;
currently_parsed_filename = browscap;
yyparse();
int php3_mshutdown_browscap(SHUTDOWN_FUNC_ARGS)
{
if (INI_STR("browscap")) {
- _php3_hash_destroy(&GLOBAL(browser_hash));
+ _php3_hash_destroy(&browser_hash);
}
return SUCCESS;
}
/* Special case basedir==".": Use script-directory */
if ((strcmp(PG(open_basedir), ".") == 0) &&
- GLOBAL(request_info).filename &&
- *GLOBAL(request_info).filename
+ request_info.filename &&
+ *request_info.filename
) {
- strcpy(local_open_basedir, GLOBAL(request_info).filename);
+ strcpy(local_open_basedir, request_info.filename);
local_open_basedir_pos = strlen(local_open_basedir) - 1;
/* Strip filename */
int l;
PLS_FETCH();
- fn = GLOBAL(request_info).filename;
- path_info = GLOBAL(request_info).path_info;
+ fn = request_info.filename;
+ path_info = request_info.path_info;
#if HAVE_PWD_H
if (PG(user_dir) && *PG(user_dir)
&& path_info && '/' == path_info[0] && '~' == path_info[1]) {
strcat(fn, PG(user_dir)); /* safe */
strcat(fn, "/"); /* safe */
strcat(fn, s + 1); /* safe (shorter than path_info) */
- STR_FREE(GLOBAL(request_info).filename);
- GLOBAL(request_info).filename = fn;
+ STR_FREE(request_info.filename);
+ request_info.filename = fn;
}
}
}
if ('/' == path_info[0])
l--;
strcpy(fn + l, path_info);
- STR_FREE(GLOBAL(request_info).filename);
- GLOBAL(request_info).filename = fn;
+ STR_FREE(request_info.filename);
+ request_info.filename = fn;
}
} /* if doc_root && path_info */
if (!fn) {
php3_destroy_request_info assumes that it will get
freed when the include_names hash is emptied, but
we're not adding it in this case */
- STR_FREE(GLOBAL(request_info).filename);
- GLOBAL(request_info).filename = NULL;
+ STR_FREE(request_info.filename);
+ request_info.filename = NULL;
return NULL;
}
fp = fopen(fn, "r");
}
if (!fp) {
php3_error(E_CORE_ERROR, "Unable to open %s", fn);
- STR_FREE(GLOBAL(request_info).filename); /* for same reason as above */
+ STR_FREE(request_info.filename); /* for same reason as above */
return NULL;
}
#include "php_ini.h"
#include "php_globals.h"
#include "main.h"
-#include "control_structures.h"
#include "fopen-wrappers.h"
#include "ext/standard/php3_standard.h"
#include "snprintf.h"
void _php3_build_argv(char * ELS_DC);
static void php3_timeout(int dummy);
-static void php3_set_timeout(long seconds INLINE_TLS);
+static void php3_set_timeout(long seconds);
void *gLock; /*mutex variable */
#if APACHE
void php3_apache_puts(const char *s)
{
- TLS_VARS;
-
- if (GLOBAL(php3_rqst)) {
- rputs(s, GLOBAL(php3_rqst));
+ if (php3_rqst) {
+ rputs(s, php3_rqst);
} else {
fputs(s, stdout);
}
void php3_apache_putc(char c)
{
- TLS_VARS;
-
- if (GLOBAL(php3_rqst)) {
- rputc(c, GLOBAL(php3_rqst));
+ if (php3_rqst) {
+ rputc(c, php3_rqst);
} else {
fputc(c, stdout);
}
}
/* Otherwise fall back to the default logging location. */
#if APACHE
- if (GLOBAL(php3_rqst)) {
+ if (php3_rqst) {
#if MODULE_MAGIC_NUMBER >= 19970831
aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, php3_rqst->server, log_message);
#else
#define SIGPROF 27
#endif
-static void php3_set_timeout(long seconds INLINE_TLS)
+static void php3_set_timeout(long seconds)
{
#if WIN32|WINNT
if (seconds > 0) {
- GLOBAL(timerstart) = (unsigned int) clock();
- GLOBAL(wintimer) = GLOBAL(timerstart) + (CLOCKS_PER_SEC * seconds);
+ timerstart = (unsigned int) clock();
+ wintimer = timerstart + (CLOCKS_PER_SEC * seconds);
} else {
- GLOBAL(wintimer) = 0;
+ wintimer = 0;
}
#else
#if HAVE_SETITIMER
}
-static void php3_unset_timeout(INLINE_TLS_VOID)
+static void php3_unset_timeout()
{
#if WIN32|WINNT
- GLOBAL(wintimer) = 0;
+ wintimer = 0;
#else
#if HAVE_SETITIMER
struct itimerval no_timeout;
should work fine. Is this FIXME a WIN32 problem? Is
there no way to do per-thread timers on WIN32?
*/
- php3_unset_timeout(_INLINE_TLS_VOID);
- php3_set_timeout(new_timeout->value.lval _INLINE_TLS);
+ php3_unset_timeout();
+ php3_set_timeout(new_timeout->value.lval);
}
snprintf(memory_leak_buf,512,"Possible PHP4 memory leak detected (harmless): 0x%0.8lX, %d bytes from %s:%d", (long) t, t->size, t->filename, t->lineno);
# if MODULE_MAGIC_NUMBER >= 19970831
- aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, GLOBAL(php3_rqst)->server, memory_leak_buf);
+ aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, php3_rqst->server, memory_leak_buf);
# else
- log_error(memory_leak_buf,GLOBAL(php3_rqst)->server);
+ log_error(memory_leak_buf,php3_rqst->server);
# endif
# else
php3_printf("Freeing 0x%0.8X (%d bytes), allocated in %s on line %d<br>\n",(void *)((char *)t+sizeof(mem_header)+PLATFORM_PADDING),t->size,t->filename,t->lineno);
{
zend_output_startup();
- php3_set_timeout(PG(max_execution_time) _INLINE_TLS);
+ php3_set_timeout(PG(max_execution_time));
#if APACHE
/*
* memory.
*/
block_alarms();
- register_cleanup(GLOBAL(php3_rqst)->pool, NULL, php3_request_shutdown, php3_request_shutdown_for_exec);
+ register_cleanup(php3_rqst->pool, NULL, php3_request_shutdown, php3_request_shutdown_for_exec);
unblock_alarms();
#endif
void php3_request_shutdown_for_exec(void *dummy)
{
- TLS_VARS;
-
/* used to close fd's in the 3..255 range here, but it's problematic
*/
shutdown_memory_manager(1, 1);
}
-void php3_request_shutdown(void *dummy INLINE_TLS)
+void php3_request_shutdown(void *dummy)
{
#if FHTTPD
char tmpline[128];
php3_destroy_request_info(NULL);
shutdown_memory_manager(0, 0);
php3_error(E_WARNING, "Unknown resources in request shutdown function");
- php3_unset_timeout(_INLINE_TLS_VOID);
+ php3_unset_timeout();
#if CGI_BINARY
fflush(stdout);
- if(GLOBAL(request_info).php_argv0) {
- free(GLOBAL(request_info).php_argv0);
- GLOBAL(request_info).php_argv0 = NULL;
+ if(request_info.php_argv0) {
+ free(request_info.php_argv0);
+ request_info.php_argv0 = NULL;
}
#endif
#if FHTTPD
req = NULL;
#endif
#if USE_SAPI
- GLOBAL(sapi_rqst)->flush(GLOBAL(sapi_rqst)->scid);
+ sapi_rqst->flush(sapi_rqst->scid);
#endif
}
return SUCCESS;
}
-static void php3_config_ini_shutdown(INLINE_TLS_VOID)
+static void php3_config_ini_shutdown()
{
php3_shutdown_config();
}
CLS_FETCH();
ELS_FETCH();
+ if (!module_initialized) {
+ return;
+ }
#if !USE_SAPI
/* close down the ini config */
- php3_config_ini_shutdown(_INLINE_TLS_VOID);
+ php3_config_ini_shutdown();
#endif
#if (WIN32|WINNT) && !(USE_SAPI)
WSACleanup();
#endif
- if (GLOBAL(module_initialized)) {
- php3_error(E_WARNING, "Unknown resource in module shutdown");
- }
#if CGI_BINARY
fflush(stdout);
#endif
#if 0 /* SAPI */
- GLOBAL(sapi_rqst)->flush(GLOBAL(sapi_rqst)->scid);
+ sapi_rqst->flush(sapi_rqst->scid);
#endif
zend_shutdown();
switch(*p++) {
case 'p':
case 'P':
- if (!_gpc_flags[0] && php3_headers_unsent() && GLOBAL(request_info).request_method && !strcasecmp(GLOBAL(request_info).request_method, "post")) {
+ if (!_gpc_flags[0] && php3_headers_unsent() && request_info.request_method && !strcasecmp(request_info.request_method, "post")) {
php3_treat_data(PARSE_POST, NULL); /* POST Data */
_gpc_flags[0]=1;
}
{
pval **tmp_ptr;
register int i;
- array_header *arr = table_elts(GLOBAL(php3_rqst)->subprocess_env);
+ array_header *arr = table_elts(php3_rqst->subprocess_env);
table_entry *elts = (table_entry *) arr->elts;
int len;
_php3_hash_update(&EG(symbol_table), "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), tmp_ptr, sizeof(pval *), NULL);
}
tmp = (pval *) emalloc(sizeof(pval));
- tmp->value.str.len = strlen(GLOBAL(php3_rqst)->uri);
- tmp->value.str.val = estrndup(GLOBAL(php3_rqst)->uri, tmp->value.str.len);
+ tmp->value.str.len = strlen(php3_rqst->uri);
+ tmp->value.str.val = estrndup(php3_rqst->uri, tmp->value.str.len);
tmp->refcount=1;
tmp->is_ref=0;
tmp->type = IS_STRING;
/* Build the special-case PHP_SELF variable for the CGI version */
char *pi;
#if FORCE_CGI_REDIRECT
- pi = GLOBAL(request_info).path_info;
+ pi = request_info.path_info;
tmp = (pval *) emalloc(sizeof(pval));
tmp->value.str.val = emalloc(((pi)?strlen(pi):0) + 1);
tmp->value.str.len = _php3_sprintf(tmp->value.str.val, "%s", (pi ? pi : "")); /* SAFE */
#else
int l = 0;
char *sn;
- sn = GLOBAL(request_info).script_name;
- pi = GLOBAL(request_info).path_info;
+ sn = request_info.script_name;
+ pi = request_info.path_info;
if (sn)
l += strlen(sn);
if (pi)
/* need argc/argv support as well */
- _php3_build_argv(GLOBAL(request_info).query_string ELS_CC);
+ _php3_build_argv(request_info.query_string ELS_CC);
return SUCCESS;
}
|| getenv("REQUEST_METHOD")) {
cgi = 1;
if (argc > 1)
- GLOBAL(request_info).php_argv0 = strdup(argv[1]);
- else GLOBAL(request_info).php_argv0 = NULL;
+ request_info.php_argv0 = strdup(argv[1]);
+ else request_info.php_argv0 = NULL;
#if FORCE_CGI_REDIRECT
if (!getenv("REDIRECT_STATUS")) {
PUTS("<b>Security Alert!</b> PHP CGI cannot be accessed directly.\n\
CG(extended_info) = 0;
if (!cgi) { /* never execute the arguments if you are a CGI */
- GLOBAL(request_info).php_argv0 = NULL;
+ request_info.php_argv0 = NULL;
while ((c = getopt(argc, argv, "c:qvisnaeh?vf:")) != -1) {
switch (c) {
case 'f':
behavior=PHP_MODE_INDENT;
break;
case 'c':
- GLOBAL(php3_ini_path) = strdup(optarg); /* intentional leak */
+ php3_ini_path = strdup(optarg); /* intentional leak */
break;
case 'a':
#if SUPPORT_INTERACTIVE
file_handle.type = ZEND_HANDLE_FP;
file_handle.handle.fp = stdin;
if (_cgi_filename) {
- GLOBAL(request_info).filename = _cgi_filename;
+ request_info.filename = _cgi_filename;
}
php3_TreatHeaders();
if (!cgi) {
- if (!GLOBAL(request_info).query_string) {
+ if (!request_info.query_string) {
for (i = optind, len = 0; i < argc; i++)
len += strlen(argv[i]) + 1;
if (i < (argc - 1))
strcat(s, "+");
}
- GLOBAL(request_info).query_string = s;
+ request_info.query_string = s;
}
- if (!GLOBAL(request_info).filename && argc > optind)
- GLOBAL(request_info).filename = argv[optind];
+ if (!request_info.filename && argc > optind)
+ request_info.filename = argv[optind];
}
/* If for some reason the CGI interface is not setting the
PATH_TRANSLATED correctly, request_info.filename is NULL.
or user_dir configuration directives, PATH_INFO is used to construct
the filename as a side effect of php3_fopen_for_parser.
*/
- if (cgi || GLOBAL(request_info).filename) {
- file_handle.filename = GLOBAL(request_info).filename;
+ if (cgi || request_info.filename) {
+ file_handle.filename = request_info.filename;
file_handle.handle.fp = php3_fopen_for_parser();
}
}
}
#endif
- php3_request_shutdown((void *) 0 _INLINE_TLS);
- php3_module_shutdown(_INLINE_TLS_VOID);
+ php3_request_shutdown((void *) 0);
+ php3_module_shutdown();
return FAILURE;
} else if (file_handle.handle.fp && file_handle.handle.fp!=stdin) {
/* #!php support */
}
php3_header(); /* Make sure headers have been sent */
- php3_request_shutdown((void *) 0 _INLINE_TLS);
- php3_module_shutdown(_INLINE_TLS_VOID);
+ php3_request_shutdown((void *) 0);
+ php3_module_shutdown();
return SUCCESS;
}
#endif /* CGI_BINARY */
php_core_globals *core_globals=&pcg;
#endif
- GLOBAL(php3_rqst) = r;
+ php3_rqst = r;
if (php3_request_startup(CLS_C ELS_CC PLS_CC) == FAILURE) {
return FAILURE;
}
#endif /* APACHE */
-#if FHTTPD
-
-char *get_pretokenized_name(void)
-{
- char *pretokenized_name = NULL;
-
- if (GLOBAL(request_info).filename) {
- int length = strlen(GLOBAL(request_info).filename);
-
- if (length > (sizeof(".php3") - 1) && !strcmp(GLOBAL(request_info).filename + length - sizeof(".php3") + 1, ".php3")) {
- pretokenized_name = (char *) emalloc(length + 2);
- strcpy(pretokenized_name, GLOBAL(request_info).filename);
- strcat(pretokenized_name, "p");
- } else {
- length += sizeof(".php3p");
- pretokenized_name = (char *) emalloc(length + 1);
- strcpy(pretokenized_name, GLOBAL(request_info).filename);
- strcat(pretokenized_name, ".php3p");
- }
- } else {
- pretokenized_name = estrdup("stdin.php3p");
- }
- return pretokenized_name;
-}
-
-
-void _php3_usage(char *progname)
-{
- fprintf(stderr,
- "Usage: %s [options] [appname] [username] [hostname] [portname]\n"
- "Options:\n"
- " -d Daemon mode -- never attempt terminal I/O\n"
- " -s Socket mode, fhttpd internal use only\n"
- " -p Pipe mode, fhttpd internal use only\n"
- " -u<mask> Set umask\n"
- " -t<time> Idle timeout in seconds, 0 - disable\n"
- " -S Display colour syntax highlighted source\n"
- " -P Make and execute a pretokenized script\n"
- " (.php3p file) or, if pretokenized script, newer\n"
- " than original file exists, execute it instead\n"
- " -E Execute a pretokenized (.php3p) script\n"
- " -c<path> Look for php3.ini file in this directory\n"
- " (must appear before any other options)\n"
- " -v Version number\n"
- " -h This help\n",
- progname);
-}
-
-int main(int argc, char **argv)
-{
- int c, i, processing_error;
- FILE *in = NULL;
- FILE *in2;
- int preprocess_mode = PREPROCESS_NONE;
- int argc1;
- char **argv1;
- int human = 1, fd2;
- int i0 = 0, i1 = 0;
- char *pn;
- struct stat statbuf, pstatbuf;
-#ifdef ZTS
- zend_compiler_globals cg;
- zend_executor_globals eg;
- zend_compiler_globals *compiler_globals=&cg;
- zend_executor_globals *executor_globals=⪚
-#endif
-
-#ifdef THREAD_SAFE
- php3_globals_struct *php3_globals;
- flex_globals *php_flex_gbl;
- tls_startup();
- tls_create();
- php_flex_gbl = yy_init_tls();
- php3_globals = TlsGetValue(TlsIndex);
-
- if ((php3_globals == 0) && (GetLastError() != 0)) {
- PUTS("TlsGetValue error\n");
- return FAILURE;
- }
-#endif
-
-#if HAVE_SETLOCALE
- setlocale(LC_CTYPE, "");
-#endif
-
- if (php3_module_startup() == FAILURE) {
- return FAILURE;
- }
- signal(SIGPIPE, SIG_IGN);
- umask(077);
-
- while ((c = getopt(argc, argv, "spdu:t:c:PESvh")) != -1) {
- switch (c) {
- case 'd':
- human = 0;
- break;
- case 's':
- i0 = 1;
- break;
- case 'p':
- i1 = 1;
- break;
- case 'u':
- if (*optarg == '0')
- umask(strtoul(optarg, NULL, 8));
- else
- umask(strtoul(optarg, NULL, 10));
- break;
- case 't':
- idle_timeout = atoi(optarg);
- break;
- case 'c':
- GLOBAL(php3_ini_path) = strdup(optarg); /* intentional leak */
- break;
- case 'P': /* preprocess */
- preprocess_mode = PREPROCESS_PREPROCESS;
- break;
- case 'E': /* execute preprocessed script */
- preprocess_mode = PREPROCESS_EXECUTE;
- break;
- case 'S':
- printf ("Not implemented yet\n");
- break;
- case 'v':
- printf("%s\n", PHP_VERSION);
- exit(1);
- break;
- case 'h':
- case ':':
- case '?':
- _php3_usage(argv[0]);
- return -1;
- }
- }
-
- argc1 = argc - optind;
- argv1 = (char **) malloc(sizeof(char *) * (argc1 + 2));
- if (!argv1)
- return -1;
- argv1 += 2;
- for (i = optind; i < argc; i++)
- argv1[i - optind] = argv[i];
-
- if (i0) {
- argv1--;
- *argv1 = "-s";
- argc1++;
- } else {
- if (i1) {
- argv1--;
- *argv1 = "-p";
- argc1++;
- }
- }
- argv1--;
- argc1++;
- *argv1 = *argv;
-
- server = createserver();
- if (!server)
- return -1;
-
- switch (servproc_init(server, human, argc1, argv1)) {
- case 0:
- break;
- case APP_ERR_HUMAN:
- _php3_usage(argv[0]);
- exit(1);
- break;
- case APP_ERR_CONFIG:
- fprintf(stderr, "%s: configuration error\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_READ:
- fprintf(stderr, "%s: read error\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_HOSTNAME:
- fprintf(stderr, "%s: can't resolve server hostname\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_SOCKET:
- fprintf(stderr, "%s: can't create socket\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_CONNECT:
- fprintf(stderr, "%s: can't connect\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_APPCONNECT:
- fprintf(stderr, "%s: connect error\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_USER:
- fprintf(stderr, "%s: login error\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_PASSWORD:
- fprintf(stderr, "%s: login error\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_APPLICATION:
- fprintf(stderr, "%s: application rejected by server\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_INSANE:
- case APP_ERR_DAEMON:
- case APP_ERR_AUTH:
- default:
- if (server->infd < 0)
- exit(1);
- }
-
- if (server->infd == 0 && server->outfd == 1) {
- close(2);
- fd2 = open("/dev/null", O_WRONLY);
- if (fd2 != 2) {
- dup2(fd2, 2);
- close(fd2);
- }
- }
- setcapabilities(server, APP_CAP_KEEPALIVE);
-
- exit_status = 0;
- while (!exit_status) {
- processing_error = 0;
- if (php3_request_startup(_INLINE_TLS_VOID) == FAILURE) {
- processing_error = 1;
- }
- if (!processing_error) {
- GLOBAL(phpin) = NULL;
- GLOBAL(current_lineno) = 0;
-
- php3_TreatHeaders();
-
- in = php3_fopen_for_parser();
-
- GLOBAL(php3_preprocess) = preprocess_mode;
-
- if (!in) {
- PUTS("No input file specified.\n");
- php3_request_shutdown((void *) 0 _INLINE_TLS);
- processing_error = 1;
- } else {
- if (GLOBAL(php3_preprocess) == PREPROCESS_PREPROCESS) {
- pn = get_pretokenized_name();
- if (pn) {
- if (!stat(pn, &pstatbuf)
- && !fstat(fileno(in), &statbuf)
- && S_ISREG(pstatbuf.st_mode)
- && statbuf.st_mtime < pstatbuf.st_mtime) {
- in2 = fopen(pn, "r");
- if (in2) {
- fclose(in);
- in = in2;
- GLOBAL(php3_preprocess) = PREPROCESS_EXECUTE;
- }
- }
- efree(pn);
- }
- }
- if (GLOBAL(php3_preprocess) != PREPROCESS_EXECUTE) {
- /* #!php support */
- c = fgetc(in);
- if (c == '#') {
- while (c != 10 && c != 13) {
- c = fgetc(in); /* skip to end of line */
- }
- CG(phplineno)++;
- } else {
- rewind(in);
- }
- }
- GLOBAL(phpin) = in;
- phprestart(GLOBAL(phpin));
-
- if (!processing_error) {
- if (GLOBAL(php3_preprocess) == PREPROCESS_EXECUTE) {
- if (tcm_load(&GLOBAL(token_cache_manager), GLOBAL(phpin))==FAILURE) {
- /* should bail out on an error, don't know how to do it in fhttpd */
- }
- GLOBAL(php3_preprocess) = PREPROCESS_NONE;
- }
- if (GLOBAL(php3_preprocess)!=PREPROCESS_NONE) {
- pval yylval;
-
- while (phplex(&yylval)); /* create the token cache */
- tcm_save(&GLOBAL(token_cache_manager));
- seek_token(&GLOBAL(token_cache_manager), 0, NULL);
- GLOBAL(php3_preprocess) = PREPROCESS_NONE;
- }
- php3_parse(GLOBAL(phpin) CLS_CC ELS_CC);
-
- }
- }
- }
- php3_header(); /* Make sure headers have been sent */
- php3_request_shutdown((void *) 0 _INLINE_TLS);
- }
- php3_module_shutdown(_INLINE_TLS_VOID);
-#ifdef THREAD_SAFE
- yy_destroy_tls();
- tls_shutdown();
- tls_destroy();
-#endif
- return 0;
-}
-#endif /* FHTTPD */
-
-#if USE_SAPI
-
-PHPAPI int php3_sapi_main(struct sapi_request_info *sapi_info)
-{
-#if DEBUG
- char logmessage[1024];
-#endif
- FILE *in = NULL;
- int c;
- YY_TLS_VARS;
- TLS_VARS;
-
- GLOBAL(php3_preprocess) = sapi_info->preprocess;
- GLOBAL(php3_display_source) = sapi_info->display_source_mode;
- GLOBAL(sapi_rqst) = sapi_info;
-
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: entry\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
-
-/* if (php3_module_startup(php3_globals) == FAILURE) {
- return FAILURE;
- }*/
-
- if (php3_request_startup(CLS_C ELS_CC PLS_CC) == FAILURE) {
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: request starup failed\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- return FAILURE;
- }
- if (sapi_info->preprocess == PREPROCESS_PREPROCESS || sapi_info->quiet_mode) {
- php3_noheader();
- }
- if (sapi_info->info_only) {
- _php3_info();
- php3_request_shutdown((void *) GLOBAL(sapi_rqst), php3_globals);
- /*php3_module_shutdown(php3_globals);*/
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: info_only\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- return (1);
- }
- /* if its not cgi, require that we have a filename now */
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: File: %s\n",GLOBAL(sapi_rqst)->scid,GLOBAL(sapi_rqst)->filename);
- OutputDebugString(logmessage);
-#endif
- if (!sapi_info->cgi && !sapi_info->filename) {
- php3_printf("No input file specified.\n");
- php3_request_shutdown((void *) GLOBAL(sapi_rqst), php3_globals);
- /*php3_module_shutdown(php3_globals);*/
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: No input file specified\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- return FAILURE;
- }
- /*
- if request_info.filename is null and cgi, fopen_for_parser is responsible
- request_info.filename will only be estrduped in fopen_for parser
- if it is null at this point
- */
- in = php3_fopen_for_parser();
-
- if (sapi_info->cgi && !in) {
- php3_printf("No input file specified for cgi.\n");
- php3_request_shutdown((void *) GLOBAL(sapi_rqst), php3_globals);
- /*php3_module_shutdown(php3_globals);*/
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: No input file specified for cgi.\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- return FAILURE;
- }
- if (sapi_info->cgi && in) {
- /* #!php support */
- c = fgetc(in);
- if (c == '#') {
- while (c != 10 && c != 13) {
- c = fgetc(in); /* skip to end of line */
- }
- } else {
- rewind(in);
- }
- }
- if (in) {
- GLOBAL(phpin) = in;
- phprestart(GLOBAL(phpin));
- }
- if (sapi_info->display_source_mode) {
- GLOBAL(php3_display_source) = 1;
- PUTS("<html><head><title>Source for ");
- PUTS(sapi_info->filename);
- PUTS("</title></head><body bgcolor=\"");
- PUTS(php3_ini.highlight_bg);
- PUTS("\" text=\"");
- PUTS(php3_ini.highlight_html);
- PUTS("\">\n"); /* color: seashell */
- }
- if (sapi_info->display_source_mode && sapi_info->preprocess == PREPROCESS_PREPROCESS) {
- php3_printf("Can't preprocess while displaying source.<br>\n");
- return FAILURE;
- }
- if (sapi_info->preprocess == PREPROCESS_EXECUTE) {
- tcm_load(&GLOBAL(token_cache_manager));
- GLOBAL(php3_preprocess) = PREPROCESS_NONE;
- }
- if (sapi_info->preprocess==PREPROCESS_NONE) {
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: start php3_parse() file:%s\n",GLOBAL(sapi_rqst)->scid,GLOBAL(sapi_rqst)->filename);
- OutputDebugString(logmessage);
-#endif
- php3_parse(GLOBAL(phpin) _INLINE_TLS);
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: done php3_parse()\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- } else {
- pval yylval;
-
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: entering phplex()\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
-#ifdef THREAD_SAFE
- while (phplex(&yylval, php3_globals, php_gbl)); /* create the token cache */
-#else
- while (phplex(&yylval)); /* create the token cache */
-#endif
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: done phplex()\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- tcm_save(&GLOBAL(token_cache_manager));
- }
-
- if (sapi_info->display_source_mode) {
- php3_printf("\n</html>\n");
- }
- if (GLOBAL(initialized)) {
- php3_header(); /* Make sure headers have been sent */
- php3_request_shutdown((void *) GLOBAL(sapi_rqst), php3_globals);
- /*php3_module_shutdown(php3_globals);*/
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: success!\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- return SUCCESS;
- } else {
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: request not initialized!\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- return FAILURE;
- }
-}
-#if WIN32|WINNT
-extern int tls_create(void);
-extern int tls_destroy(void);
-extern int tls_startup(void);
-extern int tls_shutdown(void);
-extern flex_globals *yy_init_tls(void);
-extern void yy_destroy_tls(void);
-extern VOID ErrorExit(LPTSTR lpszMessage);
-
-BOOL WINAPI DllMain(HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved)
-{
- php3_globals_struct *php3_globals;
-#if DEBUG
- OutputDebugString("PHP_Core DllMain Entry\n");
-#endif
- switch (ul_reason_for_call) {
- case DLL_PROCESS_ATTACH:
- /*
- I should be loading ini vars here
- and doing whatever true global inits
- need to be done
- */
- _fmode = _O_BINARY; /*sets default for file streams to binary */
- /* make the stdio mode be binary */
- setmode(_fileno(stdin), O_BINARY);
- setmode(_fileno(stdout), O_BINARY);
- setmode(_fileno(stderr), O_BINARY);
- setlocale(LC_CTYPE, "");
-
- CREATE_MUTEX(gLock, "GENERAL");
-
- if (!tls_startup())
- return 0;
- if (!tls_create())
- return 0;
- php3_globals = TlsGetValue(TlsIndex);
- yy_init_tls();
- if (php3_config_ini_startup(_INLINE_TLS_VOID) == FAILURE) {
- return 0;
- }
- if (php3_module_startup() == FAILURE) {
- ErrorExit("module startup failed");
- return 0;
- }
-
-#if DEBUG
- OutputDebugString("PHP_Core DllMain Process Attached\n");
-#endif
- break;
- case DLL_THREAD_ATTACH:
-#if DEBUG
- OutputDebugString("PHP_Core DllMain Thread Attach\n");
-#endif
- if (!tls_create())
- return 0;
- php3_globals = TlsGetValue(TlsIndex);
- yy_init_tls();
- if (php3_module_startup() == FAILURE) {
- ErrorExit("module startup failed");
-#if DEBUG
- OutputDebugString("PHP_Core DllMain module startup failed\n");
-#endif
- return 0;
- }
- break;
- case DLL_THREAD_DETACH:
-#if DEBUG
- OutputDebugString("PHP_Core DllMain Detache\n");
-#endif
- php3_globals = TlsGetValue(TlsIndex);
- php3_module_shutdown(php3_globals);
- if (!tls_destroy())
-#if DEBUG
- OutputDebugString("PHP_Core DllMain Detache Error tls_destroy\n");
-#endif
- return 0;
- yy_destroy_tls();
- break;
- case DLL_PROCESS_DETACH:
- /*
- close down anything down in process_attach
- */
- php3_globals = TlsGetValue(TlsIndex);
- php3_module_shutdown(php3_globals);
-
- php3_config_ini_shutdown(_INLINE_TLS_VOID);
-
- if (!tls_destroy())
-#if DEBUG
- OutputDebugString("PHP_Core DllMain tls_destroy failed\n");
-#endif
- return 0;
- if (!tls_shutdown())
-#if DEBUG
- OutputDebugString("PHP_Core DllMain tls_shutdown failed\n");
-#endif
- return 0;
- yy_destroy_tls();
-#if DEBUG
- OutputDebugString("PHP_Core DllMain Process Detatched\n");
-#endif
- break;
- }
-#if DEBUG
- OutputDebugString("PHP_Core DllMain Successful Exit\n");
-#endif
- return 1;
-}
-
-#endif
-#endif
/*
* Local variables:
* tab-width: 4
# endif
#endif
-/*Thread Safety*/
-#if THREAD_SAFE
-#define GLOBAL(a) php3_globals->a
-#define STATIC GLOBAL
-#define TLS_VARS \
- php3_globals_struct *php3_globals; \
- php3_globals = TlsGetValue(TlsIndex);
-#define CREATE_MUTEX(a,b) a = CreateMutex (NULL, FALSE, b);
-#define SET_MUTEX(a) WaitForSingleObject( a, INFINITE );
-#define FREE_MUTEX(a) ReleaseMutex(a);
-
-/*redirect variables to the flex structure*/
-#if !defined(YY_BUFFER_NEW) && !defined(COMPILE_DL)
-#include "FlexSafe.h"
-#endif
-
-#define INLINE_TLS ,struct php3_global_struct *php3_globals
-#define INLINE_TLS_VOID struct php3_global_struct *php3_globals
-#define _INLINE_TLS ,php3_globals
-#define _INLINE_TLS_VOID php3_globals
-
-#else
-#define GLOBAL(a) a
-#define STATIC GLOBAL
-#define TLS_VARS
#define CREATE_MUTEX(a,b)
#define SET_MUTEX(a)
#define FREE_MUTEX(a)
-/* needed in control structures */
-#define INLINE_TLS
-#define INLINE_TLS_VOID void
-#define _INLINE_TLS
-#define _INLINE_TLS_VOID
-
-#endif
-
/*
* Then the ODBC support can use both iodbc and Solid,
* uncomment this.
#endif
struct passwd *pwd;
int uid;
- TLS_VARS;
- if (GLOBAL(request_info).current_user) {
- return GLOBAL(request_info).current_user;
+ if (request_info.current_user) {
+ return request_info.current_user;
}
/* FIXME: I need to have this somehow handled if
USE_SAPI is defined, because cgi will also be
interfaced in USE_SAPI */
#if CGI_BINARY || USE_SAPI || FHTTPD
- if (!GLOBAL(request_info).filename || (stat(GLOBAL(request_info).filename,&statbuf)==-1)) {
+ if (!request_info.filename || (stat(request_info.filename,&statbuf)==-1)) {
return empty_string;
}
uid = statbuf.st_uid;
#endif
#if APACHE
- uid = GLOBAL(php3_rqst)->finfo.st_uid;
+ uid = php3_rqst->finfo.st_uid;
#endif
if ((pwd=getpwuid(uid))==NULL) {
return empty_string;
}
- GLOBAL(request_info).current_user_length = strlen(pwd->pw_name);
- GLOBAL(request_info).current_user = estrndup(pwd->pw_name,GLOBAL(request_info).current_user_length);
+ request_info.current_user_length = strlen(pwd->pw_name);
+ request_info.current_user = estrndup(pwd->pw_name,request_info.current_user_length);
- return GLOBAL(request_info).current_user;
+ return request_info.current_user;
}
module MODULE_VAR_EXPORT php3_module;
-#ifndef THREAD_SAFE
int saved_umask;
-#else
-#define GLOBAL(a) php3_globals->a
-#define STATIC GLOBAL
-#define TLS_VARS \
- php3_globals_struct *php3_globals; \
- php3_globals = TlsGetValue(TlsIndex);
-#endif
-#ifndef TLS_VARS
-#define TLS_VARS
-#endif
-
-#ifndef GLOBAL
-#define GLOBAL(x) x
-#endif
#if WIN32|WINNT
/* popenf isn't working on Windows, use open instead*/
void php3_save_umask()
{
- TLS_VARS;
- GLOBAL(saved_umask) = umask(077);
- umask(GLOBAL(saved_umask));
+ saved_umask = umask(077);
+ umask(saved_umask);
}
void php3_restore_umask()
{
- TLS_VARS;
- umask(GLOBAL(saved_umask));
+ umask(saved_umask);
}
int send_php3(request_rec *r, int display_source_mode, char *filename)
static int zend_apache_ub_write(const char *str, uint str_length)
{
- if (GLOBAL(php3_rqst)) {
- return rwrite(str, str_length, GLOBAL(php3_rqst));
+ if (php3_rqst) {
+ return rwrite(str, str_length, php3_rqst);
} else {
return fwrite(str, 1, str_length, stdout);
}
+++ /dev/null
-#include <stdio.h>
-#include "alloc.h"
-#include <errno.h>
-#if (WIN32|WINNT)
-#include <windows.h>
-#else
-#include <pthread.h>
-#endif
-#include "php3_threads.h"
-
-/* Function for allocating memory for mutexes */
-static void *php3_mutex_alloc( void )
-{
- MUTEX_T *mutexp;
- /* Allocate memory for the mutex and initialize it */
- if ( (mutexp = emalloc( sizeof(MUTEX_T) )) != NULL ) {
- MUTEX_INIT( mutexp, NULL );
- }
- return( mutexp );
-}
-
-/* Function for freeing mutexes */
-static void php3_mutex_free( void *mutexp )
-{
- MUTEX_DESTROY( (MUTEX_T *) mutexp );
-}
-
-static void php3_mutex_lock( void *mutexp )
-{
- return MUTEX_LOCK(mutexp);
-}
-
-static void php3_mutex_unlock( void *mutexp )
-{
- return MUTEX_UNLOCK(mutexp);
-}
-
-/* Function for setting up thread-specific data */
-/* should be called at thread start */
-int php3_tls_init(void *key,void *tsd,int size)
-{
- /* Check if thread-specific data already exists */
- tsd = TLS_GET_DATA( key );
- if ( tsd != NULL ) {
- /*FIXME what kind of output here? */
- fprintf( stderr, "php3_tls_setup tls var non-null!\n" );
- THREAD_EXIT( NULL );
- }
- /* Allocate memory for the LDAP error values */
- tsd = (void *) ecalloc( 1, size );
- /* Make the data specific to the calling thread */
- TLS_SET_DATA( key, tsd );
-}
-
-/*should be called before thread exit*/
-int php3_tls_free(void *key, void *tsd)
-{
- if (tsd)efree(tsd);
-}
-
-/*should be called at dl or process startup*/
-int php3_tls_startup(void *key)
-{
- if (key == NULL){
- if (TLS_ALLOC(key)==TLS_NOT_ALLOCED)
- return 0;
- }
- return 1;
-}
-
-/*should be called before dl or process exit*/
-int php3_tls_shutdown(void *key)
-{
- if (key != NULL){
- if (!TLS_FREE(key))
- return 0;
- }
- return 1;
-}
\ No newline at end of file
+++ /dev/null
-
-#if WIN32|WINNT
-#define MUTEX_T void
-#define MUTEX_INIT(a,b) (a=CreateMutex(b,FALSE,NULL))
-#define MUTEX_DESTROY(a) CloseHandle(a)
-#define MUTEX_LOCK(a) WaitForSingleObject(a,INFINITE)
-#define MUTEX_UNLOCK(a) ReleaseMutex(a)
-#define TLS_ALLOC(a) (a=TlsAlloc())
-#define TLS_NOT_ALLOCED 0xFFFFFFFF
-#define TLS_GET_DATA(a) TlsGetValue(a)
-#define TLS_SET_DATA(a,b) TlsSetValue(a,b)
-#define TLS_FREE(a) TlsFree(a)
-#else /*PTHREADS*/
-#define MUTEX_T pthread_mutex_t
-#define MUTEX_INIT(a,b) pthread_mutex_init(a,b)
-#define MUTEX_DESTROY(a) pthread_mutex_destroy(a)
-#define MUTEX_LOCK(a) pthread_mutex_lock(a)
-#define MUTEX_UNLOCK(a) pthread_mutex_unlock(a)
-#define TLS_ALLOC(a)
-#define TLS_NOT_ALLOCED NULL
-#define TLS_GET_DATA(a) pthread_getspecific(a)
-#define TLS_SET_DATA(a,b) pthread_setspecific(a,b)
-#define TLS_FREE(a)
-#endif
-
-extern static void *php3_mutex_alloc( void );
-extern static void php3_mutex_free( void *mutexp );
-extern static void php3_mutex_lock( void *mutexp );
-extern static void php3_mutex_unlock( void *mutexp );
-extern int php3_tls_init(void *key,void *tsd,int size);
-extern int php3_tls_free(void *key, void *tsd);
-extern int php3_tls_startup(void *key);
-extern int php3_tls_shutdown(void *key);
# End Source File
# Begin Source File
-SOURCE=.\control_structures.h
-# End Source File
-# Begin Source File
-
SOURCE=.\ext\standard\cyr_convert.h
# End Source File
# Begin Source File
# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\control_structures.h\r
-# End Source File\r
-# Begin Source File\r
-\r
SOURCE=.\ext\standard\cyr_convert.h\r
# End Source File\r
# Begin Source File\r
int php3_init_request_info(void *conf)
{
char *buf; /* temporary buffers */
- TLS_VARS;
-
- GLOBAL(request_info).path_info = getenv("PATH_INFO");
- GLOBAL(request_info).path_translated = getenv("PATH_TRANSLATED");
- GLOBAL(request_info).query_string = getenv("QUERY_STRING");
- GLOBAL(request_info).current_user = NULL;
- GLOBAL(request_info).current_user_length = 0;
- GLOBAL(request_info).request_method = getenv("REQUEST_METHOD");
- GLOBAL(request_info).script_name = getenv("SCRIPT_NAME");
+
+ request_info.path_info = getenv("PATH_INFO");
+ request_info.path_translated = getenv("PATH_TRANSLATED");
+ request_info.query_string = getenv("QUERY_STRING");
+ request_info.current_user = NULL;
+ request_info.current_user_length = 0;
+ request_info.request_method = getenv("REQUEST_METHOD");
+ request_info.script_name = getenv("SCRIPT_NAME");
buf = getenv("CONTENT_LENGTH");
- GLOBAL(request_info).content_length = (buf ? atoi(buf) : 0);
- GLOBAL(request_info).content_type = getenv("CONTENT_TYPE");
- GLOBAL(request_info).cookies = getenv("HTTP_COOKIE");
- GLOBAL(request_info).script_filename = getenv("SCRIPT_FILENAME");
+ request_info.content_length = (buf ? atoi(buf) : 0);
+ request_info.content_type = getenv("CONTENT_TYPE");
+ request_info.cookies = getenv("HTTP_COOKIE");
+ request_info.script_filename = getenv("SCRIPT_FILENAME");
/* Hack for annoying servers that do not set SCRIPT_FILENAME for us */
- if (!GLOBAL(request_info).script_filename) {
- GLOBAL(request_info).script_filename = GLOBAL(request_info).php_argv0;
+ if (!request_info.script_filename) {
+ request_info.script_filename = request_info.php_argv0;
}
#if WIN32|WINNT
/* FIXME WHEN APACHE NT IS FIXED */
script filename to php.exe thus makes us parse php.exe instead of file.php
requires we get the info from path translated. This can be removed at
such a time taht apache nt is fixed */
- else if (GLOBAL(request_info).path_translated) {
- GLOBAL(request_info).script_filename = GLOBAL(request_info).path_translated;
+ else if (request_info.path_translated) {
+ request_info.script_filename = request_info.path_translated;
} else {
- GLOBAL(request_info).script_filename = NULL;
+ request_info.script_filename = NULL;
}
#endif
Notice that this means that we don't need to efree() it in
php3_destroy_request_info()! */
#if DISCARD_PATH
- if (GLOBAL(request_info).script_filename) {
- GLOBAL(request_info).filename = estrdup(GLOBAL(request_info).script_filename);
+ if (request_info.script_filename) {
+ request_info.filename = estrdup(request_info.script_filename);
} else {
- GLOBAL(request_info).filename = NULL;
+ request_info.filename = NULL;
}
#else
- if (GLOBAL(request_info).path_translated) {
- GLOBAL(request_info).filename = estrdup(GLOBAL(request_info).path_translated);
+ if (request_info.path_translated) {
+ request_info.filename = estrdup(request_info.path_translated);
} else {
- GLOBAL(request_info).filename = NULL;
+ request_info.filename = NULL;
}
#endif
return SUCCESS;
int php3_destroy_request_info(void *conf)
{
- STR_FREE(GLOBAL(request_info).current_user);
+ STR_FREE(request_info.current_user);
return SUCCESS;
}
#endif
{
static int exit_requested = 0;
int i, len;
- TLS_VARS;
req = NULL;
setalarm(idle_timeout);
strncpy(script_name_resolved_buffer, req->script_name_resolved, 2047);
script_name_resolved_buffer[2047] = 0;
- GLOBAL(request_info).path_info = NULL; /* Not supported */
- GLOBAL(request_info).path_translated = script_name_resolved_buffer;
- GLOBAL(request_info).query_string = req->query_string;
- GLOBAL(request_info).current_user = NULL;
- GLOBAL(request_info).current_user_length = 0;
- GLOBAL(request_info).request_method = method_names[req->method];
- GLOBAL(request_info).script_name = req->script_name;
- GLOBAL(request_info).content_length = req->databuffsize;
- GLOBAL(request_info).content_type = req->content_type;
- GLOBAL(request_info).cookies = NULL;
+ request_info.path_info = NULL; /* Not supported */
+ request_info.path_translated = script_name_resolved_buffer;
+ request_info.query_string = req->query_string;
+ request_info.current_user = NULL;
+ request_info.current_user_length = 0;
+ request_info.request_method = method_names[req->method];
+ request_info.script_name = req->script_name;
+ request_info.content_length = req->databuffsize;
+ request_info.content_type = req->content_type;
+ request_info.cookies = NULL;
for (i = 0; i < req->nlines; i++) {
if (req->lines[i].paramc > 1) {
if (req->lines[i].params[0]) {
if (!strcasecmp(req->lines[i].params[0], "HTTP_COOKIE")) {
if (req->lines[i].params[1]) {
- GLOBAL(request_info).cookies = req->lines[i].params[1];
+ request_info.cookies = req->lines[i].params[1];
}
}
}
the include file hash table, and gets freed with that table.
Notice that this means that we don't need to efree() it in
php3_destroy_request_info()! */
- if (GLOBAL(request_info).path_translated)
- GLOBAL(request_info).filename = estrdup(GLOBAL(request_info).path_translated);
+ if (request_info.path_translated)
+ request_info.filename = estrdup(request_info.path_translated);
else
- GLOBAL(request_info).filename = NULL;
+ request_info.filename = NULL;
return SUCCESS;
} else {
int php3_init_request_info(void *conf)
{
const char *buf;
- TLS_VARS;
- GLOBAL(request_info).current_user = NULL;
- GLOBAL(request_info).current_user_length = 0;
+ request_info.current_user = NULL;
+ request_info.current_user_length = 0;
- GLOBAL(request_info).filename = GLOBAL(php3_rqst)->filename;
- GLOBAL(request_info).request_method = GLOBAL(php3_rqst)->method;
- GLOBAL(request_info).query_string = GLOBAL(php3_rqst)->args;
- GLOBAL(request_info).content_type = table_get(GLOBAL(php3_rqst)->subprocess_env, "CONTENT_TYPE");
+ request_info.filename = php3_rqst->filename;
+ request_info.request_method = php3_rqst->method;
+ request_info.query_string = php3_rqst->args;
+ request_info.content_type = table_get(php3_rqst->subprocess_env, "CONTENT_TYPE");
- buf = table_get(GLOBAL(php3_rqst)->subprocess_env, "CONTENT_LENGTH");
- GLOBAL(request_info).content_length = (buf ? atoi(buf) : 0);
+ buf = table_get(php3_rqst->subprocess_env, "CONTENT_LENGTH");
+ request_info.content_length = (buf ? atoi(buf) : 0);
- GLOBAL(request_info).cookies = table_get(GLOBAL(php3_rqst)->subprocess_env, "HTTP_COOKIE");
+ request_info.cookies = table_get(php3_rqst->subprocess_env, "HTTP_COOKIE");
return SUCCESS;
}
/* temporary until I figure a beter way to do it */
int php3_init_request_info(void *conf)
{
- TLS_VARS;
- if (GLOBAL(sapi_rqst)->filename)
- GLOBAL(request_info).filename = estrdup(GLOBAL(sapi_rqst)->filename);
+ if (sapi_rqst->filename)
+ request_info.filename = estrdup(sapi_rqst->filename);
else
- GLOBAL(request_info).filename = NULL;
- GLOBAL(request_info).path_info = GLOBAL(sapi_rqst)->path_info;
- GLOBAL(request_info).path_translated = GLOBAL(sapi_rqst)->path_translated;
- GLOBAL(request_info).query_string = GLOBAL(sapi_rqst)->query_string;
- GLOBAL(request_info).current_user = GLOBAL(sapi_rqst)->current_user;
- GLOBAL(request_info).current_user_length = GLOBAL(sapi_rqst)->current_user_length;
- GLOBAL(request_info).request_method = GLOBAL(sapi_rqst)->request_method;
- GLOBAL(request_info).script_name = GLOBAL(sapi_rqst)->script_name;
- GLOBAL(request_info).content_length = GLOBAL(sapi_rqst)->content_length;
- GLOBAL(request_info).content_type = GLOBAL(sapi_rqst)->content_type;
- GLOBAL(request_info).cookies = GLOBAL(sapi_rqst)->cookies;
+ request_info.filename = NULL;
+ request_info.path_info = sapi_rqst->path_info;
+ request_info.path_translated = sapi_rqst->path_translated;
+ request_info.query_string = sapi_rqst->query_string;
+ request_info.current_user = sapi_rqst->current_user;
+ request_info.current_user_length = sapi_rqst->current_user_length;
+ request_info.request_method = sapi_rqst->request_method;
+ request_info.script_name = sapi_rqst->script_name;
+ request_info.content_length = sapi_rqst->content_length;
+ request_info.content_type = sapi_rqst->content_type;
+ request_info.cookies = sapi_rqst->cookies;
return SUCCESS;
}
struct passwd *
getpwuid(int uid)
{
- TLS_VARS;
+ pw.pw_name = getlogin();
+ pw.pw_dir = home_dir;
+ pw.pw_shell = login_shell;
+ pw.pw_uid = 0;
- GLOBAL(pw).pw_name = getlogin();
- GLOBAL(pw).pw_dir = home_dir;
- GLOBAL(pw).pw_shell = login_shell;
- GLOBAL(pw).pw_uid = 0;
-
- return &GLOBAL(pw);
+ return &pw;
}
/*
{
int ret;
char *RPath = NULL;
- TLS_VARS;
- GLOBAL(WinsockStarted) = FALSE;
+ WinsockStarted = FALSE;
if (host == NULL) {
*error = BAD_MAIL_HOST;
*error = BAD_MAIL_HOST;
return BAD_MAIL_HOST;
} else {
- strcpy(GLOBAL(MailHost), host);
+ strcpy(MailHost, host);
}
if (INI_STR("sendmail_from")){
//********************************************************************
void TSMClose()
{
- TLS_VARS;
-
Post("QUIT\n");
Ack();
// to guarantee that the cleanup is not made twice and
int res, i;
char *p;
- TLS_VARS;
// check for NULL parameters
if (data == NULL)
if (strchr(mailTo, '@') == NULL)
return (BAD_MSG_DESTINATION);
- sprintf(GLOBAL(Buffer), "HELO %s\n", GLOBAL(LocalHost));
+ sprintf(Buffer, "HELO %s\n", LocalHost);
// in the beggining of the dialog
// attempt reconnect if the first Post fail
- if ((res = Post(GLOBAL(Buffer))) != SUCCESS) {
+ if ((res = Post(Buffer)) != SUCCESS) {
MailConnect();
- if ((res = Post(GLOBAL(Buffer))) != SUCCESS)
+ if ((res = Post(Buffer)) != SUCCESS)
return (res);
}
if ((res = Ack()) != SUCCESS)
return (res);
- sprintf(GLOBAL(Buffer), "MAIL FROM:<%s>\n", RPath);
- if ((res = Post(GLOBAL(Buffer))) != SUCCESS)
+ sprintf(Buffer, "MAIL FROM:<%s>\n", RPath);
+ if ((res = Post(Buffer)) != SUCCESS)
return (res);
if ((res = Ack()) != SUCCESS)
return (res);
- sprintf(GLOBAL(Buffer), "RCPT TO:<%s>\n", mailTo);
- if ((res = Post(GLOBAL(Buffer))) != SUCCESS)
+ sprintf(Buffer, "RCPT TO:<%s>\n", mailTo);
+ if ((res = Post(Buffer)) != SUCCESS)
return (res);
if ((res = Ack()) != SUCCESS)
return (res);
i = strlen(p);
// put next chunk in buffer
- strncpy(GLOBAL(Buffer), p, i);
- GLOBAL(Buffer)[i] = '\0';
+ strncpy(Buffer, p, i);
+ Buffer[i] = '\0';
p += i;
// send chunk
- if ((res = Post(GLOBAL(Buffer))) != SUCCESS)
+ if ((res = Post(Buffer)) != SUCCESS)
return (res);
}
}
int zoneh = abs(_timezone);
int zonem, res;
char *p;
- TLS_VARS;
- p = GLOBAL(Buffer);
+ p = Buffer;
zoneh /= (60 * 60);
zonem = (abs(_timezone) / 60) - (zoneh * 60);
p += sprintf(p, "%s\r\n", xheaders);
}
- if ((res = Post(GLOBAL(Buffer))) != SUCCESS)
+ if ((res = Post(Buffer)) != SUCCESS)
return (res);
if ((res = Post("\r\n")) != SUCCESS)
{
int res;
- TLS_VARS;
-
// Create Socket
- if ((GLOBAL(sc) = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
+ if ((sc = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
return (FAILED_TO_OBTAIN_SOCKET_HANDLE);
// Get our own host name
- if (gethostname(GLOBAL(LocalHost), HOST_NAME_LEN))
+ if (gethostname(LocalHost, HOST_NAME_LEN))
return (FAILED_TO_GET_HOSTNAME);
// Resolve the servers IP
- //if (!isdigit(GLOBAL(MailHost)[0])||!gethostbyname(GLOBAL(MailHost)))
+ //if (!isdigit(MailHost[0])||!gethostbyname(MailHost))
//{
// return (FAILED_TO_RESOLVE_HOST);
//}
// Connect to server
- GLOBAL(sock_in).sin_family = AF_INET;
- GLOBAL(sock_in).sin_port = htons(25);
- GLOBAL(sock_in).sin_addr.S_un.S_addr = GetAddr(GLOBAL(MailHost));
+ sock_in.sin_family = AF_INET;
+ sock_in.sin_port = htons(25);
+ sock_in.sin_addr.S_un.S_addr = GetAddr(MailHost);
- if (connect(GLOBAL(sc), (LPSOCKADDR) & GLOBAL(sock_in), sizeof(GLOBAL(sock_in))))
+ if (connect(sc, (LPSOCKADDR) & sock_in, sizeof(sock_in)))
return (FAILED_TO_CONNECT);
// receive Server welcome message
int len = strlen(msg);
int slen;
int index = 0;
- TLS_VARS;
while (len > 0) {
- if ((slen = send(GLOBAL(sc), msg + index, len, 0)) < 1)
+ if ((slen = send(sc, msg + index, len, 0)) < 1)
return (FAILED_TO_SEND);
len -= slen;
index += slen;
int rlen;
int Index = 0;
int Received = 0;
- TLS_VARS;
if (!buf)
if ((buf = (char *) malloc(1024 * 4)) == NULL)
again:
- if ((rlen = recv(GLOBAL(sc), buf + Index, ((1024 * 4) - 1) - Received, 0)) < 1)
+ if ((rlen = recv(sc, buf + Index, ((1024 * 4) - 1) - Received, 0)) < 1)
return (FAILED_TO_RECEIVE);
Received += rlen;
{
int timeout = value->it_value.tv_sec * 1000 + value->it_value.tv_usec;
int repeat = TIME_ONESHOT;
- TLS_VARS;
/*make sure the message queue is initialized */
- PeekMessage(GLOBAL(phpmsg), NULL, WM_USER, WM_USER, PM_NOREMOVE);
+ PeekMessage(phpmsg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
if (timeout > 0) {
struct timer_msg *msg = malloc(sizeof(struct timer_msg));
msg->threadid = GetCurrentThreadId();
switch (which) {
case ITIMER_REAL:
msg->signal = SIGALRM;
- GLOBAL(realtimer) = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
+ realtimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
break;
case ITIMER_VIRT:
msg->signal = SIGVTALRM;
- GLOBAL(virttimer) = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
+ virttimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
break;
case ITIMER_PROF:
msg->signal = SIGPROF;
- GLOBAL(proftimer) = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
+ proftimer = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
break;
default:
errno = EINVAL;
} else {
switch (which) {
case ITIMER_REAL:
- timeKillEvent(GLOBAL(realtimer));
+ timeKillEvent(realtimer);
break;
case ITIMER_VIRT:
- timeKillEvent(GLOBAL(virttimer));
+ timeKillEvent(virttimer);
break;
case ITIMER_PROF:
- timeKillEvent(GLOBAL(proftimer));
+ timeKillEvent(proftimer);
break;
default:
errno = EINVAL;
void closelog(void)
{
- TLS_VARS;
- DeregisterEventSource(GLOBAL(loghdl));
- efree(GLOBAL(loghdr));
+ DeregisterEventSource(loghdl);
+ efree(loghdr);
}
/* Emulator for BSD syslog() routine
LPTSTR strs[2];
char tmp[1024]; /* callers must be careful not to pop this */
unsigned short etype;
- TLS_VARS;
/* default event source */
- if (!GLOBAL(loghdl))
+ if (!loghdl)
openlog("c-client", LOG_PID, LOG_MAIL);
switch (priority) { /* translate UNIX type into NT type */
case LOG_ALERT:
}
va_start(args, message); /* initialize vararg mechanism */
vsprintf(tmp, message, args); /* build message */
- strs[0] = GLOBAL(loghdr); /* write header */
+ strs[0] = loghdr; /* write header */
strs[1] = tmp; /* then the message */
/* report the event */
- ReportEvent(GLOBAL(loghdl), etype, (unsigned short) priority, 2000, NULL, 2, 0, strs, NULL);
+ ReportEvent(loghdl, etype, (unsigned short) priority, 2000, NULL, 2, 0, strs, NULL);
va_end(args);
}
void openlog(const char *ident, int logopt, int facility)
{
char tmp[1024];
- TLS_VARS;
- if (GLOBAL(loghdl)) {
+ if (loghdl) {
closelog();
}
- GLOBAL(loghdl) = RegisterEventSource(NULL, ident);
+ loghdl = RegisterEventSource(NULL, ident);
sprintf(tmp, (logopt & LOG_PID) ? "%s[%d]" : "%s", ident, getpid());
- GLOBAL(loghdr) = estrdup(tmp); /* save header for later */
+ loghdr = estrdup(tmp); /* save header for later */
}