innd/ cleanup
greg andruk
meowing at banet.net
Sun Oct 24 06:50:45 UTC 1999
This moves Pythonic types out innd.h so that only python.c needs to
include Python.h, making the #include battle go away in perl.c.
diff -cr ../dist/innd/Makefile ./innd/Makefile
*** ../dist/innd/Makefile Sun Oct 24 01:42:23 1999
--- ./innd/Makefile Sun Oct 24 02:32:21 1999
***************
*** 1,7 ****
## $Revision: 1.38 $
include ../Makefile.global
! CFLAGS = $(GCFLAGS) $(PYTHONINC)
SOURCES = \
art.c cc.c chan.c his.c icd.c innd.c lc.c nc.c newsfeeds.c ng.c \
--- 1,7 ----
## $Revision: 1.38 $
include ../Makefile.global
! CFLAGS = $(GCFLAGS)
SOURCES = \
art.c cc.c chan.c his.c icd.c innd.c lc.c nc.c newsfeeds.c ng.c \
***************
*** 23,28 ****
--- 23,31 ----
perl.o: perl.c
$(CC) $(CFLAGS) $(PERLINC) -c perl.c
+
+ python.o: python.c
+ $(CC) $(CFLAGS) $(PYTHONINC) -c python.c
tcl.o: tcl.c
$(CC) $(CFLAGS) $(TCLINC) -c tcl.c
diff -cr ../dist/innd/cc.c ./innd/cc.c
*** ../dist/innd/cc.c Sun Oct 24 01:42:24 1999
--- ./innd/cc.c Sun Oct 24 01:56:42 1999
***************
*** 661,693 ****
#if defined(DO_PYTHON)
-
- #include "Python.h"
-
STATIC STRING
CCpython(av)
char *av[];
{
! char *p;
! extern BOOL PythonFilterActive;
!
! switch (av[0][0]) {
! default:
! return "1 Bad flag";
! case 'y':
! if (PythonFilterActive)
! return "1 Python filter already enabled";
! else if (PYFilterObject == NULL)
! return "1 Python filter not defined" ;
! PYfilter(TRUE);
! break;
! case 'n':
! if (!PythonFilterActive)
! return "1 Python filter already disabled";
! PYfilter(FALSE);
! break;
! }
! return NULL;
}
#endif /* defined(DO_PYTHON) */
--- 661,671 ----
#if defined(DO_PYTHON)
STATIC STRING
CCpython(av)
char *av[];
{
! return PYcontrol(av);
}
#endif /* defined(DO_PYTHON) */
***************
*** 848,856 ****
#if defined(DO_PERL)
extern int PerlFilterActive;
#endif /* defined(DO_PERL) */
- #if defined(DO_PYTHON)
- extern BOOL PythonFilterActive;
- #endif /* defined(DO_PYTHON) */
/* nb: We assume here that BUFSIZ is >= 512, and that none of
* ModeReason RejectReason Reservation or NNRPReason is longer than
--- 826,831 ----
diff -cr ../dist/innd/innd.h ./innd/innd.h
*** ../dist/innd/innd.h Sun Oct 24 01:42:24 1999
--- ./innd/innd.h Sun Oct 24 02:29:17 1999
***************
*** 46,59 ****
when we define it later */
#endif /* defined(DO_TCL) */
- #if defined(DO_PYTHON)
- #include "Python.h"
- #undef PATCHLEVEL /* Python and Perl both #define PATCHLEVEL, so as long as
- they have to be included in the same file we have to
- make sure that they don't conflict. We use the Perl
- PATCHLEVEL so dump the Python one. */
- #endif /* DO_PYTHON */
-
typedef short SITEIDX;
#define NOSITE ((SITEIDX) -1)
--- 46,51 ----
***************
*** 657,670 ****
#endif /* defined(DO_TCL) */
- /* Python globals */
#if defined(DO_PYTHON)
- extern PyObject *PYFilterObject;
- extern PyObject *PYFilterModule;
extern BOOL PythonFilterActive;
! /* Python functions */
! extern void PYfilter(BOOL value);
extern int PYreadfilter(void);
extern char *PYartfilter(char *artBody, long artLen, int lines);
extern char *PYmidfilter(char *messageID, int msglen);
--- 649,658 ----
#endif /* defined(DO_TCL) */
#if defined(DO_PYTHON)
extern BOOL PythonFilterActive;
! extern STRING PYcontrol(char **av);
extern int PYreadfilter(void);
extern char *PYartfilter(char *artBody, long artLen, int lines);
extern char *PYmidfilter(char *messageID, int msglen);
diff -cr ../dist/innd/python.c ./innd/python.c
*** ../dist/innd/python.c Sun Oct 24 01:42:25 1999
--- ./innd/python.c Sun Oct 24 02:11:13 1999
***************
*** 63,68 ****
--- 63,100 ----
/*
+ ** Front end for PYfilter()
+ */
+ STRING
+ PYcontrol(av)
+ char **av;
+ {
+ char *p;
+ extern BOOL PythonFilterActive;
+
+ switch (av[0][0]) {
+ default:
+ return "1 Bad flag";
+ case 'y':
+ if (PythonFilterActive)
+ return "1 Python filter already enabled";
+ else if (PYFilterObject == NULL)
+ return "1 Python filter not defined" ;
+ PYfilter(TRUE);
+ break;
+ case 'n':
+ if (!PythonFilterActive)
+ return "1 Python filter already disabled";
+ PYfilter(FALSE);
+ break;
+ }
+ return NULL;
+ }
+
+
+
+
+ /*
** Reject articles we don't like.
*/
char *
More information about the inn-patches
mailing list