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 [email protected]. > 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 | [email protected] | > | www.crazy-compilers.com | compilers which you thought are impossible | > > > _______________________________________________ > GNUnet-developers mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/gnunet-developers >
signature.asc
Description: OpenPGP digital signature
_______________________________________________ GNUnet-developers mailing list [email protected] https://lists.gnu.org/mailman/listinfo/gnunet-developers
