[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work
From: |
Christian Grothoff |
Subject: |
Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work as expected |
Date: |
Fri, 15 Mar 2019 06:09:31 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 |
Hi Hartmut,
I've looked over the code now. A few comments:
1) I've changed configure.ac to actually make the check for *optional*
libzbar work, so that if libzbar is not present configure still runs.
Also removed use of pkgconfig (unnecessary).
2) I think you really should link against libgnuetutil and make use of
our GNUNET_GETOPT_- and GNUNET_log() APIs. Sure, that isn't a big
savings for the tiny program, but it helps keep things uniform (and
right now your logging is different from all the other logging in GNUnet).
3) You're missing the (obvious) error handling required, as your
comments clearly say.
4) For me, the -c option works here just fine. Maybe it got fixed already?
5) Indentation style is off from what we prefer
(https://old.gnunet.org/style may help). But not bad, just different.
6) i18n is missing for user output.
7) The use of the 'fork_and_exec' logic is non-portable. I don't know if
libzbar is portable, but if it is, you should use the
GNUNET_OS_command_run() API instead, obtaining a portable version of the
essentially the same logic (modulo the /dev/null handling, but this is
not required here anyway).
Happy hacking!
Christian
On 3/13/19 6:25 PM, Hartmut Goebel wrote:
> Hi Martin,
>
> Am 03.03.19 um 11:33 schrieb Schanzenbach, Martin:
>> The first thing you should do it use GNUNET_PROGRAM*.
>
> I followed this advice, adding options --verbose, -s/--silent and
> -d/--device. Here is the resulting help output, which look s good::
>
> src/util/gnunet-qr --help
> gnunet-qr
> Scan a QR code using a video device and import the uri read
> Arguments mandatory for long options are also mandatory for short options.
> --verbose be verbose
> -c, --config=FILENAME use configuration file FILENAME
> -d, --device=DEVICE use video-device DEVICE (default: /dev/video0
> -h, --help print this help
> -L, --log=LOGLEVEL configure logging to use LOGLEVEL
> -l, --logfile=FILENAME configure logging to write logs to FILENAME
> -s, --silent do not show preview windows
> -v, --version print the version number
> Report bugs to address@hidden
> GNUnet home page: http://www.gnu.org/s/gnunet/
> General help using GNU software: http://www.gnu.org/gethelp/
>
> But the resulting program does not work as expected:
>
> 1. gnunet-qr -c src/my/test_my.conf
> -> invalid option -- c
>
> Curiously gnunet-ecc accepts this option.
>
> 2. gnunet-qr --config ./src/my/test_my.conf
> fails with "`stat' failed on file
> `/opt/gnunet/share/gnunet/config.d' [...]error: Datei oder
> Verzeichnis nicht gefunden"
>
> Why does the program try to access this directory when I passed an
> config-file?
>
> "/opt/gnunet" is the prefix I configured, thus the directory name
> makes sense. gnunet-ecc has the same issue.
>
> I just pushed the code to branch gnunet-qt-c-2 (force-pushing to the
> prior branch was denied)
>
> --
> Regards
> Hartmut Goebel
>
> | Hartmut Goebel | address@hidden |
> | www.crazy-compilers.com | compilers which you thought are impossible |
>
>
> _______________________________________________
> GNUnet-developers mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/gnunet-developers
>
signature.asc
Description: OpenPGP digital signature
- Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work as expected, (continued)
- Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work as expected, Schanzenbach, Martin, 2019/03/13
- Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work as expected, Hartmut Goebel, 2019/03/14
- Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work as expected, ng0, 2019/03/14
- Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work as expected, Schanzenbach, Martin, 2019/03/14
- Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work as expected, ng0, 2019/03/14
- Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work as expected, Christian Grothoff, 2019/03/15
- Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work as expected, Schanzenbach, Martin, 2019/03/15
- Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work as expected, Christian Grothoff, 2019/03/15
- Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work as expected, Schanzenbach, Martin, 2019/03/16
- Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work as expected, Christian Grothoff, 2019/03/16
- Re: [GNUnet-developers] GNUNET_PROGRAM* option evaluation does not work as expected,
Christian Grothoff <=
Re: [GNUnet-developers] Please review: C implementation of gnunet-qr, ng0, 2019/03/04