Andrew Bartlett wrote:
> While I can't complain about all these nice new features, I'm a bit
> worried about smbclient becoming rpcclient. That is: we made a
> decision to declare rpcclient 'developer only' feature, because it was
> becoming unmaintainable, particularly in terms of not changing for
> scripts.
>
> How do we avoid repeating that?


This doesn't address maintainability, but does make
the task of keeping scripts working much easier...

Define an option for parseable output, without
indentation, line-wrapping or other formatting
for human use.

Let it produce a line from the current data,
optionally with a reserved version number at the beginning.

For example, pvs normally produces "chatty"
output for humans on Solaris, thusly

froggy> pvs /usr/lib/libelf.so.1
libc.so.1 (SUNW_1.1, SUNWprivate_1.1);
libelf.so.1;
SUNW_1.5;
SUNW_1.4;
SUNW_1.3;
SUNW_1.2;
SUNW_1.1;
SUNW_0.7;
SUNWprivate_1.1;

But if you want it to shut up, you say

froggy> pvs -don /usr/lib/libelf.so.1
/usr/lib/libelf.so.1 - SUNW_1.5;
/usr/lib/libelf.so.1 - SUNWprivate_1.1;

... and so get output suitable for a script to parse.

With such line-oriented output you can always
1) add columns to the right, and
2) replace an obsolete columns with a "-"


For example, imagine we wanted to add an OS
release corresponding to the version number.
This might look like

froggy> pvs -don /usr/lib/libelf.so.1
/usr/lib/libelf.so.1 - SUNW_1.5 2.5.1
/usr/lib/libelf.so.1 - SUNWprivate_1.1 2.0

A shell script of the form
cat $file |\
while read path junk version rest; do
...
done
will not notice that the "rest" token now contains
a number, not just a newline.

--dave
--
David Collier-Brown, | Always do right. This will gratify
System Programmer and Author | some people and astonish the rest
davecb@spamcop.net | -- Mark Twain