summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorleo-arch <leonardoabramovich2@gmail.com>2022-03-26 18:41:55 -0300
committerleo-arch <leonardoabramovich2@gmail.com>2022-03-26 18:41:55 -0300
commit024428fe0d8ac2dde15403f32b589aab02015f71 (patch)
treeb238b050a77e3075a859d661eb6be3f52e4876f3
parent4142058240e239c1a933a0e84f8a096dedf6d26e (diff)
Fix compilation errorsv1.5.1
-rw-r--r--src/colors.c11
-rw-r--r--src/config.c3
-rw-r--r--src/helpers.h1
-rw-r--r--src/listing.c6
-rw-r--r--src/main.c1
-rw-r--r--src/misc.c1
-rw-r--r--src/prompt.c14
-rw-r--r--src/settings.h4
-rw-r--r--src/strings.c6
-rw-r--r--src/tabcomp.c4
-rw-r--r--src/tags.c4
11 files changed, 45 insertions, 10 deletions
diff --git a/src/colors.c b/src/colors.c
index f20beaee..fac06ae5 100644
--- a/src/colors.c
+++ b/src/colors.c
@@ -1102,6 +1102,17 @@ get_colors_from_file(const char *colorscheme, char **filecolors,
continue;
}
+/* else if (*line == 'R' && strncmp(line, "RightPrompt=", 12) == 0) {
+ char *p = strchr(line, '=');
+ if (!p || !*p || !*(++p))
+ continue;
+ char *q = remove_quotes(p);
+ if (!q)
+ continue;
+ free(right_prompt);
+ right_prompt = savestring(q, strlen(q));
+ } */
+
else if (*line == 'W'
&& strncmp(line, "WarningPromptStr=", 17) == 0) {
char *p = strchr(line, '=');
diff --git a/src/config.c b/src/config.c
index c6e9c33c..5a862061 100644
--- a/src/config.c
+++ b/src/config.c
@@ -2191,8 +2191,9 @@ reset_variables(void)
free(opener);
free(encoded_prompt);
+/* free(right_prompt); */
free(term);
- opener = encoded_prompt = term = (char *)NULL;
+ opener = encoded_prompt /*= right_prompt*/ = term = (char *)NULL;
int i = (int)cschemes_n;
while (--i >= 0)
diff --git a/src/helpers.h b/src/helpers.h
index 33b2ffe2..1dbe087f 100644
--- a/src/helpers.h
+++ b/src/helpers.h
@@ -1028,6 +1028,7 @@ extern char
*profile_file,
*quote_chars,
*remotes_file,
+/* *right_prompt, */
*sel_file,
*stdin_tmp_dir,
#ifndef _NO_SUGGESTIONS
diff --git a/src/listing.c b/src/listing.c
index 56ba48ae..7fb16b62 100644
--- a/src/listing.c
+++ b/src/listing.c
@@ -1336,7 +1336,11 @@ run_dir_cmd(const int mode)
char buf[PATH_MAX];
*buf = '\0';
- fgets(buf, sizeof(buf), fp);
+ char *ret = fgets(buf, sizeof(buf), fp);
+ if (!ret) {
+ fclose(fp);
+ return;
+ }
fclose(fp);
diff --git a/src/main.c b/src/main.c
index 42c80759..89740814 100644
--- a/src/main.c
+++ b/src/main.c
@@ -286,6 +286,7 @@ char
*profile_file = (char *)NULL,
*quote_chars = (char *)NULL,
*remotes_file = (char *)NULL,
+/* *right_prompt = (char *)NULL, */
*sel_file = (char *)NULL,
*stdin_tmp_dir = (char *)NULL,
#ifndef _NO_SUGGESTIONS
diff --git a/src/misc.c b/src/misc.c
index dc9c8b6f..e464081d 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1139,6 +1139,7 @@ free_stuff(void)
free(alt_profile);
free_bookmarks();
free(encoded_prompt);
+/* free(right_prompt); */
free_dirlist();
free(opener);
free(wprompt_str);
diff --git a/src/prompt.c b/src/prompt.c
index e781dcfa..185215c2 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -891,6 +891,17 @@ log_and_record(char *input)
if (record_cmd(input))
add_to_cmdhist(input);
}
+/*
+void
+print_right_prompt(void)
+{
+// get_cursor_position(STDIN_FILENO, STDOUT_FILENO);
+ get_cursor_position(0, 1);
+ char *p = decode_prompt(right_prompt);
+ printf("%*s", term_cols, p);
+ printf("\x1b[%d;%dH", currow, curcol);
+ free(p);
+} */
/* Print the prompt and return the string entered by the user (to be
* parsed later by parse_input_str()) */
@@ -910,6 +921,9 @@ prompt(void)
* length might vary if the prompt contains dynamic values */
prompt_offset = UNSET;
+/* if (right_prompt && *right_prompt)
+ print_right_prompt(); */
+
/* Print the prompt and get user input */
char *input = (char *)NULL;
input = readline(the_prompt);
diff --git a/src/settings.h b/src/settings.h
index 0b2d3bfa..4e0233a9 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -28,11 +28,11 @@
#define PROGRAM_NAME "CliFM"
#define PNL "clifm" /* Program name lowercase */
#define PROGRAM_DESC "The command line file manager"
-#define VERSION "1.5"
+#define VERSION "1.5.1"
#define AUTHOR "L. Abramovich"
#define CONTACT "johndoe.arch@outlook.com"
#define WEBSITE "https://github.com/leo-arch/clifm"
-#define DATE "Mar 24, 2022"
+#define DATE "Mar 26, 2022"
#define LICENSE "GPL2+"
#define COLORS_REPO "https://github.com/leo-arch/clifm-colors"
diff --git a/src/strings.c b/src/strings.c
index 41f64538..0bdaf8d8 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -47,7 +47,7 @@
#include "sort.h"
#include "tags.h"
-char len_buf[ARG_MAX] __attribute__((aligned));
+char len_buf[ARG_MAX * sizeof(wchar_t)] __attribute__((aligned));
/* states: S_N: normal, S_I: comparing integral part, S_F: comparing
fractionnal parts, S_Z: idem but with leading Zeroes only */
@@ -1063,8 +1063,8 @@ expand_tag(char ***args, const int tag_index)
snprintf(filename, sizeof(filename), "%s/%s", dir, t[i]->d_name);
char rpath[PATH_MAX];
*rpath = '\0';
- realpath(filename, rpath);
- if (!*rpath)
+ char *ret = realpath(filename, rpath);
+ if (!ret || !*rpath)
continue;
char *esc_str = escape_str(rpath);
char *q = esc_str ? esc_str : rpath;
diff --git a/src/tabcomp.c b/src/tabcomp.c
index 97f23e68..e4924e8e 100644
--- a/src/tabcomp.c
+++ b/src/tabcomp.c
@@ -589,7 +589,7 @@ reinsert_slashes(char *str)
static inline void
write_comp_to_file(char *entry, const char *color, FILE **fp)
{
- char *c = (char *)NULL, tmp[MAX_COLOR];
+ char *c = (char *)NULL, tmp[MAX_COLOR + 4];
if (cur_comp_type == TCMP_TAGS_F) {
size_t len = strlen(entry);
if (entry[len - 1] == '/')
@@ -601,7 +601,7 @@ write_comp_to_file(char *entry, const char *color, FILE **fp)
if (lstat(p ? p : entry, &a) != -1) {
c = fzftab_color(entry, &a);
if (*c != _ESC) {
- snprintf(tmp, MAX_COLOR, "\x1b[%sm", c);
+ snprintf(tmp, sizeof(tmp), "\x1b[%sm", c);
c = tmp;
}
}
diff --git a/src/tags.c b/src/tags.c
index 5065d7ae..e0cb449f 100644
--- a/src/tags.c
+++ b/src/tags.c
@@ -107,7 +107,9 @@ print_tagged_file(char *name, const char *tag)
char dir[PATH_MAX], tmp[PATH_MAX];
*tmp = '\0';
snprintf(dir, PATH_MAX, "%s/%s/%s", tags_dir, tag, name);
- realpath(dir, tmp);
+ char *ret = realpath(dir, tmp);
+ if (!ret)
+ return;
if (!*tmp) {
printf(_("%s (error resolving link target)\n"), name);