[comp.mail.mush] Maximum size

sergio@squid.rtech.com (Sergio Aponte) (08/31/90)

	In my .mushrc, I put 

	alias aname This is it <long list of addresses in a single line with spaces between them>

	Is there a max len to this? After a few lines it complained of an 
	unmatched "<", and mush started behaving strange...

	Why can't I separate this into several lines ?

	Somebody asked me about "VMS" style. In VMS, you can put a list of
	addresses in a file, and have an alias point to the file. Can that
	be done in mush?

				I don't ask until I try it and it destroys life
				as we know it!
							Sergio.
-------------------------------------------------------------------------------
| Internet: sergio@squid.ingres.com      Sergio L. Aponte, MTS @ Ingres Corp. |
| UUCP    : {sun,mtxinu,pyramid,pacbell,hoptoad,amdahl}!ingres!squid!sergio   |
-------------------------------------------------------------------------------

schaefer@ogicse.ogi.edu (Barton E. Schaefer) (09/01/90)

In article <5761@rtech.Ingres.COM> sergio@squid.Ingres.COM (Sergio Aponte) writes:
} 	In my .mushrc, I put 
} 
} 	alias aname This is it <long list of addresses in a single line with spaces between them>
} 
} 	Is there a max len to this? After a few lines it complained of an 
} 	unmatched "<", and mush started behaving strange...

The longest line (or series of lines continued by using backslash-newline)
that mush can read from an init file is BUFSIZ characters, whatever that
happens to be defined as on your system.  The absolute limit on the number of
characters in an alias expansion is HDRSIZ, which is a mush constant and is
guaranteed to be >= BUFSIZ (unless your mush installer made a booboo).

A common BUFSIZ is 1024, but longer and shorter values are sometimes used.

The reason that mush "started behaving strange" is that it began attempting
to execute the trailing part(s) of the line, beyond BUFSIZ, as commands.

} 	Why can't I separate this into several lines ?

You can, by placing a backslash before each newline, but the limit still
applies.  Continuation lines are provided mainly for human aesthetics.

The only good way to accomplish this is to use something like

    alias aname aname1 aname2 aname3

    alias aname1 <first hunk of addresses for aname>
    alias aname2 <next hunk of addresses>
    alias aname3 <remaining hunk of addresses>

where each "hunk" of names is less than (BUFSIZ-strlen("alias aname3 "))
characters in length.

This will still break at alias expansion time if your installer has not
provided a sufficiently large HDRSIZ to include all the names.  For any
installers out there listening, I recommend using (10*BUFSIZ) for the
HDRSIZ value unless your memory or stack space is very limited.  This
has been large enough for a fairly extensive mailing list maintained
here at OGI by one of the other students.

} 	Somebody asked me about "VMS" style. In VMS, you can put a list of
} 	addresses in a file, and have an alias point to the file. Can that
} 	be done in mush?

No.
-- 
Bart Schaefer						schaefer@cse.ogi.edu

rsalz@bbn.com (Rich Salz) (09/05/90)

In <11854@ogicse.ogi.edu> schaefer@ogicse.ogi.edu (Barton E. Schaefer) writes:
>The reason that mush "started behaving strange" is that it began attempting
>to execute the trailing part(s) of the line, beyond BUFSIZ, as commands.
Oooh, bummer.

Whenever you do "fgets()" you should always check for a trailing newline,
and if you don't find one, read until you do after printing a diagnostic.
	/r$
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.

msir@sulu.cc.rochester.edu (Mark Sirota) (09/05/90)

In article <11854@ogicse.ogi.edu> schaefer@ogicse.ogi.edu (Barton E. Schaefer) writes:
>The only good way to accomplish this is to use something like
>
>    alias aname aname1 aname2 aname3
>
>    alias aname1 <first hunk of addresses for aname>
>    alias aname2 <next hunk of addresses>
>    alias aname3 <remaining hunk of addresses>

In UCB Mail, you can do
	alias aname <first hunk of addresses for aname>
	alias aname <next hunk of addresses>
	alias aname <remaining hunk of addresses>

I personally think this is pretty ugly and counterintuitive, but maybe
it's also a reasonable solution if this is a problem for lots of people.
--
Mark Sirota - University of Rochester Computing Center, Rochester NY
 Internet: msir@cc.rochester.edu
 Bitnet:   msir@uordbv.bitnet
 UUCP:     {decvax,harvard,ames,rutgers}!rochester!ur-cc!msir