dot/mykermrc.in: More awful hacking to set directories.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 20 Feb 2012 10:43:42 +0000 (10:43 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 20 Feb 2012 10:43:42 +0000 (10:43 +0000)
I don't understand how Kermit's space-splitting rules apply to variables
yet, but passing a variable reference to SET MUMBLE DIRECTORY doesn't
work, and stuffing the whole lot into a macro and then running it does,
so do that despite its awfulness.

dot/mykermrc.in

index 9baf517..b02503a 100644 (file)
@@ -23,31 +23,28 @@ set dial ld-prefix 0
 set dial intl-prefix 00
 
 ;; Directories.
-def _dir_exist {
-       undef _dir
-       for \%i 1 \fdim(&v) 1 {
-               if exist \&v[\%i] {
-                       if def _dir assign _dir \m(_dir) \&v[\%i]
-                       else assign _dir \&v[\%i]
+def _set_dir {
+       local what list awful
+       assign what \%1
+       undef list
+       shift
+
+       for \%i 1 \v(argc)-1 1 {
+               if exist \%1 {
+                       if def list assign list \m(list) \%1
+                       else assign list \%1
                }
+               shift
        }
+       assign awful { set \m(what) directory \m(list) }
+       do awful
 }
-
-local \&v
-local \%n
-array dcl v = -
+_set_dir network -
        \m(_profile)kermit/net.shared -
        \m(_dot)net.local
-local _dir
-_dir_exist
-set network directory \m(_dir)
-
-array dcl v = -
+_set_dir dial -
        \m(_profile)kermit/dial.shared -
        \m(_dot)dial.local
-local _dir
-_dir_exist
-set dial directory \m(_dir)
 
 ;; If my terminal is UTF8 then try to use that consistently.  This may not
 ;; work, but in my world as it is it's quite likely to.