Skip to content

Commit

Permalink
add if-expression flags 'perl[0-9]' - flags, setted from perl script.
Browse files Browse the repository at this point in the history
other perl-related changes.
  • Loading branch information
Stepan Pologov committed Jun 9, 2004
1 parent 81ec7cc commit c921425
Show file tree
Hide file tree
Showing 16 changed files with 112 additions and 78 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2004-06-08 15:11 sisoft

* Changes, qico.conf.sample, src/protfm.c, stuff/test.pl:

fix receiving files from last position after abort, not from begin.

2004-06-07 22:50 sisoft

* Changes, Makefile.am, README, autogen.sh, configure.in,
Expand Down
11 changes: 4 additions & 7 deletions TodayFixes
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
/* $Id: TodayFixes,v 1.80 2004/06/08 11:11:44 sisoft Exp $ */
/* $Id: TodayFixes,v 1.81 2004/06/09 22:25:49 sisoft Exp $ */
---
fix receiving files from last position after abort, not from begin.
add if-expression flags 'perl[0-9]' - flags, setted from perl script.
other perl-related changes.
.
previous:
---
change version to 0.55si.
release 0.54si (cvs tag - stbl54).
add 'make deb' target for make debian packages.
begin write perl support code.
add configure option --enable-perl and keyword 'perlfile'.
fix receiving files from last position after abort, not from begin.
.
3 changes: 2 additions & 1 deletion cvs_com
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/perl
# $Id: cvs_com,v 1.8 2004/06/02 13:20:06 sisoft Exp $
# $Id: cvs_com,v 1.9 2004/06/09 22:25:49 sisoft Exp $
if(-e "ChangeLog") {
open(X,"new")||die("can't open 'new'\n");
open(F,"TodayFixes")||die("can't open TodayFixes\n");
Expand All @@ -19,6 +19,7 @@ if(-e "ChangeLog") {
unlink("ChangeLog");
}
system("cvs2cl -F trunk -I ChangeLog -I TodayFixes -I cvsdate.h --no-wrap -S");
exit if($?>>8);
unlink("ChangeLog.bak");
system('date +\'char cvsdate[]="%Y-%m-%d %H:%M";\' >src/cvsdate.h');
system("cvs com -F new");
Expand Down
2 changes: 1 addition & 1 deletion src/cvsdate.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
char cvsdate[]="2004-06-08 15:08";
char cvsdate[]="2004-06-10 02:24";
14 changes: 7 additions & 7 deletions src/daemon.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**********************************************************
* qico daemon
* $Id: daemon.c,v 1.32 2004/06/07 18:51:13 sisoft Exp $
* $Id: daemon.c,v 1.33 2004/06/09 22:25:50 sisoft Exp $
**********************************************************/
#include <config.h>
#ifdef HAVE_DNOTIFY
Expand Down Expand Up @@ -55,7 +55,7 @@ static RETSIGTYPE sighup(int sig)
#ifdef NEED_DEBUG
parse_log_levels();
#endif
perl_on_reload(0);
IFPerl(perl_on_reload(0));
do_rescan=1;
}

Expand Down Expand Up @@ -182,7 +182,7 @@ static void daemon_evt(int chld,char *buf,int rc,int mode)
write_log("exiting by request");
if(cfgs(CFG_PIDFILE))
if(getpid()==islocked(ccs))lunlink(ccs);
perl_done(0);
IFPerl(perl_done(0));
log_done();
qqreset();sline("");title("");
qsendpkt(QC_QUIT,"master","",1);
Expand All @@ -204,7 +204,7 @@ static void daemon_evt(int chld,char *buf,int rc,int mode)
#ifdef NEED_DEBUG
parse_log_levels();
#endif
perl_on_reload(0);
IFPerl(perl_on_reload(0));
do_rescan=1;
break;
case QR_SCAN:
Expand Down Expand Up @@ -474,7 +474,7 @@ void daemon_mode()
}
to_dev_null();setsid();
write_log("%s-%s/%s daemon started",progname,version,osname);
perl_init(cfgs(CFG_PERLFILE),1);
IFPerl(perl_init(cfgs(CFG_PERLFILE),1));
#ifdef HAVE_DNOTIFY
if(ASO) {
dnot=open(cfgs(CFG_ASOOUTBOUND),O_RDONLY);
Expand Down Expand Up @@ -578,7 +578,7 @@ void daemon_mode()
write_log("can't init log %s.%s",ccs,port);
exit(S_BUSY);
}
perl_on_reload(1);
IFPerl(perl_on_reload(1));
DEBUG(('I',4,"connecting to daemon"));
ssock=cls_conn(CLS_LINE,cfgs(CFG_SERVER),NULL);
if(ssock<0)write_log("can't connect to server: %s",strerror(errno));
Expand Down Expand Up @@ -656,7 +656,7 @@ void daemon_mode()
break;
}
aso_unlocknode(&current->addr,LCK_x);
perl_done(0);
IFPerl(perl_done(0));
log_done();
cls_close(ssock);
exit(rc);
Expand Down
36 changes: 18 additions & 18 deletions src/flagexp.y
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**********************************************************
* expression parser
* $Id: flagexp.y,v 1.14 2004/06/05 06:49:13 sisoft Exp $
* $Id: flagexp.y,v 1.15 2004/06/09 22:25:50 sisoft Exp $
**********************************************************/
%token DATE DATESTR GAPSTR ITIME NUMBER PHSTR TIMESTR ADDRSTR IDENT
%token CONNSTR SPEED CONNECT PHONE MAILER TIME ADDRESS FLEXEC FLLINE
Expand All @@ -24,16 +24,16 @@ int yylex();
int flxpres;

