#include "format.h"
Go to the source code of this file.
Data Structures | |
struct | _lineStreamStruct_ |
LineStream. More... | |
Defines | |
#define | ls_destroy(this1) (ls_destroy_func(this1),this1=NULL) |
Destroy a line stream. | |
Typedefs | |
typedef struct _lineStreamStruct_ * | LineStream |
LineStream. | |
Functions | |
void | ls_back (LineStream this1, int lineCnt) |
Push back 'lineCnt' lines. | |
void | ls_bufferSet (LineStream this1, int lineCnt) |
Set how many lines the linestream should buffer. | |
void | ls_cat (LineStream this1, char *filename) |
Redirect a linestream. | |
LineStream | ls_createFromBuffer (char *buffer) |
Creates a line stream from a buffer. | |
LineStream | ls_createFromFile (char *fn) |
Creates a line stream from a file. | |
LineStream | ls_createFromPipe (char *command) |
Creates a line stream from a pipe. | |
void | ls_destroy_func (LineStream this1) |
Destroys a line stream object after closing the file or pipe if they are still open (stream not read to the end) or after destroying the word iterator if the stream was over a buffer. | |
int | ls_isEof (LineStream this1) |
Determine the state of a line stream. | |
int | ls_lineCountGet (LineStream this1) |
Returns the number of the current line. | |
char * | ls_nextLine (LineStream this1) |
Get the next line from a line stream object. | |
int | ls_skipStatusGet (LineStream this1) |
Skips remainder of line stream and returns exit status which only meaningful when created from a pipe - exit status for file and buffer will always be 0. |
Definition in file linestream.h.
#define ls_destroy | ( | this1 | ) | (ls_destroy_func(this1),this1=NULL) |
void ls_back | ( | LineStream | this1, | |
int | lineCnt | |||
) |
Push back 'lineCnt' lines.
[in] | this1 | A line stream |
[in] | lineCnt | How many lines should ls_nextLine() repeat (currently, only lineCnt==1 is supported) |
Definition at line 331 of file linestream.c.
void ls_bufferSet | ( | LineStream | this1, | |
int | lineCnt | |||
) |
Set how many lines the linestream should buffer.
[in] | this1 | A line stream |
[in] | lineCnt | How many lines should ls_nextLine() repeat (currently, only lineCnt==1 is supported) |
Definition at line 351 of file linestream.c.
void ls_cat | ( | LineStream | this1, | |
char * | filename | |||
) |
Redirect a linestream.
[in] | this1 | A line stream created by one of ls_create*() |
[in] | filename | Name of file to write lines to; special cases: '-' means stdout, NULL means /dev/null (discard) |
Definition at line 414 of file linestream.c.
LineStream ls_createFromBuffer | ( | char * | buffer | ) |
Creates a line stream from a buffer.
[in] | buffer | A buffer pointer, must not be NULL |
Definition at line 190 of file linestream.c.
LineStream ls_createFromFile | ( | char * | fn | ) |
Creates a line stream from a file.
[in] | fn | File name ("-" means stdin) |
Definition at line 69 of file linestream.c.
LineStream ls_createFromPipe | ( | char * | command | ) |
Creates a line stream from a pipe.
Example: ls_createFromPipe ("zcat test.dat.Z");
[in] | command | As it would be written on the command line |
Definition at line 132 of file linestream.c.
void ls_destroy_func | ( | LineStream | this1 | ) |
Destroys a line stream object after closing the file or pipe if they are still open (stream not read to the end) or after destroying the word iterator if the stream was over a buffer.
[in] | this1 | A line stream |
Definition at line 249 of file linestream.c.
int ls_isEof | ( | LineStream | this1 | ) |
Determine the state of a line stream.
[in] | this1 | A line stream |
Definition at line 445 of file linestream.c.
int ls_lineCountGet | ( | LineStream | this1 | ) |
Returns the number of the current line.
[in] | this1 | A line stream |
Definition at line 368 of file linestream.c.
char* ls_nextLine | ( | LineStream | this1 | ) |
Get the next line from a line stream object.
This function is called from the application programs independently whether the stream is from a file, pipe or buffer
[in] | this1 | A line stream |
Definition at line 295 of file linestream.c.
int ls_skipStatusGet | ( | LineStream | this1 | ) |
Skips remainder of line stream and returns exit status which only meaningful when created from a pipe - exit status for file and buffer will always be 0.
[in] | this1 | A line stream |
Definition at line 384 of file linestream.c.