rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: Gert-Jan Vons <vons@ocegr.fr>
To: David Luyer <david_luyer@pacific.net.au>
Cc: rc@hawkwind.utcs.toronto.edu
Subject: Re: building rc on QNX4
Date: Thu, 11 May 2000 08:26:30 -0400	[thread overview]
Message-ID: <4.3.1.2.20000511140729.00b2aca0@mailhost.ocegr.fr> (raw)
In-Reply-To: <20000509043420.2856.qmail@pantransit.reptiles.org>

David Luyer <david_luyer@pacific.net.au> wrote:

>Basically some OS's (Digital Unix for one I think) have C libraries 
>which choke horribly if the size of the command line + environment array 
>is greater than a certain value, and if you have a number of complex
>functions in your shell this value (64k?) can be a pain.

For me "whatis |wc -c" returns 3308 bytes. However, I use a lot of lazy 
function loading, as has been talked about before on this list.

In my .rcrc, I have:

># Lazy function (un)loading.
>#
>fnlib = $home/bin/rcfuncs
>fn _ld { ~ $#* 1 && builtin . $fnlib/$1 }
>fn _unld { ~ $#* 1 && fn $1 { _ld $0 && $0 $* }}
>
># init all lazy functions by scanning the $fnlib directory
>name = () for ( name in `{builtin cd $fnlib ; ls} ) _unld $name

where my $home/bin/rcfuncs directory contains a number of files with rc 
function definitions (note that the file name must match the name of the 
function defined in it)

So until I actually use my rc functions, for a lot of them there's only 
"fn somefunc {_ld $0&&$0 $*}" in my environment, which gets expanded to 
the real function the first time I call somefunc.

And instead of re-reading my .rcrc file after every change to some 
function, I just do an "_unld newfunc", and the next time I call 
"newfunc", it is automatically reloaded from file.

If your functions are really big, you could even unload them 
automatically after use. But in that case, turning those functions into 
rc shell scripts is probably simpler...



         Gert-Jan
-----
"I have every sympathy with the American who was so horrified
  by what he had read about the effects of smoking that he gave
  up reading."
     - Henry G. Strauss



  reply	other threads:[~2000-05-11 20:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-09  4:34 Smarasderagd
2000-05-11 12:26 ` Gert-Jan Vons [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-05-08 15:23 Sam Roberts
2000-05-09  8:25 ` Carlo Strozzi
2000-05-08 15:15 Smarasderagd
2000-05-09  8:22 ` Carlo Strozzi
2000-05-08 10:19 Bengt Kleberg
2000-05-06 21:47 Byron Rakitzis
2000-05-04 13:46 Sam Roberts
2000-05-04  8:45 Byron Rakitzis
2000-05-06 10:28 ` Carlo Strozzi
2000-05-07 17:46   ` Paul Haahr
2000-05-08  8:01     ` Carlo Strozzi
2000-05-06 16:35 ` Jeremy Fitzhardinge
     [not found] <sroberts@uniserve.com>
2000-04-26 15:02 ` Sam Roberts
2000-04-27 16:56   ` Scott Schwartz
2000-04-27 20:41     ` Sam Roberts
2000-04-27 17:39   ` Carlo Strozzi
2000-05-02 14:41     ` Tim Goodwin
2000-05-04 15:18       ` Carlo Strozzi
2000-05-08  8:29         ` Tim Goodwin
2000-05-08  8:58           ` Chris Siebenmann
2000-05-08  9:15             ` Tim Goodwin
2000-05-08 23:25               ` Stephen Tell
2000-05-08 11:50           ` David Luyer
2000-05-08 13:28           ` Carlo Strozzi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4.3.1.2.20000511140729.00b2aca0@mailhost.ocegr.fr \
    --to=vons@ocegr.fr \
    --cc=david_luyer@pacific.net.au \
    --cc=rc@hawkwind.utcs.toronto.edu \
    --subject='Re: building rc on QNX4' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).