mirror of
https://github.com/simon987/sist2.git
synced 2025-04-19 10:16:42 +00:00
Fix duplicate tag problem (simon987/sist2#48)
This commit is contained in:
parent
e6fde38c24
commit
0ef4292abf
@ -27,8 +27,6 @@ struct {
|
|||||||
|
|
||||||
int threads;
|
int threads;
|
||||||
int depth;
|
int depth;
|
||||||
int verbose;
|
|
||||||
int very_verbose;
|
|
||||||
|
|
||||||
size_t stat_tn_size;
|
size_t stat_tn_size;
|
||||||
size_t stat_index_size;
|
size_t stat_index_size;
|
||||||
|
12
src/log.c
12
src/log.c
@ -12,7 +12,7 @@ const char *log_levels[] = {
|
|||||||
"DEBUG", "INFO", "WARNING", "ERROR", "FATAL"
|
"DEBUG", "INFO", "WARNING", "ERROR", "FATAL"
|
||||||
};
|
};
|
||||||
|
|
||||||
void sist_logf(const char *filepath, int level, char *format, ...) {
|
void vsist_logf(const char *filepath, int level, char *format, va_list ap) {
|
||||||
|
|
||||||
static int is_tty = -1;
|
static int is_tty = -1;
|
||||||
if (is_tty == -1) {
|
if (is_tty == -1) {
|
||||||
@ -46,11 +46,8 @@ void sist_logf(const char *filepath, int level, char *format, ...) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, format);
|
|
||||||
size_t maxsize = sizeof(log_str) - log_len;
|
size_t maxsize = sizeof(log_str) - log_len;
|
||||||
log_len += vsnprintf(log_str + log_len, maxsize, format, ap);
|
log_len += vsnprintf(log_str + log_len, maxsize, format, ap);
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
if (is_tty) {
|
if (is_tty) {
|
||||||
log_len += sprintf(log_str + log_len, "\033[0m\n");
|
log_len += sprintf(log_str + log_len, "\033[0m\n");
|
||||||
@ -65,6 +62,13 @@ void sist_logf(const char *filepath, int level, char *format, ...) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sist_logf(const char *filepath, int level, char *format, ...) {
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
|
vsist_logf(filepath, level, format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
void sist_log(const char *filepath, int level, char *str) {
|
void sist_log(const char *filepath, int level, char *str) {
|
||||||
|
|
||||||
static int is_tty = -1;
|
static int is_tty = -1;
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include "sist.h"
|
#include "sist.h"
|
||||||
|
|
||||||
void sist_logf(const char *filepath, int level, char *format, ...);
|
void sist_logf(const char *filepath, int level, char *format, ...);
|
||||||
|
void vsist_logf(const char *filepath, int level, char *format, va_list ap);
|
||||||
|
|
||||||
void sist_log(const char *filepath, int level, char *str);
|
void sist_log(const char *filepath, int level, char *str);
|
||||||
|
|
||||||
|
12
src/main.c
12
src/main.c
@ -19,7 +19,7 @@
|
|||||||
#define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0"
|
#define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0"
|
||||||
|
|
||||||
|
|
||||||
static const char *const Version = "2.1.1";
|
static const char *const Version = "2.1.2";
|
||||||
static const char *const usage[] = {
|
static const char *const usage[] = {
|
||||||
"sist2 scan [OPTION]... PATH",
|
"sist2 scan [OPTION]... PATH",
|
||||||
"sist2 index [OPTION]... INDEX",
|
"sist2 index [OPTION]... INDEX",
|
||||||
@ -55,9 +55,9 @@ void _log(const char *filepath, int level, char *str) {
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ScanCtx.verbose) {
|
if (LogCtx.verbose) {
|
||||||
if (level == LEVEL_DEBUG) {
|
if (level == LEVEL_DEBUG) {
|
||||||
if (ScanCtx.very_verbose) {
|
if (LogCtx.very_verbose) {
|
||||||
sist_log(filepath, level, str);
|
sist_log(filepath, level, str);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -76,10 +76,10 @@ void _logf(const char *filepath, int level, char *format, ...) {
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ScanCtx.verbose) {
|
if (LogCtx.verbose) {
|
||||||
if (level == LEVEL_DEBUG) {
|
if (level == LEVEL_DEBUG) {
|
||||||
if (ScanCtx.very_verbose) {
|
if (LogCtx.very_verbose) {
|
||||||
sist_logf(filepath, level, format, args);
|
vsist_logf(filepath, level, format, args);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sist_logf(filepath, level, format, args);
|
sist_logf(filepath, level, format, args);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<nav class="navbar navbar-expand-lg">
|
<nav class="navbar navbar-expand-lg">
|
||||||
<a class="navbar-brand" href="/">sist2</a>
|
<a class="navbar-brand" href="/">sist2</a>
|
||||||
<span class="badge badge-pill version">2.1.1</span>
|
<span class="badge badge-pill version">2.1.2</span>
|
||||||
<span class="tagline">Lightning-fast file system indexer and search tool </span>
|
<span class="tagline">Lightning-fast file system indexer and search tool </span>
|
||||||
<button style="margin-left: auto" class="btn" type="button" data-toggle="modal" data-target="#settings" onclick="loadSettings()">Settings</button>
|
<button style="margin-left: auto" class="btn" type="button" data-toggle="modal" data-target="#settings" onclick="loadSettings()">Settings</button>
|
||||||
<a id="theme" class="btn" title="Toggle theme" href="/">Theme</a>
|
<a id="theme" class="btn" title="Toggle theme" href="/">Theme</a>
|
||||||
|
File diff suppressed because one or more lines are too long
2
third-party/libscan
vendored
2
third-party/libscan
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 621ee6408465ff2ba4475d56c39df05d47f328d6
|
Subproject commit f363659936bab1d98b92a515610eea5337c0ea39
|
Loading…
x
Reference in New Issue
Block a user