* Bill Allombert <[EMAIL PROTECTED]> [2006-06-27 11:12]:
> However, I think the best fix would be to rewrite CommandWOArgs so that
> it does not need to use shell() at all, since it is slow.
I cannot think of a way to extract the first whitespace seperated token
from the command with the functions provided by the debian menu system.
If there is, please give me a hint.

If not, I would suggest the following
(please keep in mind that the actually executed command will be run
in a shell and is the unmodified $command, and is not affected by the
return value of CommandWOArgs)

function CommandWOArgs()=shell("sh -c 'echo -n $0' "
                          replacewith(stripdir($command),
                                        "\\\"$`'!", "      ")
                         );

Again, the purpose of this function is to extract the name of the binary
that will be run. The menu entry will only be displayed if fvwm-crystal
finds a binary with this name in the PATH (and assign an icon with that name).
Now this will not work for shell builtin functions, but the only effect
will be that those menu entries will not be visible.

The idea of the above is, that stripdir will by chance provide me
with the name of an executed binary (if there is one with absolute
path given). This will, e.g. work for Bill's testbacktics example.
I will then replace all shell special characters with spaces, and take
the first word of the remaining string.

This approach will not work for some menu entries, but should not
yield any errors when running update-menus. For those entries where
it does not yield the correct name of the executable (if there is any),
the entry will simply not be available.

-Mike


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to