fixed errors

This commit is contained in:
mrbesen 2019-01-19 19:11:34 +01:00
parent bd76593058
commit 065352136d
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
2 changed files with 7 additions and 11 deletions

View File

@ -97,9 +97,8 @@ void set_utf8_locale()
// set locale to common UTF-8 for wchars to be recognized correctly
if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL) { // if en_US.UTF-8 isn't available
char *locale = setlocale(LC_CTYPE, ""); // try the locale that corresponds to the value of the associated environment variable LC_CTYPE
if (locale != NULL && (strstr(locale, "UTF-8") != NULL || strstr(locale, "UTF8") != NULL || strstr(locale, "utf-8") != NULL || strstr(locale, "utf8") != NULL))
; // if locale has "UTF-8" in its name, it is cool to do nothing
else
if (!(locale != NULL && (strstr(locale, "UTF-8") != NULL || strstr(locale, "UTF8") != NULL || strstr(locale, "utf-8") != NULL || strstr(locale, "utf8") != NULL)))
// if locale has "UTF-8" in its name, it is cool to do nothing
error(EXIT_FAILURE, 0, "LC_CTYPE locale must be of UTF-8 type, or you need en_US.UTF-8 availabe");
}
}
@ -591,7 +590,7 @@ int main(int argc, char **argv)
if (!args.http_url.empty() || !args.irc_server.empty()) {
switch (fork()) {
case -1:
error(0, errno, "Error while forking remote-posting process");
error(0, errno, "Error while forking remote-posting process"); break;
case 0:
start_remote_upload(); // child process will upload the .log.i files
exit(EXIT_SUCCESS);
@ -603,12 +602,9 @@ int main(int argc, char **argv)
if (event.value == EV_REPEAT) {
++count_repeats;
} else if (count_repeats) {
if (prev_code == KEY_RIGHTSHIFT || prev_code == KEY_LEFTCTRL || prev_code == KEY_RIGHTALT || prev_code == KEY_LEFTALT || prev_code == KEY_LEFTSHIFT || prev_code == KEY_RIGHTCTRL)
; // if repeated key is modifier, do nothing
else {
if ((args.flags & FLAG_NO_FUNC_KEYS) && is_func_key(prev_code))
; // if repeated was function key, and if we don't log function keys, then don't log repeat either
else
if (!(prev_code == KEY_RIGHTSHIFT || prev_code == KEY_LEFTCTRL || prev_code == KEY_RIGHTALT || prev_code == KEY_LEFTALT || prev_code == KEY_LEFTSHIFT || prev_code == KEY_RIGHTCTRL)) // if repeated key is modifier, do nothing
{
if (! ((args.flags & FLAG_NO_FUNC_KEYS) && is_func_key(prev_code))) // if repeated was function key, and if we don't log function keys, then don't log repeat either
inc_size += fprintf(out, "<#+%d>", count_repeats);
}
count_repeats = 0; // reset count for future use

View File

@ -24,7 +24,7 @@ void usage()
" -k, --kill kill running logkeys process\n"
" -d, --device=FILE input event device [eventX from " INPUT_EVENT_PATH "]\n"
" -p, --precise add milliseconds to the timestamp and add a timestamp to every press\n"
" -q, only log the ms to create a esaier format for other programs to process"
" -q, only log the ms to create a esaier format for other programs to process. This includes -p"
" -?, --help print this help screen\n"
" --export-keymap=FILE export configured keymap to FILE and exit\n"
" --no-func-keys log only character keys\n"