#include <stdio.h>
#include <string.h>
-#include <stdbool.h>
#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
#include <stdlib.h>
-#include <unistd.h>
#include <getopt.h>
#include <limits.h>
-#include <linux/limits.h>
#include <linux/input.h>
#include "libudev.h"
#define LONG(x) ((x)/BITS_PER_LONG)
#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)
-_printf_(6,0)
-static void log_fn(struct udev *udev, int priority,
- const char *file, int line, const char *fn,
- const char *format, va_list args)
-{
- log_metav(priority, file, line, fn, format, args);
-}
-
typedef enum {
ORIENTATION_UNDEFINED,
ORIENTATION_NORMAL,
puts(text);
}
-static void help(void)
-{
- printf("Usage: accelerometer [options] <device path>\n"
- " --debug debug to stderr\n"
- " --help print this help text\n\n");
+static void help(void) {
+
+ printf("%s [options] <device path>\n\n"
+ "Accelerometer device identification.\n\n"
+ " -h --help Print this message\n"
+ " -d --debug Debug to stderr\n"
+ , program_invocation_short_name);
}
int main (int argc, char** argv)
if (udev == NULL)
return 1;
- udev_set_log_fn(udev, log_fn);
-
/* CLI argument parsing */
while (1) {
int option;
- option = getopt_long(argc, argv, "dxh", options, NULL);
+ option = getopt_long(argc, argv, "dh", options, NULL);
if (option == -1)
break;
case 'd':
log_set_target(LOG_TARGET_CONSOLE);
log_set_max_level(LOG_DEBUG);
- udev_set_log_priority(udev, LOG_DEBUG);
log_open();
break;
case 'h':