25 Commits
v0.7 ... v0.8

Author SHA1 Message Date
Benjamin Tissoires
bf20845249 meson.build: libratbag 0.8
- coverity fixes
- new --version to ratbag-command
- cleaning up the meson build tools

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-05-09 14:55:15 +02:00
Peter Hutterer
eb01399f26 tools: fix OOB for LED color parsing
Let's not forget about the null-terminator, he feels lonely otherwise.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-09 10:14:47 +02:00
Peter Hutterer
c815654c94 tools: add --version to ratbag-command
Behold, the glory of our version number!

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-09 09:24:41 +02:00
Peter Hutterer
f1ce908b50 meson: quote the libratbag version properly
Otherwise ETOOMANYDECIMALSEPARATORS, confusion, mayham, anarchy, the lot.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-09 09:24:41 +02:00
Peter Hutterer
fb07204d9f meson: drop garbage argument from configure_file
Unsurprisingly, meson does not support the ratbag keyword argument. Though it
should, because we're great. But anyway, this lead to the argument being
ignored which means it didn't get an 'input' argument, which means that
libratbag-version.h.in was ignored. And since it all works anyway (Behold! The
magic! Ooooh! Aaaah!) we can just drop that file.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-09 09:24:41 +02:00
Peter Hutterer
1e5648b11d tools: terminate option list with a zero entry
Because, well, that's what we're supposed to do. Unless you want to think
outside the (array) box, but that has never helped anyone, has it?

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-09 09:24:41 +02:00
Peter Hutterer
0902e3420f tools: replace getopt magic number 2 with 'optional_argument'
So *that's* what 2 means...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-09 09:24:41 +02:00
Peter Hutterer
698d8ab365 Replace ifndef include guards with pragma once
Now that we use meson exclusively and meson uses this for its config.h, you
wouldn't get around it anyway. Besides, the main compilers support it and
libratbag is too niche to worry about others.

This also *adds* the pragma to tools/shared.h where it was previously missing,
and changes it to be the top statement in hidpp-generic.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-05 09:02:15 +02:00
Peter Hutterer
ad1fa22196 hidpp10: fix out-of-bounds access
sizeof() gives us twice as many elements as we have indices for on this 16-bit
array.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
04ebd96bb7 roccat: fix the neverending story^Wtimeout
If we don't change count, the value of count < MAX_RETRY is always true.

Coverity is a champ, isn't it?

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
09b5ae14b1 liblur: fix memory leak
Rather than having a bunch of gotos just define a cleanup for this device and
let the magic do the rest.

Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
8aa127186c gskill: fix memory leak
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
a962082173 hidpp20: constify a helper function
Just because we can

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
5c0dbe4d5c hidpp20: fix dereference before null check
Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
5934816b11 tools: check for negative index coming from argv
Coverity is unhappy.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
28dd84713f Reset the button action struct to zero before use
A semi false-positive from Coverity, because action.macro is unset. Doesn't
matter because we never use it, but having it zeroed is the nice thing to do
(and what we do in the other functions).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
11b31cf9bd Fix a comment typo
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
dfd2d88953 tools: fix coverity warnings
Assigned but not used.

Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
6a097bd691 meson: drop -g, the meson buildtype option takes care of that
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:49:34 +02:00
Peter Hutterer
2776d1ce8e meson: use warning_level=2 instead of manual -Wall -Wextra
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:49:34 +02:00
Peter Hutterer
0834b210ca Remove now-obsolete autogen.sh script
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26 08:26:07 +02:00
Peter Hutterer
cc41adbbf9 gitignore: drop build/ from gitignore again
As pointed out elsewhere, the build directory is decided by the user and
should thus be a user-specific gitignore configuration.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26 08:26:07 +02:00
Peter Hutterer
63a666025f Update gitignore for meson
Drop all automake detritus, leave only the default build directory meson
suggests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-25 08:11:40 +02:00
Peter Hutterer
08ce9773dd Remove liblur.pc.in
Should've been removed with b8ed1ea

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-24 10:11:38 +02:00
Peter Hutterer
f745734d90 meson: generate the libratbag.pc file through configure_file
pkgconfig.generate() does not (yet) have a parameter for setting custom
variables - we need that for pkgdatadir to point to the SVG files. Swap to
using configure_file with the old .pc.in file that was forgotten in the tree
anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-24 10:11:38 +02:00
27 changed files with 76 additions and 166 deletions

