[PATCH] Record-client program to read from a file for --input=<FILE> flag
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Jun 28 18:20:33 UTC 2019
----- Am 28. Jun 2019 um 18:20 schrieb Gedare Bloom gedare at rtems.org:
> On Fri, Jun 28, 2019 at 10:15 AM Gedare Bloom <gedare at rtems.org> wrote:
>>
>> On Fri, Jun 28, 2019 at 5:02 AM Ravindra Meena <rmeena840 at gmail.com> wrote:
>> >
>> > ---
>> > misc/record/record-main.c | 35 ++++++++++++++++++++++++-----------
>> > 1 file changed, 24 insertions(+), 11 deletions(-)
>> >
>> > diff --git a/misc/record/record-main.c b/misc/record/record-main.c
>> > index b4591e3..14023e2 100644
>> > --- a/misc/record/record-main.c
>> > +++ b/misc/record/record-main.c
>> > @@ -39,6 +39,8 @@
>> > #include <string.h>
>> > #include <unistd.h>
>> > #include <inttypes.h>
>> > +#include<fcntl.h>
>> > +#include<errno.h>
>> >
>> add space before <
>>
>> when writing code, aim to be consistent with surrounding code, and
>> with coding style rules
>>
>> > #include <netinet/in.h>
>> > #include <arpa/inet.h>
>> > @@ -52,6 +54,7 @@ static const struct option longopts[] = {
>> > { "host", 1, NULL, 'H' },
>> > { "port", 1, NULL, 'p' },
>> > { "items", 1, NULL, 'i' },
>> > + { "input", 1, NULL, 'f' },
>>
>> I know you were asked to add --input, however, since 'i' is already
>> used, it might be sensible to use --file= and 'f'?
>>
>> > { NULL, 0, NULL, 0 }
>> > };
>> >
>> > @@ -111,32 +114,35 @@ RB_GENERATE_INTERNAL( active, client_item, active_node,
>> > item_cmp, static inline
>> > static void usage( char **argv )
>> > {
>> > printf(
>> > - "%s [--host=HOST] [--port=PORT] [--items=ITEMS]\n"
>> > + "%s [--host=HOST] [--port=PORT] [--items=ITEMS] [--input=INPUT]\n"
>> > "\n"
>> > "Mandatory arguments to long options are mandatory for short options too.\n"
>> > - " -h, --help print this help text\n"
>> > - " -H, --host=HOST the host IPv4 address of the record server\n"
>> > - " -p, --port=PORT the TCP port of the record server\n"
>> > - " -i, --items=ITEMS the maximum count of active record items\n",
>> > + " -h, --help print this help text\n"
>> > + " -H, --host=HOST the host IPv4 address of the record
>> > server\n"
>> > + " -p, --port=PORT the TCP port of the record server\n"
>> > + " -i, --items=ITEMS the maximum count of active record items\n"
>> Why is this reformatting the existing strings?
>>
>> > + " -input, --input=INPUT the file input\n",
>> > argv[ 0 ]
>> > );
>> > }
>> >
>> > -static int connect_client( const char *host, uint16_t port )
>> > +static int connect_client( const char *host, uint16_t port, const char
>> > *input_file ,bool input_file_flag )
>>
>> This is > 80 characters.
>> https://devel.rtems.org/wiki/Developer/Coding/Conventions#Formatting
>>
> I guess this is not RTEMS code, so you should refer to your mentor
> what would be the coding standard in use.
It used to be the RTEMS style.
More information about the devel
mailing list