From: Dan Cross <cross@math.psu.edu>
To: 9fans@cse.psu.edu
Cc: 9trouble@cse.psu.edu
Subject: [9fans] /sys/lib/libauth/newns.c patch to add `.' command, handle quoting.
Date: Thu, 27 Feb 2003 11:30:36 -0500 [thread overview]
Message-ID: <200302271630.h1RGUaM21552@augusta.math.psu.edu> (raw)
A while back I mentioned that I had modified newns.c to add a ``.''
command to source namespace commands from other files. I also changed
splitargs() within newns.c to call tokenize instead of doing it's own
tokenization; this allows it to correctly deal with quoted tokens (like
#rune, as returned by ns). I think these changes are handy enough to
share; I'm using them all over the place now. In particular, I added
the following to the end of my /lib/namespace:
. /lib/local.namespace
This allows me to easily make custom changes to my namespace without
a maintenance hassle; usually, one wants to add something, not take
it away, from a common core. This makes doing that pretty trivial,
as I can just add local customizations to /lib/local.namespace and
have them apply to all hosts on my network (note: the name is
local.namespace instead of namespace.local to avoid clashes if you
added a host named, ``local'' to your network; newns() still looks
for /lib/namespace.$sysname, and uses that to override /lib/namespace
if it exists). Note that at the end of /lib/local.namespace, I have:
. /lib/$sysname.namespace
To pick up system dependent namespace changes. This is preferable
to /lib/namespace.$sysname since it allows me to add a delta to my
common namespace, instead of overriding it completely.
It'd be nice to see this stuff go onto sources.
- Dan C.
All diffs are in diff -e format. The diff for /lib/namespace is trivial:
term% diff -e /n/sources/plan9/lib/namespace /lib/namespace
28a
# site dependent
. /lib/local.namespace
.
term%
And the changes to newns.c are:
241a
if(q && q < arg)
arg = q;
q = utfrune(p, L'.');
.
213c
if (n == (maxargsplus1 - 1))
return 0;
return n;
.
210c
if (!argbuf)
.
197,208c
n = tokenize(p, argv, maxargsplus1);
for (i = 0; i < n; i++) {
q = argv[i];
argv[i] = argbuf;
.
195c
int i, n;
.
192c
splitargs(char *p, char *argv[], char *argbuf, int maxargsplus1)
.
136c
if(strcmp(argv0, ".") == 0 && argc == 1){
Biobuf *spec;
spec = Bopen(argv[0], OREAD);
if(spec == nil){
werrstr("can't open %s: %r", argv[0]);
return;
}
nsfile(spec, rpc);
Bterm(spec);
}else if(strcmp(argv0, "bind") == 0 && argc == 2)
.
74,79d
69c
argc = splitargs(cmd, argv, argbuf, NARG + 1);
.
61a
nsfile(spec, rpc);
Bterm(spec);
if(rpc){
close(rpc->afd);
auth_freerpc(rpc);
}
return 0;
}
static void
nsfile(Biobuf *spec, AuthRpc *rpc)
{
int argc;
char *cmd, *argv[NARG + 1], argbuf[MAXARG*NARG];
.
27d
25d
16a
static void nsfile(Biobuf *, AuthRpc *);
.
reply other threads:[~2003-02-27 16:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200302271630.h1RGUaM21552@augusta.math.psu.edu \
--to=cross@math.psu.edu \
--cc=9fans@cse.psu.edu \
--cc=9trouble@cse.psu.edu \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).