41
.gitignore vendored
View File

@@ -1,7 +1,5 @@
*.o
*.pc
*.la
*.lo
*.swp
*~
*.sig
@@ -10,43 +8,4 @@
*.patch
*.rej
*.trs
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
depcomp
install-sh
libtool
ltmain.sh
missing
stamp-h1
.libs/
.deps/
src/libratbag-version.h
doc/libratbag.doxygen
doc/html
tags
test-driver
compile
m4
symbols-leak-test.log
test-build-cxx
test-build-linker
test-build-pedantic-c99
test-build-std-gnuc90
test-iconv-helper
test-suite.log
test-context
test-device
test-*.log
ratbag-command
hidpp10-dump-page
hidpp20-dump-page
lur-command

View File

@@ -1,9 +0,0 @@
#!/bin/sh
test -n "$srcdir" || srcdir=`dirname "$0"`
test -n "$srcdir" || srcdir=.
(
cd "$srcdir" &&
autoreconf --force -v --install
) || exit
test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"

View File

@@ -1,7 +1,7 @@
project('libratbag', 'c', 'cpp',
version : '0.7.0',
version : '0.8.0',
license : 'MIT/Expat',
default_options : [ 'c_std=gnu99' ])
default_options : [ 'c_std=gnu99', 'warning_level=2' ])
libratbag_version = meson.project_version().split('.')
@@ -14,10 +14,10 @@ libratbag_version = meson.project_version().split('.')
# been preserved, change to C+1:0:A+1
# c) If the interface is the same as the previous version, change to C:R+1:A
libratbag_so_c=4
libratbag_so_r=1
libratbag_so_r=2
libratbag_so_a=0
liblur_so_c=3
liblur_so_r=1
liblur_so_r=2
liblur_so_a=0
# convert to sonames
@@ -29,7 +29,7 @@ liblur_so_version = '@0@.@1@.@2@'.format((liblur_so_c-liblur_so_a),
# Compiler setup
cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
cppflags = ['-Wall', '-Wextra', '-Wno-unused-parameter', '-g', '-fvisibility=hidden']
cppflags = ['-Wno-unused-parameter', '-fvisibility=hidden']
cflags = cppflags + ['-Wmissing-prototypes', '-Wstrict-prototypes']
add_project_arguments(cflags, language: 'c')
add_project_arguments(cppflags, language: 'cpp')
@@ -146,10 +146,9 @@ libratbag_version_h_config = configuration_data()
libratbag_version_h_config.set('LIBRATBAG_VERSION_MAJOR', libratbag_version[0])
libratbag_version_h_config.set('LIBRATBAG_VERSION_MINOR', libratbag_version[1])
libratbag_version_h_config.set('LIBRATBAG_VERSION_MICRO', libratbag_version[2])
libratbag_version_h_config.set('LIBRATBAG_VERSION', meson.project_version())
libratbag_version_h_config.set_quoted('LIBRATBAG_VERSION', meson.project_version())
libratbag_version_h = configure_file(
ratbag : 'src/libratbag-version.h.in',
output : 'libratbag-version.h',
configuration : libratbag_version_h_config,
install: false,
@@ -172,12 +171,18 @@ dep_libratbag = declare_dependency(
dependencies : deps_libratbag
)
pkgconfig.generate(
filebase: 'libratbag',
name: 'Libratbag',
description: 'Mouse configuration library',
version: meson.project_version(),
libraries: lib_libratbag
pkgconfigdata = configuration_data()
pkgconfigdata.set('prefix', get_option('prefix'))
pkgconfigdata.set('libdir', get_option('libdir'))
pkgconfigdata.set('datadir', get_option('datadir'))
pkgconfigdata.set('includedir', get_option('includedir'))
pkgconfigdata.set('LIBRATBAG_VERSION', meson.project_version())
pkgconfigfile = configure_file(
input : 'src/libratbag.pc.in',
output : 'libratbag.pc',
configuration : pkgconfigdata,
install : true,
install_dir : get_option('libdir') + '/pkgconfig'
)
#### libshared.a ####

View File

@@ -731,8 +731,10 @@ gskill_macro_from_report(struct ratbag_device *device,
ret = ratbag_utf8_from_enc(report->macro_name,
report->macro_name_length, "UTF-16LE",
&macro->macro.name);
if (ret < 0)
if (ret < 0) {
ratbag_button_macro_unref(macro);
return NULL;
}
for (i = 0, event_idx = 0, increment = 1;
i < report->macro_length;

View File

@@ -909,12 +909,15 @@ hidpp20_log(void *userdata, enum hidpp_log_priority priority, const char *format
static void
hidpp20drv_remove(struct ratbag_device *device)
{
struct hidpp20drv_data *drv_data = ratbag_get_drv_data(device);
struct hidpp20_device *dev = drv_data->dev;
struct hidpp20drv_data *drv_data;
struct hidpp20_device *dev;
if (!device)
return;
drv_data = ratbag_get_drv_data(device);
dev = drv_data->dev;
ratbag_close_hidraw(device);
if (drv_data->profiles)

View File

@@ -303,6 +303,7 @@ roccat_wait_ready(struct ratbag_device *device)
return 2;
msleep(10);
count++;
}
return -ETIMEDOUT;

View File

@@ -26,13 +26,12 @@
* https://drive.google.com/folderview?id=0BxbRzx7vEV7eWmgwazJ3NUFfQ28&usp=sharing
*/
#pragma once
#include <stdint.h>
#include <stdarg.h>
#include <stddef.h>
#ifndef HIDPP_GENERIC_H
#define HIDPP_GENERIC_H
#define HIDPP_RECEIVER_IDX 0xFF
#define HIDPP_WIRED_DEVICE_IDX 0x00
@@ -211,5 +210,3 @@ hidpp_get_unaligned_be_u32(uint8_t *buf)
{
return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
}
#endif /* HIDPP_GENERIC_H */

View File

@@ -1397,7 +1397,7 @@ hidpp10_profile_set_names(struct hidpp10_device *dev, struct hidpp10_profile *pr
memcpy(metadata->lgs02.marker, "LGS02", sizeof(metadata->lgs02.marker));
hidpp10_uchar8_to_uchar16(metadata->lgs02.name,
profile->name,
sizeof(metadata->lgs02.name));
ARRAY_LENGTH(metadata->lgs02.name));
for (i = 0; i < ARRAY_LENGTH(metadata->lgs02.macro_names); i++) {
hidpp10_uchar8_to_uchar16(metadata->lgs02.macro_names[i],
profile->macro_names[i],

View File

@@ -26,8 +26,7 @@
* https://drive.google.com/folderview?id=0BxbRzx7vEV7eWmgwazJ3NUFfQ28&usp=sharing
*/
#ifndef HIDPP_10_H
#define HIDPP_10_H
#pragma once
#include <stdint.h>
#include <stdbool.h>
@@ -695,5 +694,3 @@ hidpp10_get_firmare_information(struct hidpp10_device *dev,
uint8_t *major,
uint8_t *minor,
uint8_t *build_number);
#endif /* HIDPP_10_H */

View File

@@ -1583,8 +1583,8 @@ hidpp20_onboard_profiles_parse_macro(struct hidpp20_device *device,
}
static unsigned int
hidpp20_onboard_profiles_compute_dict_size(struct hidpp20_device *device,
struct hidpp20_profiles *profiles)
hidpp20_onboard_profiles_compute_dict_size(const struct hidpp20_device *device,
const struct hidpp20_profiles *profiles)
{
unsigned p, num_offset;

View File

@@ -26,8 +26,7 @@
* https://drive.google.com/folderview?id=0BxbRzx7vEV7eWmgwazJ3NUFfQ28&usp=sharing
*/
#ifndef HIDPP_20_H
#define HIDPP_20_H
#pragma once
#include <stdint.h>
@@ -544,5 +543,3 @@ hidpp20_onboard_profiles_read_memory(struct hidpp20_device *device,
#define HIDPP_PAGE_MOUSE_BUTTON_SPY 0x8110
#endif /* HIDPP_20_H */

View File

@@ -38,6 +38,13 @@
#define _EXPORT_ __attribute__ ((visibility("default")))
#define MAX_DEVICES 6
static inline void
cleanup_hidpp10_device_destroy(struct hidpp10_device **hidpp10_device) {
if (*hidpp10_device)
hidpp10_device_destroy(*hidpp10_device);
}
#define _cleanup_hidpp10_device_destroy_ _cleanup_(cleanup_hidpp10_device_destroy)
struct lur_receiver {
int refcount;
int fd;
@@ -186,7 +193,7 @@ lur_receiver_enumerate(struct lur_receiver *lur,
dev->present = false;
for (i = 0; i < MAX_DEVICES; i++) {
struct hidpp10_device *d;
_cleanup_hidpp10_device_destroy_ struct hidpp10_device *d;
size_t name_size = 64;
char name[name_size];
uint8_t interval, type;
@@ -240,8 +247,6 @@ lur_receiver_enumerate(struct lur_receiver *lur,
dev->present = true;
list_insert(&lur->devices, &dev->node);
}
hidpp10_device_destroy(d);
}
devices = zalloc(MAX_DEVICES * sizeof(*devices));

View File

@@ -23,8 +23,7 @@
* DEALINGS IN THE SOFTWARE.
*/
#ifndef _LIBLUR_H_
#define _LIBLUR_H_ 1
#pragma once
#ifdef __cplusplus
extern "C" {
@@ -268,4 +267,3 @@ lur_device_get_user_data(const struct lur_device *dev);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,13 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
datarootdir=@datarootdir@
pkgdatadir=@datadir@/@PACKAGE@
libdir=@libdir@
includedir=@includedir@
Name: Liblur
Description: Logitech Unifying Receiver configuration library
Version: @LIBRATBAG_VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -llur
Libs.private: -lm -lrt

View File

@@ -21,8 +21,7 @@
* DEALINGS IN THE SOFTWARE.
*/
#ifndef LIBRATBAG_HIDRAW_H
#define LIBRATBAG_HIDRAW_H
#pragma once
#include <linux/hid.h>
#include <stdint.h>
@@ -186,4 +185,3 @@ ratbag_hidraw_get_keycode_from_consumer_usage(struct ratbag_device *device,
uint16_t
ratbag_hidraw_get_consumer_usage_from_keycode(struct ratbag_device *device,
unsigned keycode);
#endif /* LIBRATBAG_HIDRAW_H */

View File

@@ -21,8 +21,7 @@
* DEALINGS IN THE SOFTWARE.
*/
#ifndef LIBRATBAG_PRIVATE_H
#define LIBRATBAG_PRIVATE_H
#pragma once
#include <linux/input.h>
#include <stdint.h>
@@ -491,5 +490,3 @@ void
ratbag_button_copy_macro(struct ratbag_button *button,
const struct ratbag_button_macro *macro);
#endif /* LIBRATBAG_PRIVATE_H */

View File

@@ -22,8 +22,7 @@
*/
#ifndef LIBRATBAG_TEST_H
#define LIBRATBAG_TEST_H
#pragma once
#include "libratbag.h"
@@ -84,4 +83,3 @@ struct ratbag_test_device {
struct ratbag_device* ratbag_device_new_test_device(struct ratbag *ratbag,
struct ratbag_test_device *test_device);
#endif /* LIBRATBAG_TEST_H */

View File

@@ -144,7 +144,7 @@ ratbag_utf8_from_enc(char *in_buf, size_t in_len, const char *from_enc,
/*
* We *could* dynamically allocate the out buffer. However iconv's
* obnoxious semantics, mainly the fact that it modifies every pointer
* given to it, would make this code a lot larger and complex then it
* given to it, would make this code a lot larger and complex than it
* needs to be for a mouse with blinking lights.
*
* So, since there's no encoding that takes more then 6 bytes per

View File

@@ -21,8 +21,7 @@
* OF THIS SOFTWARE.
*/
#ifndef LIBRATBAG_UTIL_H
#define LIBRATBAG_UTIL_H
#pragma once
#include <stdlib.h>
#include <stdio.h>
@@ -217,4 +216,3 @@ ratbag_utf8_to_enc(char *buf, size_t buf_len, const char *to_enc,
ssize_t
ratbag_utf8_from_enc(char *in_buf, size_t in_len, const char *from_enc,
char **out);
#endif /* LIBRATBAG_UTIL_H */

View File

@@ -1,32 +0,0 @@
/*
* Copyright © 2013 Jonas Ådahl
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef LIBRATBAG_VERSION_H
#define LIBRATBAG_VERSION_H
#define LIBRATBAG_VERSION_MAJOR @LIBRATBAG_VERSION_MAJOR@
#define LIBRATBAG_VERSION_MINOR @LIBRATBAG_VERSION_MINOR@
#define LIBRATBAG_VERSION_MICRO @LIBRATBAG_VERSION_MICRO@
#define LIBRATBAG_VERSION "@LIBRATBAG_VERSION@"
#endif

View File

@@ -1292,7 +1292,7 @@ ratbag_button_set_key(struct ratbag_button *button,
LIBRATBAG_EXPORT enum ratbag_error_code
ratbag_button_disable(struct ratbag_button *button)
{
struct ratbag_button_action action;
struct ratbag_button_action action = {0};
if (!ratbag_device_has_capability(button->profile->device,
RATBAG_DEVICE_CAP_BUTTON_KEY))

View File

@@ -21,8 +21,7 @@
* DEALINGS IN THE SOFTWARE.
*/
#ifndef LIBRATBAG_H
#define LIBRATBAG_H
#pragma once
#ifdef __cplusplus
extern "C" {
@@ -1818,4 +1817,3 @@ ratbag_led_unref(struct ratbag_led *led);
#ifdef __cplusplus
}
#endif
#endif /* LIBRATBAG_H */

View File

@@ -1,9 +1,8 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
datarootdir=@datarootdir@
pkgdatadir=@datadir@/@PACKAGE@
libdir=@libdir@
includedir=@includedir@
datadir=${prefix}/@datadir@
pkgdatadir=${datadir}/libratbag
libdir=${prefix}/@libdir@
includedir=${prefix}/@includedir@
Name: Libratbag
Description: Mouse configuration library

View File

@@ -20,10 +20,7 @@
* OF THIS SOFTWARE.
*/
#ifndef USB_IDS_H
#define USB_IDS_H
#pragma once
#define USB_VENDOR_ID_LOGITECH 0x046d
#endif

View File

@@ -119,7 +119,7 @@ disconnect_device(struct lur_receiver *receiver, int index)
return;
}
if (index >= ndevices) {
if (index < 0 || index >= ndevices) {
fprintf(stderr, "Invalid index %d, only %d devices connected\n",
index, ndevices);
} else {

View File

@@ -35,9 +35,11 @@
#include <sys/stat.h>
#include <linux/input.h>
#include "libratbag-version.h"
#include "shared.h"
enum options {
OPT_VERSION,
OPT_VERBOSE,
OPT_HELP,
};
@@ -187,6 +189,12 @@ usage(void)
program_invocation_short_name);
}
static void
version(void)
{
printf("%s\n", LIBRATBAG_VERSION);
}
static inline int
ratbag_cmd_device_from_arg(struct ratbag *ratbag,
int *argc, char **argv,
@@ -435,7 +443,7 @@ ratbag_cmd_info(const struct ratbag_cmd *cmd,
led = ratbag_led_unref(led);
}
profile = ratbag_profile_unref(profile);
ratbag_profile_unref(profile);
}
return SUCCESS;
@@ -755,7 +763,7 @@ ratbag_cmd_list_supported_devices(const struct ratbag_cmd *cmd,
device = ratbag_cmd_open_device(ratbag, path);
if (device) {
printf("%s:\t%s\n", path, ratbag_device_get_name(device));
device = ratbag_device_unref(device);
ratbag_device_unref(device);
supported++;
}
free(input_list[i]);
@@ -1552,7 +1560,7 @@ ratbag_cmd_led_set_color(const struct ratbag_cmd *cmd,
struct ratbag_led *led;
struct ratbag_color color;
int rc;
char red[2], green[2], blue[2];
char red[3], green[3], blue[3];
char *p;
if (argc < 1)
@@ -2038,8 +2046,10 @@ main(int argc, char **argv)
int c;
int option_index = 0;
static struct option opts[] = {
{ "verbose", 2, 0, OPT_VERBOSE },
{ "help", 0, 0, OPT_HELP },
{ "verbose", optional_argument, 0, OPT_VERBOSE },
{ "version", no_argument, 0, OPT_VERSION },
{ "help", no_argument, 0, OPT_HELP },
{ 0, 0, 0, 0 },
};
c = getopt_long(argc, argv, "+h", opts, &option_index);
@@ -2050,6 +2060,9 @@ main(int argc, char **argv)
case OPT_HELP:
usage();
goto out;
case OPT_VERSION:
version();
goto out;
case OPT_VERBOSE:
if (optarg && streq(optarg, "raw"))
options.flags |= FLAG_VERBOSE_RAW;

View File

@@ -21,6 +21,8 @@
* DEALINGS IN THE SOFTWARE.
*/
#pragma once
#include "config.h"
#include <errno.h>