From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from janus.ocegr.fr ([194.3.183.34]) by hawkwind.utcs.toronto.edu with SMTP id <26118>; Thu, 11 May 2000 16:55:15 -0400 Received: (qmail 15182 invoked from network); 11 May 2000 12:19:31 -0000 Received: from hydra.ocegr.fr (HELO ocegr.fr) (134.188.135.3) by janus.ocegr.fr with SMTP; 11 May 2000 12:19:31 -0000 Received: from alcina.ocegr.fr (alcina.ocegr.fr [134.188.136.183]) by ocegr.fr (8.8.8+Sun/8.8.8) with ESMTP id OAA12715; Thu, 11 May 2000 14:26:33 +0200 (MET DST) Message-Id: <4.3.1.2.20000511140729.00b2aca0@mailhost.ocegr.fr> X-Sender: vons@mailhost.ocegr.fr X-Mailer: QUALCOMM Windows Eudora Version 4.3.1 Date: Thu, 11 May 2000 08:26:30 -0400 To: David Luyer From: Gert-Jan Vons Subject: Re: building rc on QNX4 Cc: rc@hawkwind.utcs.toronto.edu In-Reply-To: <20000509043420.2856.qmail@pantransit.reptiles.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed David Luyer 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