Page 1 of 1

unix.lsp / unix:syslog, example please

Posted: Wed Nov 25, 2015 7:32 pm
by Darth_Severus
I tried using unix:syslog from here http://www.newlisp.org/code/modules/unix.lsp.html

I don't know what printf format means, though I read the wikipedia entry.

All of these examples

Code: Select all

(module "unix.lsp") (unix:syslog 5 "test %s")
(module "unix.lsp") (unix:syslog 5 "test%s")
(module "unix.lsp") (unix:syslog 5 "%s test")
(module "unix.lsp") (unix:syslog 5 "test" "%s")
(module "unix.lsp") (unix:syslog 5 "%s" "test")
give me a Segmentation fault, others as well.

I already added "/usr/lib/i386-linux-gnu/libc.so" ; Linux
to /usr/local/share/newlisp-10.6.2/modules/unix.ls

Re: unix.lsp / unix:syslog, example please

Posted: Wed Nov 25, 2015 9:04 pm
by TedWalther
Which version of Linux?

Re: unix.lsp / unix:syslog, example please

Posted: Wed Nov 25, 2015 10:36 pm
by ralph.ronnquist
Seems it gets somewhat happier including %d and %m in the format; i.e.

Code: Select all

(unix:syslog 5 "%d %m")
Doing so at least avoids the vprintf crash (Ubuntu 14.04.3 64bit), but the message is still garbled.

Basically, from experimenting it appears that the format string can be without indicators, or it should include %d as first indicator, and then optionally %m, which results in the system error string.

The first syslog argument doesn't seem to be of much use except of making the format string the second argument. Though I haven't really explored it much.

Additional format indicators didn't seem to work too well.

Re: unix.lsp / unix:syslog, example please

Posted: Thu Nov 26, 2015 12:32 am
by Darth_Severus
TedWalther wrote:Which version of Linux?
MX Linux (32 Bit)
3.14-0.bpo.2-686-pae #1 SMP Debian 3.14.15-2~bpo70+1 (2014-08-21) i686 GNU/Linux

@ralf: The string needs to be in printf, not the number.
syntax: (unix:syslog num-priority str-message ...)
parameter: num-priority - The priority of the message.
parameter: str-message - The message string and template in printf format.

Re: unix.lsp / unix:syslog, example please

Posted: Sun Nov 29, 2015 7:56 pm
by Darth_Severus
It's based on Debian 8.2

Re: unix.lsp / unix:syslog, example please

Posted: Sun Nov 29, 2015 11:46 pm
by TedWalther
Thanks Darth.