cli only shows usage information

Questions related to other modules
Post Reply
hardillb
Posts: 13
Joined: 13 Feb 2020, 23:19

cli only shows usage information

Post by hardillb » 25 Mar 2020, 12:45

I'm having a play with looking at session information and I'm having problems with the accel-cmd tool

With nearly any arguments and commands I always just get the usage instructions

Code: Select all

$ accel-cmd show sessions
Usage:	accel-cmd [-v] [-4] [-6] [-n] [-f FAMILY] [-H HOST] [-p PORT] [-t TIMEOUT] [COMMAND]
The only argument that gives anything different is -V which shows the version:

Code: Select all

accel-cmd -V
accel-cmd a4fe1168dda707a2836f6d74c7a6610645b20152
This looks to be a result of the

Code: Select all

default
block in the switch statement that processes the command line args.

Just checking I'm not doing anything stupid before I poke deeper into the code.

hardillb
Posts: 13
Joined: 13 Feb 2020, 23:19

Re: cli only shows usage information

Post by hardillb » 25 Mar 2020, 20:46

OK, worked it out.

The return value from

Code: Select all

getopt_long
is meant to be an

Code: Select all

int
not a

Code: Select all

char
so the comparison to -1 is not working.

https://github.com/xebd/accel-ppp/blob/ ... cmd.c#L648

It even shows up in the warnings with the compiler on raspbian buster

Code: Select all

...
[ 99%] Building C object accel-cmd/CMakeFiles/accel-cmd.dir/accel_cmd.c.o
/home/pi/accel-ppp/accel-cmd/accel_cmd.c: In function ‘main’:
/home/pi/accel-ppp/accel-cmd/accel_cmd.c:652:29: warning: comparison is always true due to limited range of data type [-Wtype-limits]
         long_opts, &oindx)) != -1) {
                             ^~
[100%] Linking C executable accel-cmd
[100%] Built target accel-cmd
I'll stick a pull request in with the fix.

dimka88
Posts: 649
Joined: 13 Oct 2014, 05:51
Contact:

Re: cli only shows usage information

Post by dimka88 » 25 Mar 2020, 22:35

Why this appears only on raspbian?

hardillb
Posts: 13
Joined: 13 Feb 2020, 23:19

Re: cli only shows usage information

Post by hardillb » 25 Mar 2020, 22:47

Probably because Raspbian Buster is shipping with gcc version 8

gcc (Raspbian 8.3.0-6+rpi1) 8.3.0

On my Ubuntu 18.04.4 is still on version 7

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests