Skip to content
Snippets Groups Projects
Commit 3e3b5058 authored by Tom Greig's avatar Tom Greig
Browse files

Add -p option to print data as it comes in

Allows you to do stuff like
$ get data | e-plot -p > data_file.csv
parent 3307ab89
No related branches found
No related tags found
No related merge requests found
......@@ -103,6 +103,8 @@ struct context {
bool sort;
bool print;
char* xaxis;
size_t xaxis_n;
......@@ -324,6 +326,13 @@ int main( int argc, char** argv ) {
.arg = G_OPTION_ARG_NONE,
.arg_data = &( context->time ),
.description = "Format x-axis as time",
}, {
.long_name = "print",
.short_name = 'p',
.flags = G_OPTION_FLAG_IN_MAIN,
.arg = G_OPTION_ARG_NONE,
.arg_data = &( context->print ),
.description = "Copy input to stdout",
}, {
NULL,
},
......@@ -1087,6 +1096,9 @@ static int data_callback( void* data ) {
context->read_buffer + strlen( context->read_buffer ),
buffer, l + 1 );
if ( context->print ) {
write( STDOUT_FILENO, buffer, l );
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment