diff options
-rw-r--r-- | el.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -58,7 +58,8 @@ static int nextchar( void ) { | |||
58 | return getchar(); | 58 | return getchar(); |
59 | if( *g_immediatelinenums ) | 59 | if( *g_immediatelinenums ) |
60 | return *g_immediatelinenums++; | 60 | return *g_immediatelinenums++; |
61 | return EOF; | 61 | g_immediatelinenums = 0; |
62 | return ' '; | ||
62 | } | 63 | } |
63 | 64 | ||
64 | // scans the text file for the requested line | 65 | // scans the text file for the requested line |
@@ -172,6 +173,16 @@ static int acquire_lineno( int c ) { | |||
172 | 173 | ||
173 | static void usage() { | 174 | static void usage() { |
174 | fputs( "Usage: el [-0Ggnxh] [-i linenums] filename .. < linenum_file\n", stderr); | 175 | fputs( "Usage: el [-0Ggnxh] [-i linenums] filename .. < linenum_file\n", stderr); |
176 | |||
177 | fputs( " -i Use <linenums> before (or instead) using line numbers from stdin\n", stderr ); | ||
178 | fputs( " -0 Line numbers are zero base\n", stderr ); | ||
179 | fputs( " -x Line numbers default to base 16\n", stderr ); | ||
180 | fputs( " -g Line numbers are followed by colon (as grep -n produces)\n", stderr ); | ||
181 | fputs( " -G Like -g but also prepend output line by input line\n", stderr ); | ||
182 | fputs( " -n Prepend output by line number and colon (like grep -n)\n", stderr ); | ||
183 | fputs( " -h Print this help\n", stderr ); | ||
184 | fputs( "\nExample: grep -n Foo File1 | el -Gn File2 File3 | grep Bar | el -Gn File4\n", stderr ); | ||
185 | |||
175 | } | 186 | } |
176 | 187 | ||
177 | int main( int argc, char **argv ) { | 188 | int main( int argc, char **argv ) { |