[OPEN-ILS-DEV] PATCH: srfsh.c (user interface)
Scott McKellar
mck9 at swbell.net
Sat Jul 14 19:39:14 EDT 2007
This patch adds some minor niceties to the srfsh's user interface.
---------------
1. srfsh exits the main loop in two circumstances. The first is when
it sees the "quit" or "exit" command. The second is when it sees
end-of-file, either because it reads the end of a script or because
the user enters the associated keystrokes (typically Control-D).
In the case of end-of-file, srfsh exits without issuing another
newline. As a result, the next shell prompt shows up concatenated
to the srfsh prompt. This result is harmless but annoying.
I tweaked the code to detect this situation and issue an extra
newline, so that the next shell prompt show up on a line by itself.
2. I strip off leading whitespace before processing the input
command.
As a result, srfsh will now recognize "quit", "exit", or a leading
exclamation point, even when preceded by whitespace. Other commands
are not affected because strtok() already strips off leading
blanks. Tab characters don't matter because readline() removes them.
3. I also strip off trailing whitespace. This measure affects only
the "quit" and "exit" commands.
4. I ignore input lines whose first non-whitespace character is an
octothorpe ('#', also known as hash, pound, or tic-tac-toe). In
other words, scripts can now have comments.
--------------
Some users may have developed scripts that depend on the previous
behavior of srfsh. In particular, with the old srfsh it was possible
to comment things out by adding leading blanks. Such "comments"
would result in error messages but would be otherwise ignored.
As a result, it is possible (though probably unlikely) that this
patch will have unexpected and unwelcome consequences for some
people. At a minimum, users should be warned. At a maximum, some
or all of these changes could be dropped. Your call.
Scott McKellar
http://home.swbell.net/mck9/ct/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: srfsh_c_6.patch
Type: text/x-patch
Size: 2315 bytes
Desc: 434933483-srfsh_c_6.patch
Url : http://list.georgialibraries.org/pipermail/open-ils-dev/attachments/20070714/db7bc176/srfsh_c_6.bin
More information about the Open-ils-dev
mailing list