sl/roken and parsing ramblings

John Hawkinson jhawk at MIT.EDU
Sun Jun 21 10:42:59 CEST 1998


What does sl stand for?

There's an inconsistency in the way sl_command() handles return
values versus the way fs (et al) do so.

If sl_command returns -1 (should be a constant, proably), fs will
print out "$argv1: Unknown command".

But various fs commands return -1 to signal
invalid usage syntaxes.

That means that you see something like:

> /usr/arla/bin/fs lsm
fs: Required parameter '-dir' missing
lsm: Unknown command

Whereas the transarc version produces:

[mary-kay-commandos!jhawk] ~> fs lsm
fs: Missing required parameter '-dir'
[mary-kay-commandos!jhawk] ~> 

So probably the interface for sl_command() should be defined a little
more clearly and the routines called by sl_command() should return
SL_BADSYNTAX (-2?) instead of SL_BADCOMMAND (-1). Or something.

Is it intentional that the commands (well, just vos) that use
sl_help() for their help text get this bizarre formatting:

> ./vos help
addsite
        not yet implemented
apropos 
        not yet implemented

It certainly feels unfriendly. I guess I see that the

examine, volinfo
        print information about a volume

might be a more efficient use of space, but overall, I think we want
the helpsummaries for all commands to say <48 rows (common window
height). For Transarc fs/pts/vos they're at 36/16/28 rows.  For arla,
vos help is already at 56 rows.

I think that printing the canonical command name is probably
quite sufficient and it's not necessary to print the aliases.
Detailed help ("vos help addsite") could print aliases,
though.

I guess vos is the experiment for sl_help() to see how it's working?

It also coredumps on some architectures:

> (setenv SLMANDOC 1; ./vos help)
.\" Things to fix:
.\"   * correct section, and operating system
.\"   * remove Op from mandatory flags
.\"   * use better macros for arguments (like .Pa for files)
.\"
.Dd Jun 21, 1998
Segmentation fault (core dumped)

because __progname isn't initialized:

    p = strrchr(__progname, '/');

Of course, under Solaris, it will work with:

> ( setenv LD_PRELOAD 0 at 0.so.1 ; setenv SLMANDOC 1 ; ./vos help )

but you didn't want to know that, I think :-)

*** /tmp/T0057RXP	Sun Jun 21 04:36:34 1998
--- sl.c	Sun Jun 21 04:35:51 1998
***************
*** 230,235 ****
--- 230,238 ----
  sl_command(SL_cmd *cmds, int argc, char **argv)
  {
      SL_cmd *c;
+ 
+     set_progname(argv[0]);
+ 
      c = sl_match (cmds, argv[0], 0);
      if (c == NULL)
  	return -1;

...fixes things, but again it's not clear whether this really belongs
in sl_command(), a hypothetical sl_init() function, in vos' main(),
etc., etc.

I'm unhappy with the choice of __progname, since __ is reserved for
the operating system's private stuff, and we shouldn't be poking at it.
It looks like the sl/roken stuff comes from kth-krb (if not other places),
so maybe it's hard to change and there's a lot of version skew?

I'm unsure it's so wise to use -mandoc macros over -man macros, but
perhaps that's because I haven't gotten around to installing
much on this system at the moment, so I'm biased.

--jhawk





More information about the Arla-drinkers mailing list