]> git.evergreen-ils.org Git - OpenSRF.git/commit
Patch from Scott McKellar to clean up srfsh's user interface:
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 15 Jul 2007 02:18:41 +0000 (02:18 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 15 Jul 2007 02:18:41 +0000 (02:18 +0000)
commit81b83621cfd5bac08adea1425f73c00c95ef75ae
tree40d1e7cfc21c287958569609919f5f225d39158b
parent8f633a512eb0c54d0646a2c9d898b278fa992a5c
Patch from Scott McKellar to clean up 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.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1035 9efc2488-bf62-4759-914b-345cdb29e865
src/srfsh/srfsh.c