Skip to content

Conversation

CaSchmidt
Copy link

Hi Oliver,
as discussed, the implementation of reading PDU data from binary file instead of STDIN.
-- Carsten

return 0;
}

if( (fd = open(filename, O_RDONLY)) == -1 ) {
Copy link
Member

Choose a reason for hiding this comment

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

no assignments in if-statements
please adopt the coding style with parenthesis and spaces


ssize_t read_binary_file(void *buffer, const size_t siz_buffer, const char *filename)
{
int fd = -1;
Copy link
Member

Choose a reason for hiding this comment

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

No need for initialization

ssize_t read_binary_file(void *buffer, const size_t siz_buffer, const char *filename)
{
int fd = -1;
ssize_t num_read = -1;
Copy link
Member

Choose a reason for hiding this comment

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

dito

exit(1);
}

if( buflen < 1 ) {
Copy link
Member

Choose a reason for hiding this comment

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

if (buflen > 0) { ... ??

additional the indention seems wrong

break;

case 'i':
buflen = read_binary_file(&buf[0], sizeof(buf), optarg);
Copy link
Member

Choose a reason for hiding this comment

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

use 'buf' instead of '&buf[0]'

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.

2 participants