static int logic(int e1, int op,int e2);
static int checkconnstr(void);
static int checkconnstr();
static int checkspeed(int op, int speed, int real);
static int checksfree(int op,int sp);
static int checkmailer(void);
static int checkphone(void);
static int checkport(void);
static int checkcid(void);
static int checkhost(void);
static int checkfile(void);
static int checkexec(void);
static int checkmailer();
static int checkphone();
static int checkport();
static int checkcid();
static int checkhost();
static int checkfile();
static int checkexec();
static int checkline(int lnum);
static int yyerror(char *s);
extern char *yyPTR;
Expand Down Expand Up @@ -124,7 +124,7 @@ static int logic(int e1, int op,int e2)
}
}

static int checkconnstr(void)
static int checkconnstr()
{
DEBUG(('Y',2,"checkconnstr: \"%s\"",yytext));
if(!connstr||is_ip) return 0;
Expand Down Expand Up @@ -176,7 +176,7 @@ static int checksfree(int op,int sf)
}
}

static int checkphone(void)
static int checkphone()
{
DEBUG(('Y',2,"checkphone: \"%s\"",yytext));
if(!rnode||!rnode->phone) return 0;
Expand All @@ -185,7 +185,7 @@ static int checkphone(void)
return 0;
}

static int checkmailer(void)
static int checkmailer()
{
DEBUG(('Y',2,"checkmailer: \"%s\"",yytext));
if(!rnode||!rnode->mailer) return 0;
Expand All @@ -194,7 +194,7 @@ static int checkmailer(void)
return 0;
}

static int checkcid(void)
static int checkcid()
{
char *cid = getenv("CALLER_ID");
if(!cid||strlen(cid)<4) cid = "none";
Expand All @@ -203,7 +203,7 @@ static int checkcid(void)
return 0;
}

static int checkhost(void)
static int checkhost()
{
DEBUG(('Y',2,"checkhost: \"%s\"",yytext));
if(!rnode || !rnode->host) return 0;
Expand All @@ -212,7 +212,7 @@ static int checkhost(void)
return 0;
}

static int checkport(void)
static int checkport()
{
DEBUG(('Y',2,"checkport: \"%s\"",yytext));
if(!rnode || !rnode->tty) return 0;
Expand All @@ -221,15 +221,15 @@ static int checkport(void)
return 0;
}

static int checkfile(void)
static int checkfile()
{
struct stat sb;
DEBUG(('Y',2,"checkfile: \"%s\" -> %d",yytext,!stat(yytext,&sb)));
if(!stat(yytext,&sb)) return 1;
return 0;
}

