27Jan02=======================================================================
1. make save work in cron context
+2. try to get the C client to handle closes on its standard input better
+handled.
22Jan02=======================================================================
1. limit spot dupe checking to first 12 characters
13Jan02=======================================================================
sleep(1);
}
-$self->send_now('Z', "");
+#$self->send_now('Z', "");
$self->disconnect;
default:
dbg(DBUF,"got errno %d in input", errno);
ending++;
- return 0;
+ return 1;
}
} else if (r == 0) {
dbg(DBUF, "ending normally");
ending++;
- return 0;
+ return 1;
}
dbgdump(DBUF, "in ->", buf, r);
void term_timeout(int i)
{
/* none of this is going to be reused so don't bother cleaning up properly */
- tcflush(0, TCIOFLUSH);
+ if (isatty(0))
+ tcflush(0, TCIOFLUSH);
kill(getpid(), 9); /* commit suicide */
}
signal(SIGALRM, term_timeout);
alarm(10);
- while ((in && !is_chain_empty(in->outq)) ||
- (node && !is_chain_empty(node->outq))) {
+ if (node && node->sp->sort) {
+ sel_close(node->sp);
+ close(node->cnum);
+ }
+ while (in && in->sp->sort && !is_chain_empty(in->outq)) {
sel_run();
}
+ sel_run();
+ sel_run();
+ sel_run();
+ sel_run();
+ sel_run();
+ sel_run();
+ sel_run();
+ sel_run();
if (in && in->t_set)
tcsetattr(0, TCSADRAIN, &in->t);
- if (node) {
- shutdown(node->cnum, 3);
- close(node->cnum);
- }
exit(i);
}
{
write(0, "Timed Out", 10);
write(0, &nl, 1);
- sel_run(); /* force a coordination */
- if (in && in->t_set)
- tcsetattr(0, TCSANOW, &in->t);
- exit(i);
+ terminate(0);
}
/*
return sp;
}
+/*
+ * post a close handler for this connection, to do special things
+ * in the event of this cnum closing, the default is just to close
+ */
+
+void sel_closehandler(sel_t *sp, void (*handler)())
+{
+ sp->closehandler = handler;
+}
+
/*
* close (and thus clear down) a slot, it is assumed that you have done whatever
* you need to do to close the actual device already
void sel_close(sel_t *sp)
{
if (sp->sort) {
+ if (sp->closehandler) {
+ (sp->closehandler)(sp);
+ } else {
+ close(sp->cnum);
+ }
chain_flush(sp->msgbase);
free(sp->msgbase);
free(sp->name);
/*
* $Log$
- * Revision 1.4 2000-07-20 14:16:00 minima
+ * Revision 1.5 2002-01-27 15:35:33 minima
+ * try to fix EOF on standard input problems
+ *
+ * Revision 1.4 2000/07/20 14:16:00 minima
* can use Sourceforge now!
* added user->qra cleaning
* added 4 digit qra to user broadcast dxspots if available
* $Header$
*
* $Log$
- * Revision 1.3 2000-07-20 14:16:00 minima
+ * Revision 1.4 2002-01-27 15:35:33 minima
+ * try to fix EOF on standard input problems
+ *
+ * Revision 1.3 2000/07/20 14:16:00 minima
* can use Sourceforge now!
* added user->qra cleaning
* added 4 digit qra to user broadcast dxspots if available
void *fcb; /* any fcb associated with this thing */
reft *msgbase; /* any messages for this port */
int (*handler)(); /* the handler for this thingy */
+ int (*closehandler)(); /* special close handler */
} sel_t;
extern sel_t *sel;
void sel_init(int, long, long); /* initialise the select thing */
void sel_run(); /* run the select multiplexor */
sel_t *sel_open(int, void *, char *, int (*)(), int, int);/* initialise a slot */
+void sel_closehandler(sel_t *, void (*)()); /* post a closehandler for this cnum */
+
void sel_close(sel_t *);
int sel_error(sel_t *, int); /* set/clear error flag */