How to define macros in .netrc?

Max Heffler max at compaq.com
Thu May 16 00:38:13 AEST 1991


pravin at eniac.seas.upenn.edu writes:

>In a previous article max at compaq.com (Max Heffler) writes:
>>
>>The following works for me:
>>
>>machine oswego.oswego.edu login anonymous password max at compaq.com macdef init
>>ls
>>
>>Maybe it has something to do with line continuation...

>I get a segmentation fault, when I try putting macdef in?  Any clues?

>From man page of ftp:

     macdef macro-name
          Define a macro.  Subsequent lines  are  stored  as  the
          macro  macro-name;  a  null  line  (consecutive NEWLINE
          characters in a file or RETURN characters from the ter-
          minal)  terminates  macro input mode.  There is a limit
          of 16 macros and 4096 total characters in  all  defined
          macros.  Macros remain defined until a close command is
          executed.

	  The macro processor interprets `$' and `\'  as  special
          characters.  A `$' followed by a number (or numbers) is
          replaced by the corresponding  argument  on  the  macro
          invocation command line.  A `$' followed by an `i' sig-
          nals that macro processor that the executing  macro  is
          to be looped. On the first pass `$i' is replaced by the
          first argument on the macro invocation command line, on
          the  second pass it is replaced by the second argument,
          and so on.  A `\' followed by any character is replaced
          by  that  character.   Use  the  `\' to prevent special
          treatment of the `$'.

--
Max Heffler, Senior Software Engineer        internet: max at compaq.com
Compaq Computer Corporation     uucp: ..!uunet!max at compaq.com
P.O. Box 692000 - M050701       phone: (713) 378-8366
Houston, Texas  77269-2000      fax:   (713) 374-7305



More information about the Comp.unix.questions mailing list