Marcin Pawlik <[EMAIL PROTECTED]> writes:
> On Mon, Mar 24 at 10:33, Dominik Vogt wrote:
> > On Sun, Mar 23, 2003 at 06:30:32PM -0800, Elliot Sowadsky wrote:
> >> 
> >> 2.5.6 on solaris 5.8
> >> 
> >> piperead example in faq gives shell syntax error
> >> 
> >>     AddToFunc   CenterWindow
> >>     + I ThisWindow Piperead "echo Move \
> >>       $(( $[vp.width]/2-$[w.width]/2 ))p \
> >>       $(( $[vp.height]/2-$[w.height]/2 ))p"
> >> 
> >> sh complains about missing (
> >> 
> >> Actually i'm trying to calculate which horizontal pager window i'm in
> >> when i click on it.
> > 
> > Look like the solaris /bin/sh does not know the "$(( ... ))" syntax.  
> 
> Checked in 5.9 and it really doesn't.
> 
> > What is the most portable syntax for arithmetic expansion?
> 
> Probably using (external) expr, but AFAIR the $(( )) arithmetic
> expansion should be supported in all POSIX compliant shells.

I checked, that notation is part of the POSIX requirement for shells.

This is what the Solaris 8 man page says about popen (what PipeRead uses):

popen:

     The environment of the executed command  will  be  as  if  a
     child  process  were  created  within the popen() call using
     fork(2). If  the  application  is  standard-conforming  (see
     standards(5)), the child is invoked with the call:

          execl("/usr/bin/ksh", "ksh", "-c", command, (char *)0);

     otherwise, the child is invoked with the call:

          execl("/usr/bin/sh", "sh", "-c", command, (char *)0);


So, our man page statement about PipeRead using /bin/sh is not
strictly true on Solaris.

I built fvwm with gcc and arithmetic in PipeRead appears to work
for me.

The standards(5) man page is a bit confusing, but I think it
says you should use c89 instead of cc or define
_POSIX_C_SOURCE=199506L
when using Sun's compiler.

-- 
Dan Espen                           E-mail: [EMAIL PROTECTED]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [EMAIL PROTECTED]
To report problems, send mail to [EMAIL PROTECTED]

Reply via email to