unix.lsp / unix:syslog, example please

Started by Darth_Severus, November 25, 2015, 11:32:09 AM

Previous topic - Next topic

Darth_Severus

I tried using unix:syslog from here http://www.newlisp.org/code/modules/unix.lsp.html">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
(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

TedWalther

#1
Which version of Linux?
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.

rrq

#2
Seems it gets somewhat happier including %d and %m in the format; i.e.
(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.

Darth_Severus

#3
Quote from: "TedWalther"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.


Quotesyntax: (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.

Darth_Severus

#4
It's based on Debian 8.2

TedWalther

#5
Thanks Darth.
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.