This commit is contained in:
Nikita Ivanov 2022-06-08 15:26:14 +05:00
parent bd1eaaf6e0
commit 2b7d50e914
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133
3 changed files with 12 additions and 5 deletions

13
ctpv.c
View File

@ -257,8 +257,8 @@ static int list(void)
width_name += 2, width_ext += 2;
puts("List of available previews:");
printf("\t%-*s %-*s %s\n", width_name, header_name, width_ext, header_ext,
puts("List of available previews:\n");
printf("\t%-*s %-*s %s\n\n", width_name, header_name, width_ext, header_ext,
header_mime);
for (size_t i = 0; i < len; i++) {
@ -281,7 +281,7 @@ static int list(void)
s);
}
puts("\nNote: '" ANY_TYPE "' means that it matches any.");
puts("\nNote: '" ANY_TYPE "' means that it matches any.\n");
return OK;
}
@ -290,6 +290,11 @@ static int mime(int argc, char *argv[])
{
const char *f, *mimetype;
if (argc <= 0) {
print_error("files are not specified");
return ERR;
}
for (int i = 0; i < argc; i++) {
f = argv[i];
ERRCHK_RET_OK(check_file(f));
@ -300,7 +305,7 @@ static int mime(int argc, char *argv[])
ERRCHK_RET(!mimetype);
if (argc > 1)
printf("%s: ", f);
printf("%s:\t", f);
printf(".%s ", get_ext(f));
puts(mimetype);

View File

@ -5,6 +5,8 @@
void print_error(const char *error_msg)
{
/* We print errors to stdout because lf file manager
* doesn't print stderr in the preview window. */
fprintf(stdout, "%s: %s\n", program, error_msg);
}

View File

@ -5,7 +5,7 @@
#include <stdlib.h>
#define PARSEERROR(c, format, ...) \
print_errorf("config:%u:%u " format, (c).line, \
print_errorf("config:%u:%u: " format, (c).line, \
(c).col __VA_OPT__(, ) __VA_ARGS__)
typedef struct Lexer Lexer;