On Mon, 10 Apr 2000, Robin Gilks wrote:

> > > The line in my node.conf that is affected is:
> > > Alias           CONVers   "telnet %{2:gb7ipd.ampr.org} 3600 \"/n %u %{1:160}\""
> > > 
> > > and its the bit in the quotes at the end that don't work no more...

Actually you'll probably find that the first part won't work either. You
won't be able to specify another convers server at runtime...

> > What does work is;
> > 
> > 'telnet %{2:gb7ipd.ampr.org} 3600 "/n %u %{1:160}\n/w *"'
>
> Changing the double quotes to single quotes and removing the escape character
> from the double quotes fixed it!!
> 
> Not an obvious problem!!

The reason is that those %-escapes get processed twice: first when the
configuration file is read and later when the alias is actually executed.
The problem is that positional parameters (%1 and %2 in this case) don't
really have a meaning when the configuration file is read. They only have
a meaning when the alias is executed. So you need to be able to enter the
alias definition so that the %-escapes are not processed while reading the
config but only at alias execution time. That required a slight change in
the config syntax. The change is documented (see the HISTORY file,
node.conf(5) manual page and the sample files) but probably very easy to
miss...

The way it works is probably easiest explained with the example included
in the sample file:

ExtCmd TIme 1 nobody /bin/echo echo %N Node session started at %I, current time is \%I.

The %N will be expanded to the NodeId (at startup so NodeId needs to be
specified above this). %I will be the current time again at the time the
config file is read. The second %I has the percent sign escaped so it will
be expanded only when the extcmd is executed. (The same effect would have
resulted from enclosing it in single quotes: '%I')

I know this may sound confusing (I certainly was first confused when
trying to code it) but IMHO when you understand it, you'll see that it is
the only clean way of implementing it.

-- 
Tomi Manninen           Internet:  [EMAIL PROTECTED]
OH2BNS                  AX.25:     [EMAIL PROTECTED]
KP20ME04                Amprnet:   [EMAIL PROTECTED]

Reply via email to