Hello Lutz,
Sorry for all the stormy postings ;-)
How can I break inside the console an event without exiting newlisp?
(ctrl-C drops me out 100%, a signal handler could catch it...)
Norman.
break?
The Ctrl-C break handler is already in the code (in newlisp.c right at the top before main()) but I have it outcommented because it only works on BSD and MAC OS-X (BSD based.
On Linux and Cygwin it works only the first time and I couldn't figure out why. Probably some stupid oversight in the code or subtle difference in signal handling between Linux and BSD. Incidently I looked up all the signal handling stuff in a LINUX book but it works only on BSD. Perhaps you have some idea?
Would be great to have this for 8.0.
Lutz
On Linux and Cygwin it works only the first time and I couldn't figure out why. Probably some stupid oversight in the code or subtle difference in signal handling between Linux and BSD. Incidently I looked up all the signal handling stuff in a LINUX book but it works only on BSD. Perhaps you have some idea?
Would be great to have this for 8.0.
Lutz
Hello Lutz,
Im not a great C programmer but the following works overhere on Linux,
there must be a return from signal and its in a while loop...
I think you need to have a look at ioctl also, because you use the readline library im not sure if ioctl is needed to control console io that way...But thats not ansi C i guess...
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
void xsigint()
{
printf("blabla\n");
return;
}
int main()
{
if (signal(SIGINT, xsigint) == SIG_ERR)
printf("Error sigint!\n");
while(1);
}
Im not a great C programmer but the following works overhere on Linux,
there must be a return from signal and its in a while loop...
I think you need to have a look at ioctl also, because you use the readline library im not sure if ioctl is needed to control console io that way...But thats not ansi C i guess...
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
void xsigint()
{
printf("blabla\n");
return;
}
int main()
{
if (signal(SIGINT, xsigint) == SIG_ERR)
printf("Error sigint!\n");
while(1);
}
thankyou very much for the pointer, this seems to be the point:
>>> http://www.imaxx.net/~thrytis/glibc/glibc-FAQ.html#3.7
BSD signal handlers remain installed once triggered. System V signal handlers work only once, so one must reinstall them each time.
>>>
thanks
Lutz
ps: left you some stuff in http://newlisp.org/download/development/broadcast
>>> http://www.imaxx.net/~thrytis/glibc/glibc-FAQ.html#3.7
BSD signal handlers remain installed once triggered. System V signal handlers work only once, so one must reinstall them each time.
>>>
thanks
Lutz
ps: left you some stuff in http://newlisp.org/download/development/broadcast
Hello Lutz,
Thanks... I tried it but get a compile error..cant find the bugger though ;-)
gcc newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o pcre.o -g -lm -ldl -lreadline -lncurses -o newlisp
nl-sock.o(.text+0xf63): In function `writeLog':
/newlisp_7504/nl-sock.c:853: undefined reference to `logTraffic'
collect2: ld returned 1 exit status
make[1]: *** [default] Error 1
make[1]: Leaving directory `/newlisp_7504'
make: *** [linux] Error 2
Norman.
Thanks... I tried it but get a compile error..cant find the bugger though ;-)
gcc newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o pcre.o -g -lm -ldl -lreadline -lncurses -o newlisp
nl-sock.o(.text+0xf63): In function `writeLog':
/newlisp_7504/nl-sock.c:853: undefined reference to `logTraffic'
collect2: ld returned 1 exit status
make[1]: *** [default] Error 1
make[1]: Leaving directory `/newlisp_7504'
make: *** [linux] Error 2
Norman.