About quoting and functions

I get a weird quoting issue. I rewrote the notification area manager in Fvwm-Crystal, that in order to remove some environment variables. It can use trayer or stalonetray.

With trayer, the last parameter of the trayer command is a free parameter, which is typically unused or of the form <–something value>.

[code]# 8 parameters
DestroyFunc TrayerPanel
AddToFunc TrayerPanel

  • I Exec exec trayer
    –widthtype $[0]
    –heighttype $[1]
    –height $[2]
    –edge $[3]
    –align $[4]
    –margin $[5]
    –distance $[6]
    $[7]

9 parameters

DestroyFunc NotificationArea
AddToFunc NotificationArea

  • I Test (EnvMatch NotificationAreaManager trayer) TrayerPanel $0 $1 $2 $3 $4 $5 $6 $7 $8

8 parameters again

PipeRead ‘echo NotificationArea
pixel pixel 35 bottom left $(($((355))+2))
1 \\\"–width $(($(($((120
35))/24))+1))\\\"’

8 parameters always

PipeRead ‘echo TrayerPanel
pixel pixel 35 bottom left $(($((355))+2))
1 \"–width $(($(($((120
35))/24))+1))\"’[/code]

This 2 PipeRead calls do work. When the second one is simpler and avoid the NotifArea function, which is better too, the first call was very interesting to me, because we can see how quoting is working inside functions.

For TrayerPanel to work, its last parameter must be quoted in that case: “–width number”.

The quoting is easy when calling TrayerPanel directly. But when we call it trough another function, this function must send the quoting to TrayerPanel. For what I understand, the middle function will get \\\\"--width number\\\\" . It will understand \\\\"--width as 1 parameter, and number\\\\" as another one.

Further, the middle function will send \\"--width number\\" to TrayerPanel, which is exactly the same than with a direct call.