Skip to content

Add --pipe option to nngcat#1423

Open
thejoelw wants to merge 1 commit into
nanomsg:mainfrom
thejoelw:master
Open

Add --pipe option to nngcat#1423
thejoelw wants to merge 1 commit into
nanomsg:mainfrom
thejoelw:master

Conversation

@thejoelw

@thejoelw thejoelw commented Feb 4, 2021

Copy link
Copy Markdown

It would be nice for nngcat to be able to send a stream of data from a unix pipe (stdin or a named pipe file). This is impossible to do with the existing --file option, which reads the data into memory, then sends it one or more times. With the proposed --pipe option, each line from the specified pipe is sent as a message. This is more similar to how the nc and socat utilities function.

Comment thread src/tools/nngcat/nngcat.c

int rv;
nng_msg * msg;
char * line = NULL;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor indenting error. We use indents by tab, where the tab is 8 cells wide. Please see our .clang-format.

@gdamore

gdamore commented Feb 7, 2021

Copy link
Copy Markdown
Contributor

This PR is unfortunately port portable (see the windows failures).

May consider converting it to use stdio (which is supported under all ANSI C platforms, including Windows.)

@dch

dch commented Feb 28, 2021

Copy link
Copy Markdown

this is a very nice feature - thanks!

@gdamore gdamore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be converted to use fgets() or something portable in lieu of getline().

And I'd appreciate it if you could run this through clang-format.

@wishdev

wishdev commented Mar 17, 2024

Copy link
Copy Markdown

I took the original commit, switched it to fgets and ran clang-format on the file on my branch here [1] - I'm never sure the best way to move this type of thing forward. Should I just create a new pull request?

[1] - https://github.com/wishdev/nng/tree/fgets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants