unix.lsp / unix:syslog, example please

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?

unix.lsp / unix:syslog, example please

Postby Darth_Severus » Wed Nov 25, 2015 7:32 pm

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
Darth_Severus
 
Posts: 18
Joined: Fri Aug 08, 2014 6:08 pm

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

Postby TedWalther » Wed Nov 25, 2015 9:04 pm

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.
TedWalther
 
Posts: 602
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC

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

Postby ralph.ronnquist » Wed Nov 25, 2015 10:36 pm

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.
ralph.ronnquist
 
Posts: 178
Joined: Mon Jun 02, 2014 1:40 am
Location: Melbourne, Australia

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

Postby Darth_Severus » Thu Nov 26, 2015 12:32 am

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.
Darth_Severus
 
Posts: 18
Joined: Fri Aug 08, 2014 6:08 pm

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

Postby Darth_Severus » Sun Nov 29, 2015 7:56 pm

It's based on Debian 8.2
Darth_Severus
 
Posts: 18
Joined: Fri Aug 08, 2014 6:08 pm

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

Postby TedWalther » Sun Nov 29, 2015 11:46 pm

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.
TedWalther
 
Posts: 602
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC


Return to newLISP and the O.S.

Who is online

Users browsing this forum: No registered users and 1 guest

cron