static int checkexec(void)
static int checkexec()
{
int rc;
char *cmd=xstrdup(yytext);
Expand Down Expand Up @@ -276,6 +276,6 @@ int flagexp(slist_t *expr,int strict)

static int yyerror(char *s)
{
DEBUG(('Y',1,"yyerror: %s",s));
DEBUG(('Y',1,"yyerror: %s at %s",s,(yytext&&*yytext)?yytext:"end of input"));
return 0;
}
13 changes: 12 additions & 1 deletion src/flaglex.l
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**********************************************************
* lexical parser
* $Id: flaglex.l,v 1.17 2004/06/05 06:49:13 sisoft Exp $
* $Id: flaglex.l,v 1.18 2004/06/09 22:25:50 sisoft Exp $
**********************************************************/
%option noyywrap
%{
Expand Down Expand Up @@ -164,6 +164,7 @@ Anystr [^ \t\n]+

static int flagfor(char *str)
{
int fln;
char *p, *q;
if(!str||!*str||!strncasecmp(str,"tty",3)||
!strncasecmp(str,"cua",3))return 0;
Expand Down Expand Up @@ -197,6 +198,16 @@ static int flagfor(char *str)
DEBUG(('Y',3,"flagfor: bad password: %d",rnode->options&O_BAD));
return rnode->options&O_BAD;
}
#ifdef WITH_PERL
if(!strncasecmp(str,"perl",4)) {
if((fln=atoi(str+4))<0||fln>9) {
write_log("error: illegal perl flag: %s",str);
return 0;
}
DEBUG(('Y',3,"flagfor: perl%d: %d",fln,(perl_flg&(1<<fln))?1:0));
return((perl_flg&(1<<fln))?1:0);
}
#endif
if(rnode->flags) {
q=xstrdup(rnode->flags);p=strtok(q,",");
while(p) {
Expand Down
10 changes: 5 additions & 5 deletions src/hydra.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Joaquim H. Homrighausen
COPYRIGHT (C) 1991-1993; ALL RIGHTS RESERVED
=============================================================================*/
/* $Id: hydra.c,v 1.12 2004/06/05 06:49:13 sisoft Exp $ */
/* $Id: hydra.c,v 1.13 2004/06/09 22:25:50 sisoft Exp $ */
#include "headers.h"
#include "hydra.h"
#include "crc.h"
Expand Down Expand Up @@ -134,7 +134,7 @@ static struct _h_dev h_dev[] = {

/*---------------------------------------------------------------------------*/

boolean hydra_devfree (void)
boolean hydra_devfree ()
{
if (devtxstate || !(txoptions & HOPT_DEVICE) || txstate >= HTX_END)
return (false); /* busy or not allowed */
Expand Down Expand Up @@ -183,7 +183,7 @@ boolean hydra_devfunc (char *dev, void (*func) (byte *data, word len))


/*---------------------------------------------------------------------------*/
static void hydra_devrecv (void)
static void hydra_devrecv ()
{
register char *p = (char *) rxbuf;
register int i;
Expand Down Expand Up @@ -408,7 +408,7 @@ static void txpkt (register word len, int type)


/*---------------------------------------------------------------------------*/
static int rxpkt (void)
static int rxpkt ()
{
register byte *p, *q=NULL;
register int c, n, i;
Expand Down Expand Up @@ -659,7 +659,7 @@ void hydra_init (dword want_options, boolean orig, int hmod, int rxwin, int txwi


/*---------------------------------------------------------------------------*/
void hydra_deinit (void)
void hydra_deinit ()
{
qpreset(0);qpreset(1);
xfree(txbuf);xfree(rxbuf);
Expand Down
6 changes: 3 additions & 3 deletions src/hydra.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Joaquim H. Homrighausen
COPYRIGHT (C) 1991-1993; ALL RIGHTS RESERVED
=============================================================================*/
/* $Id: hydra.h,v 1.6 2004/02/06 21:54:46 sisoft Exp $ */
/* $Id: hydra.h,v 1.7 2004/06/09 22:25:50 sisoft Exp $ */
#ifndef __HYDRA_H__
#define __HYDRA_H__

Expand Down Expand Up @@ -136,9 +136,9 @@ typedef long FILE_OFS; /* Offset in a disk file */

/* HYDRA Prototypes */
extern void hydra_init (dword want_options, boolean originator, int hmod, int rxwin, int txwin);
extern void hydra_deinit (void);
extern void hydra_deinit ();
extern int hydra_file (char *txpathname, char *txalias);
extern boolean hydra_devfree (void);
extern boolean hydra_devfree ();
extern boolean hydra_devsend (char *dev, byte *data, word len);
extern boolean hydra_devfunc (char *dev, void (*func) (byte *data, word len));
extern boolean hdxsession;
Expand Down
4 changes: 2 additions & 2 deletions src/log.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**********************************************************
* work with log file
* $Id: log.c,v 1.22 2004/06/07 18:51:14 sisoft Exp $
* $Id: log.c,v 1.23 2004/06/09 22:25:50 sisoft Exp $
**********************************************************/
#include "headers.h"
#define SYSLOG_NAMES
Expand Down Expand Up @@ -158,7 +158,7 @@ void vwrite_log(char *fmt, char *prefix,int dbg,va_list args)
p=str+strlen(str);
}
vsnprintf(p,LARGE_STRING-50,fmt,args);
perl_on_log(str);
IFPerl(perl_on_log(str));
if(log_callback&&dbg)log_callback(str);
switch(log_type) {
case 0:
Expand Down
14 changes: 13 additions & 1 deletion src/mailer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**********************************************************
* protocol definitions
* $Id: mailer.h,v 1.15 2004/05/29 23:34:49 sisoft Exp $
* $Id: mailer.h,v 1.16 2004/06/09 22:25:50 sisoft Exp $
**********************************************************/
#ifndef __MAILER_H__
#define __MAILER_H__
Expand Down Expand Up @@ -123,5 +123,17 @@ extern void tcp_done(int fd);
extern void chatinit(int prot);
extern void c_devrecv(unsigned char *str,unsigned len);
extern void getevt();
/* perl.c */
#ifdef WITH_PERL
#define IFPerl(x) x
extern unsigned short perl_flg;
extern int perl_init(char *script,int mode);
extern void perl_done(int rc);
extern void perl_on_reload(int mode);
extern void perl_on_std(int sub);
extern int perl_on_log(char *str);
#else
#define IFPerl(x)
#endif

#endif
Loading

0 comments on commit c921425

Please sign in to comment.