From billbose at gmail.com Tue Nov 24 21:17:41 2015 From: billbose at gmail.com (JV) Date: Wed, 25 Nov 2015 00:17:41 -0500 Subject: [CM] How to capture standard output of Linux command in s7 Message-ID: I am not looking for the system function. Thank you, -- Jo -------------- next part -------------- An HTML attachment was scrubbed... URL: From billbose at gmail.com Wed Nov 25 07:38:22 2015 From: billbose at gmail.com (JV) Date: Wed, 25 Nov 2015 10:38:22 -0500 Subject: [CM] How to capture standard output of Linux command in s7 In-Reply-To: <827e8e1392297855cbd617283b47694e@ccrma.stanford.edu> References: <827e8e1392297855cbd617283b47694e@ccrma.stanford.edu> Message-ID: system prints the output of the command. I cannot save the output with: (define sv (system ("ls")) On Wed, Nov 25, 2015 at 8:02 AM, wrote: > system is normally included in s7 in Linux -- try > (help system) or (system "ls -la s7.c" #t). If your > version of s7 was built with the compiler flag > WITH_SYSTEM_EXTRAS set to 0, you can still get at the > c library's system function via libc.scm, but > hopefully that isn't necessary. > > > -- Joseph Vijay -------------- next part -------------- An HTML attachment was scrubbed... URL: From k.s.matheussen at gmail.com Wed Nov 25 07:46:57 2015 From: k.s.matheussen at gmail.com (Kjetil Matheussen) Date: Wed, 25 Nov 2015 16:46:57 +0100 Subject: [CM] How to capture standard output of Linux command in s7 In-Reply-To: References: <827e8e1392297855cbd617283b47694e@ccrma.stanford.edu> Message-ID: Hi, There might be a better solution, but this is the function I've been using to do this: (define (get-system-output command) (let ((logfilename "/tmp/logtemp")) (system (string-append command " > " logfilename)) (let* ((ret "") (fd (open-file logfilename "r")) (line (read-line fd))) (while (not (eof-object? line)) ( set! ret (string-append ret line)) (set! line (read-line fd))) (close fd) (system (string-append "rm " logfilename)) ret))) (this is for guile though, not s7, but you get the idea) On Wed, Nov 25, 2015 at 4:38 PM, JV wrote: > system prints the output of the command. > I cannot save the output with: > > (define sv (system ("ls")) > > On Wed, Nov 25, 2015 at 8:02 AM, wrote: > >> system is normally included in s7 in Linux -- try >> (help system) or (system "ls -la s7.c" #t). If your >> version of s7 was built with the compiler flag >> WITH_SYSTEM_EXTRAS set to 0, you can still get at the >> c library's system function via libc.scm, but >> hopefully that isn't necessary. >> >> >> > > > -- > Joseph Vijay > > _______________________________________________ > Cmdist mailing list > Cmdist at ccrma.stanford.edu > https://cm-mail.stanford.edu/mailman/listinfo/cmdist > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From k.s.matheussen at gmail.com Wed Nov 25 07:50:29 2015 From: k.s.matheussen at gmail.com (Kjetil Matheussen) Date: Wed, 25 Nov 2015 16:50:29 +0100 Subject: [CM] How to capture standard output of Linux command in s7 In-Reply-To: References: <827e8e1392297855cbd617283b47694e@ccrma.stanford.edu> Message-ID: (Sorry about the lack of indentation in previous post) (define (get-system-output command) (let ((logfilename "/tmp/logtemp")) (system (string-append command " > " logfilename)) (let* ((ret "") (fd (open-file logfilename "r")) (line (read-line fd))) (while (not (eof-object? line)) (set! ret (string-append ret line)) (set! line (read-line fd))) (close fd) (system (string-append "rm " logfilename)) ret))) On Wed, Nov 25, 2015 at 4:46 PM, Kjetil Matheussen wrote: > Hi, > > There might be a better solution, but this is the function I've been using > to do this: > > (define (get-system-output command) (let ((logfilename "/tmp/logtemp")) (system > (string-append command " > " logfilename)) (let* ((ret "") (fd (open-file > logfilename "r")) (line (read-line fd))) (while (not (eof-object? line)) ( > set! ret (string-append ret line)) (set! line (read-line fd))) (close fd) (system > (string-append "rm " logfilename)) ret))) > > (this is for guile though, not s7, but you get the idea) > > > On Wed, Nov 25, 2015 at 4:38 PM, JV wrote: > >> system prints the output of the command. >> I cannot save the output with: >> >> (define sv (system ("ls")) >> >> On Wed, Nov 25, 2015 at 8:02 AM, wrote: >> >>> system is normally included in s7 in Linux -- try >>> (help system) or (system "ls -la s7.c" #t). If your >>> version of s7 was built with the compiler flag >>> WITH_SYSTEM_EXTRAS set to 0, you can still get at the >>> c library's system function via libc.scm, but >>> hopefully that isn't necessary. >>> >>> >>> >> >> >> -- >> Joseph Vijay >> >> _______________________________________________ >> Cmdist mailing list >> Cmdist at ccrma.stanford.edu >> https://cm-mail.stanford.edu/mailman/listinfo/cmdist >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Wed Nov 25 13:04:10 2015 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Wed, 25 Nov 2015 13:04:10 -0800 Subject: [CM] How to capture standard output of Linux command in s7 In-Reply-To: References: <827e8e1392297855cbd617283b47694e@ccrma.stanford.edu> Message-ID: > system prints the output of the command. > I cannot save the output with: > (define sv (system ("ls")) That's what the #t argument did in the example I gave, as mentioned in the help string. repl <1> (define sv (system "ls -la s7.c" #t)) "-rw------- 1 bil staff 2274682 Nov 24 10:36 s7.c " <2> sv "-rw------- 1 bil staff 2274682 Nov 24 10:36 s7.c " From bil at ccrma.Stanford.EDU Sat Nov 28 04:21:21 2015 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Sat, 28 Nov 2015 04:21:21 -0800 Subject: [CM] Snd 16.1 Message-ID: Snd 16.1: most of my time went into lint.scm, but the harder I work, the longer my TODO list. s7: :key and :optional removed. checked: gtk 3.19.1|2|3, sbcl 1.3.0|1, GSL 2.0 Thanks!: Norman Gray