Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #21229
| Newsgroups | comp.lang.forth |
|---|---|
| Date | 2013-03-29 15:00 -0700 |
| References | <1e8444f5-2e5b-497f-b4f9-7fc84fdfa38d@googlegroups.com> |
| Message-ID | <2c69265c-bb98-470e-be5b-d7be766713d0@googlegroups.com> (permalink) |
| Subject | Re: System calls from SP-Forth/Linux |
| From | ifsp.mauro@gmail.com |
I made a few experiments with SP-FORTH. According to the manual (http://spf.sourceforge.net/docs/intro.en.html#dll), SP-FORTH loads the following shared objects:
libc libdl and libpthread
by default. One of the entries of libc is system. Let's call system from SP-Forth:
~/calls$ rlwrap ../spf4orig
SP-FORTH - ANS FORTH 94 for Linux
Open source project at http://spf.sf.net
Russian FIG at http://www.forth.org.ru ; Started by A.Cherezov
Version 4.19 Build 510 at 16.Aug.2008
(( S" ls" )) system DROP
ola ola2 upper.c upper.c~ upper.o upper.so
Ok
It works! However, I was not able to call commands from the same shell where SP-Forth is running. Let's give an example:
(( S" mkdir ola4" )) system DROP
Ok
(( S" ls" )) system DROP
ola ola2 ola3 ola4 upper.c upper.c~ upper.o upper.so
Ok
As one can see, the system call (mkdir) created a new directory (ola4). Now let's make another call:
(( S" pwd" )) system DROP
/calls
Ok
(( S" cd /home/" )) system DROP
Ok
(( S" pwd" )) system DROP
/calls
Ok
It seams the system call S" cd /home/" does not work. What really happened is that SP-Forth created another shell, changed the prompt directory to /home/ and reverted to the old shell. bigFORTH shows the same behavior with cd:
ANS bigFORTH 386-Linux rev. 2.4.0
pwd /home/wlabia/frt/bigforth ok
sh cd /home ok
pwd /home/wlabia/frt/bigforth ok
I hope that a member of this group can give a solution to this problem. I would like to point out that bigFORTH has a cd command that works as expected. However SP-Forth does not have a default cd word.
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar
System calls from SP-Forth/Linux Eduardo Costa <edu500ac@gmail.com> - 2013-03-28 13:52 -0700
Re: System calls from SP-Forth/Linux Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-29 02:10 +0100
Re: System calls from SP-Forth/Linux Eduardo Costa <edu500ac@gmail.com> - 2013-03-29 03:20 -0700
Re: System calls from SP-Forth/Linux ifsp.mauro@gmail.com - 2013-03-29 15:00 -0700
Re: System calls from SP-Forth/Linux Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-30 00:13 +0100
Re: System calls from SP-Forth/Linux albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-30 12:28 +0000
Re: System calls from SP-Forth/Linux Rosangela Medeiros da Silva <rosangelamesil@gmail.com> - 2013-03-29 19:14 -0700
Re: System calls from SP-Forth/Linux albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-30 12:32 +0000
Re: System calls from SP-Forth/Linux Rosangela Medeiros da Silva <rosangelamesil@gmail.com> - 2013-03-30 06:41 -0700
Re: System calls from SP-Forth/Linux albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-30 15:59 +0000
Re: System calls from SP-Forth/Linux Rosangela Medeiros da Silva <rosangelamesil@gmail.com> - 2013-03-30 18:36 -0700
Re: System calls from SP-Forth/Linux albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-31 02:39 +0000
Re: System calls from SP-Forth/Linux Rosangela Medeiros da Silva <rosangelamesil@gmail.com> - 2013-03-31 07:53 -0700
Re: System calls from SP-Forth/Linux Bernd Paysan <bernd.paysan@gmx.de> - 2013-04-01 02:44 +0200
csiph-web