Completely removed MHL stuff
Changed all source files relative to remove MHL Some string-related functions moved into src/util.c This stable fix.
Этот коммит содержится в:
родитель
3b8f37b99e
Коммит
e54f318cef
@ -18,9 +18,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "edit.h"
|
#include "edit.h"
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
#include "../src/wtools.h"
|
#include "../src/wtools.h"
|
||||||
|
@ -32,9 +32,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
|
|
||||||
#include "edit.h"
|
#include "edit.h"
|
||||||
|
@ -38,9 +38,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
#include "../src/history.h"
|
#include "../src/history.h"
|
||||||
|
|
||||||
@ -277,10 +274,10 @@ edit_save_file (WEdit *edit, const char *filename)
|
|||||||
const char *slashpos;
|
const char *slashpos;
|
||||||
slashpos = strrchr (filename, PATH_SEP);
|
slashpos = strrchr (filename, PATH_SEP);
|
||||||
if (slashpos) {
|
if (slashpos) {
|
||||||
savedir = mhl_str_dup (filename);
|
savedir = g_strdup (filename);
|
||||||
savedir[slashpos - filename + 1] = '\0';
|
savedir[slashpos - filename + 1] = '\0';
|
||||||
} else
|
} else
|
||||||
savedir = mhl_str_dup (".");
|
savedir = g_strdup (".");
|
||||||
saveprefix = concat_dir_and_file (savedir, "cooledit");
|
saveprefix = concat_dir_and_file (savedir, "cooledit");
|
||||||
g_free (savedir);
|
g_free (savedir);
|
||||||
fd = mc_mkstemps (&savename, saveprefix, NULL);
|
fd = mc_mkstemps (&savename, saveprefix, NULL);
|
||||||
@ -1850,9 +1847,9 @@ edit_replace_cmd (WEdit *edit, int again)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (saved1), saved1 = mhl_str_dup (input1);
|
g_free (saved1), saved1 = g_strdup (input1);
|
||||||
g_free (saved2), saved2 = mhl_str_dup (input2);
|
g_free (saved2), saved2 = g_strdup (input2);
|
||||||
g_free (saved3), saved3 = mhl_str_dup (input3);
|
g_free (saved3), saved3 = g_strdup (input3);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -36,9 +36,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
|
|
||||||
#include "edit.h"
|
#include "edit.h"
|
||||||
|
@ -35,9 +35,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
|
|
||||||
#include "edit.h"
|
#include "edit.h"
|
||||||
|
@ -32,9 +32,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
|
|
||||||
#include "edit.h"
|
#include "edit.h"
|
||||||
@ -471,7 +468,7 @@ static struct syntax_rule edit_get_rule (WEdit * edit, long byte_index)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
s = edit->syntax_marker->next;
|
s = edit->syntax_marker->next;
|
||||||
MHL_PTR_FREE (edit->syntax_marker);
|
MC_PTR_FREE (edit->syntax_marker);
|
||||||
edit->syntax_marker = s;
|
edit->syntax_marker = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -666,8 +663,8 @@ static FILE *open_include_file (const char *filename)
|
|||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
MHL_PTR_FREE (error_file_name);
|
MC_PTR_FREE (error_file_name);
|
||||||
error_file_name = mhl_str_dup (filename);
|
error_file_name = g_strdup (filename);
|
||||||
if (*filename == PATH_SEP)
|
if (*filename == PATH_SEP)
|
||||||
return fopen (filename, "r");
|
return fopen (filename, "r");
|
||||||
|
|
||||||
@ -725,8 +722,8 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
|
|||||||
f = g;
|
f = g;
|
||||||
g = 0;
|
g = 0;
|
||||||
line = save_line + 1;
|
line = save_line + 1;
|
||||||
MHL_PTR_FREE (error_file_name);
|
MC_PTR_FREE (error_file_name);
|
||||||
MHL_PTR_FREE (l);
|
MC_PTR_FREE (l);
|
||||||
if (!read_one_line (&l, f))
|
if (!read_one_line (&l, f))
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@ -745,7 +742,7 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
|
|||||||
g = f;
|
g = f;
|
||||||
f = open_include_file (args[1]);
|
f = open_include_file (args[1]);
|
||||||
if (!f) {
|
if (!f) {
|
||||||
MHL_PTR_FREE (error_file_name);
|
MC_PTR_FREE (error_file_name);
|
||||||
result = line;
|
result = line;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -922,10 +919,10 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
|
|||||||
break_a;
|
break_a;
|
||||||
}
|
}
|
||||||
free_args (args);
|
free_args (args);
|
||||||
MHL_PTR_FREE (l);
|
MC_PTR_FREE (l);
|
||||||
}
|
}
|
||||||
free_args (args);
|
free_args (args);
|
||||||
MHL_PTR_FREE (l);
|
MC_PTR_FREE (l);
|
||||||
|
|
||||||
/* Terminate context array. */
|
/* Terminate context array. */
|
||||||
if (num_contexts > 0) {
|
if (num_contexts > 0) {
|
||||||
@ -934,7 +931,7 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!edit->rules[0])
|
if (!edit->rules[0])
|
||||||
MHL_PTR_FREE (edit->rules);
|
MC_PTR_FREE (edit->rules);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
@ -976,34 +973,34 @@ void edit_free_syntax_rules (WEdit * edit)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
edit_get_rule (edit, -1);
|
edit_get_rule (edit, -1);
|
||||||
MHL_PTR_FREE (edit->syntax_type);
|
MC_PTR_FREE (edit->syntax_type);
|
||||||
edit->syntax_type = 0;
|
edit->syntax_type = 0;
|
||||||
|
|
||||||
for (i = 0; edit->rules[i]; i++) {
|
for (i = 0; edit->rules[i]; i++) {
|
||||||
if (edit->rules[i]->keyword) {
|
if (edit->rules[i]->keyword) {
|
||||||
for (j = 0; edit->rules[i]->keyword[j]; j++) {
|
for (j = 0; edit->rules[i]->keyword[j]; j++) {
|
||||||
MHL_PTR_FREE (edit->rules[i]->keyword[j]->keyword);
|
MC_PTR_FREE (edit->rules[i]->keyword[j]->keyword);
|
||||||
MHL_PTR_FREE (edit->rules[i]->keyword[j]->whole_word_chars_left);
|
MC_PTR_FREE (edit->rules[i]->keyword[j]->whole_word_chars_left);
|
||||||
MHL_PTR_FREE (edit->rules[i]->keyword[j]->whole_word_chars_right);
|
MC_PTR_FREE (edit->rules[i]->keyword[j]->whole_word_chars_right);
|
||||||
MHL_PTR_FREE (edit->rules[i]->keyword[j]);
|
MC_PTR_FREE (edit->rules[i]->keyword[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MHL_PTR_FREE (edit->rules[i]->left);
|
MC_PTR_FREE (edit->rules[i]->left);
|
||||||
MHL_PTR_FREE (edit->rules[i]->right);
|
MC_PTR_FREE (edit->rules[i]->right);
|
||||||
MHL_PTR_FREE (edit->rules[i]->whole_word_chars_left);
|
MC_PTR_FREE (edit->rules[i]->whole_word_chars_left);
|
||||||
MHL_PTR_FREE (edit->rules[i]->whole_word_chars_right);
|
MC_PTR_FREE (edit->rules[i]->whole_word_chars_right);
|
||||||
MHL_PTR_FREE (edit->rules[i]->keyword);
|
MC_PTR_FREE (edit->rules[i]->keyword);
|
||||||
MHL_PTR_FREE (edit->rules[i]->keyword_first_chars);
|
MC_PTR_FREE (edit->rules[i]->keyword_first_chars);
|
||||||
MHL_PTR_FREE (edit->rules[i]);
|
MC_PTR_FREE (edit->rules[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (edit->syntax_marker) {
|
while (edit->syntax_marker) {
|
||||||
struct _syntax_marker *s = edit->syntax_marker->next;
|
struct _syntax_marker *s = edit->syntax_marker->next;
|
||||||
MHL_PTR_FREE (edit->syntax_marker);
|
MC_PTR_FREE (edit->syntax_marker);
|
||||||
edit->syntax_marker = s;
|
edit->syntax_marker = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
MHL_PTR_FREE (edit->rules);
|
MC_PTR_FREE (edit->rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* returns -1 on file error, line number on error in file syntax */
|
/* returns -1 on file error, line number on error in file syntax */
|
||||||
@ -1036,7 +1033,7 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
|
|||||||
args[0] = 0;
|
args[0] = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
line++;
|
line++;
|
||||||
MHL_PTR_FREE (l);
|
MC_PTR_FREE (l);
|
||||||
if (!read_one_line (&l, f))
|
if (!read_one_line (&l, f))
|
||||||
break;
|
break;
|
||||||
(void)get_args (l, args, 1023); /* Final NULL */
|
(void)get_args (l, args, 1023); /* Final NULL */
|
||||||
@ -1117,8 +1114,8 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
|
|||||||
else
|
else
|
||||||
result = line_error;
|
result = line_error;
|
||||||
} else {
|
} else {
|
||||||
MHL_PTR_FREE (edit->syntax_type);
|
MC_PTR_FREE (edit->syntax_type);
|
||||||
edit->syntax_type = mhl_str_dup (syntax_type);
|
edit->syntax_type = g_strdup (syntax_type);
|
||||||
/* if there are no rules then turn off syntax highlighting for speed */
|
/* if there are no rules then turn off syntax highlighting for speed */
|
||||||
if (!g && !edit->rules[1])
|
if (!g && !edit->rules[1])
|
||||||
if (!edit->rules[0]->keyword[1] && !edit->rules[0]->spelling) {
|
if (!edit->rules[0]->keyword[1] && !edit->rules[0]->spelling) {
|
||||||
@ -1135,7 +1132,7 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MHL_PTR_FREE (l);
|
MC_PTR_FREE (l);
|
||||||
fclose (f);
|
fclose (f);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1200,7 +1197,7 @@ edit_load_syntax (WEdit *edit, char ***pnames, const char *type)
|
|||||||
message (D_ERROR, _(" Load syntax file "),
|
message (D_ERROR, _(" Load syntax file "),
|
||||||
_(" Error in file %s on line %d "),
|
_(" Error in file %s on line %d "),
|
||||||
error_file_name ? error_file_name : f, r);
|
error_file_name ? error_file_name : f, r);
|
||||||
MHL_PTR_FREE (error_file_name);
|
MC_PTR_FREE (error_file_name);
|
||||||
} else {
|
} else {
|
||||||
/* succeeded */
|
/* succeeded */
|
||||||
}
|
}
|
||||||
|
@ -30,10 +30,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/types.h>
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
|
|
||||||
#include "edit.h"
|
#include "edit.h"
|
||||||
|
3
mhl/.gitignore
поставляемый
3
mhl/.gitignore
поставляемый
@ -1,3 +0,0 @@
|
|||||||
.deps
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
103
mhl/README
103
mhl/README
@ -1,103 +0,0 @@
|
|||||||
|
|
||||||
Micro helper library.
|
|
||||||
--
|
|
||||||
|
|
||||||
This is a tiny library of helper functions/macros.
|
|
||||||
|
|
||||||
* MACRO-FUNC: macro w/ function syntax. (might become inline func)
|
|
||||||
* INLINE-FUNC: inline function (might become macro func)
|
|
||||||
* MACRO: strictly a macro (may never become a inline func)
|
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
mhl/memory.h: Memory management functions
|
|
||||||
|
|
||||||
* mhl_mem_alloc_u(sz) [MACRO-FUNC]
|
|
||||||
|
|
||||||
Allocate sz bytes on stack, unitialized
|
|
||||||
|
|
||||||
* mhl_mem_alloc_z(sz) [INLINE-FUNC]
|
|
||||||
|
|
||||||
Allocate sz bytes on stack, zero'ed
|
|
||||||
|
|
||||||
* g_free(ptr) [INLINE-FUNC]
|
|
||||||
|
|
||||||
Free chunk @ptr (MUST be allocated w/ mhl_mem_alloc_*()),
|
|
||||||
passing NULL is graciously allowed
|
|
||||||
|
|
||||||
* mhl_mem_realloc(ptr,newsize) -> returns newptr
|
|
||||||
|
|
||||||
Re-allocates a heap chunk, just like realloc()
|
|
||||||
|
|
||||||
* MHL_PTR_FREE(ptr) [MACRO-ONLY]
|
|
||||||
|
|
||||||
like g_free(), but with ptr as a variable that gets cleared
|
|
||||||
(use this as shortcut to "g_free(foo); foo = NULL")
|
|
||||||
|
|
||||||
mhl/string.h: String helpers
|
|
||||||
|
|
||||||
* mhl_str_dup(const char*s) -> char*
|
|
||||||
|
|
||||||
[MACRO-FUNC] Safe version of strdup(), when NULL passed, returns strdup("")
|
|
||||||
|
|
||||||
* mhl_str_ndup(const char* s) -> char*
|
|
||||||
|
|
||||||
[MACRO-FUNC] Safe version of strndup(), when NULL passed, returns strdup("")
|
|
||||||
|
|
||||||
* mhl_str_trim(char* s) -> char*
|
|
||||||
|
|
||||||
[INLINE-FUNC] Trims the string (removing leading and trailing whitespacs),
|
|
||||||
WITHIN the passed buffer, returning the string s itself.
|
|
||||||
When NULL passed returns NULL.
|
|
||||||
|
|
||||||
* mhl_str_toupper(char* s) -> char*
|
|
||||||
|
|
||||||
[INLINE-FUNC] Converts the string in passed buffer to uppercase, returns that
|
|
||||||
buffer. When NULL passed returns NULL.
|
|
||||||
|
|
||||||
* mhl_str_concat_1(const char* base, const char* one) -> char*
|
|
||||||
|
|
||||||
[INLINE-FUNC] Concatenates the string one onto the string base and returns the
|
|
||||||
result in a newly allocated buffer (free it w/ g_free()).
|
|
||||||
For NULL strings, "" is assumed.
|
|
||||||
|
|
||||||
* mhl_str_concat_2(const char* base,const char* one,const char* two) -> char*
|
|
||||||
mhl_str_concat_3(const char* base,const char* one,const char* two,const char* three) -> char*
|
|
||||||
mhl_str_concat_4(const char* base,const char* one,const char* two,const char* three,const char* four) -> char*
|
|
||||||
mhl_str_concat_5(const char* base,const char* one,const char* two,const char* three,const char* four,const char* five) -> char*
|
|
||||||
mhl_str_concat_6(const char* base,const char* one,const char* two,const char* three,const char* four,const char* five,const char* six) -> char*
|
|
||||||
mhl_str_concat_7(const char* base,const char* one,const char* two,const char* three,const char* four,const char* five,const char* six,const char* seven) -> char*
|
|
||||||
|
|
||||||
[INLINE-FUNC] Like str_concat_1() but adding more strings.
|
|
||||||
|
|
||||||
* mhl_str_reverse(char* str) -> char*
|
|
||||||
|
|
||||||
[INLINE-FUNC] Reverses the string in passed buffer and returns the buffer ptr itself.
|
|
||||||
If NULL is passed, returns NULL.
|
|
||||||
|
|
||||||
mhl/escape.h: Shell-style string escaping
|
|
||||||
|
|
||||||
* mhl_shell_escape_toesc(char c) -> bool
|
|
||||||
|
|
||||||
[MACRO-FUNC] returns true when given char has to be escaped
|
|
||||||
|
|
||||||
* mhl_shell_escape_nottoesc(char c) -> bool
|
|
||||||
|
|
||||||
[MACRO-FUNC] opposite of mhl_shell_escape_toesc()
|
|
||||||
|
|
||||||
* mhl_shell_escape_dup(const char* s) -> char*
|
|
||||||
|
|
||||||
[INLINE-FUNC] escapes an string and returns the result in a malloc()'ed chunk
|
|
||||||
Passing NULL returns an empty malloc()ed string.
|
|
||||||
|
|
||||||
* mhl_shell_unescape_buf(char* s) -> char*
|
|
||||||
|
|
||||||
[INLINE-FUNC] unescapes the string into given buffer (changes buffer!) and
|
|
||||||
returns ptr to the buffer itself. When NULL passed returns NULL.
|
|
||||||
|
|
||||||
mhl/env.h: Environment variable helpers
|
|
||||||
|
|
||||||
* mhl_getenv_dup(const char* n) -> char*
|
|
||||||
|
|
||||||
[MACRO-FUNC] like getenv() but returns an strdup()'ed copy. When NULL passed,
|
|
||||||
returns strdup("")
|
|
@ -1,8 +0,0 @@
|
|||||||
#ifndef MHL_ENV_H
|
|
||||||
#define MHL_ENV_H
|
|
||||||
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#define mhl_getenv_dup(name) (mhl_str_dup(name ? getenv(name) : ""))
|
|
||||||
|
|
||||||
#endif
|
|
149
mhl/escape.h
149
mhl/escape.h
@ -1,149 +0,0 @@
|
|||||||
#ifndef MHL_ESCAPE_H
|
|
||||||
#define MHL_ESCAPE_H
|
|
||||||
|
|
||||||
/* Micro helper library: shell escaping functions */
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#define mhl_shell_escape_toesc(x) \
|
|
||||||
(((x)==' ')||((x)=='!')||((x)=='#')||((x)=='$')||((x)=='%')|| \
|
|
||||||
((x)=='(')||((x)==')')||((x)=='\'')||((x)=='&')||((x)=='~')|| \
|
|
||||||
((x)=='{')||((x)=='}')||((x)=='[')||((x)==']')||((x)=='`')|| \
|
|
||||||
((x)=='?')||((x)=='|')||((x)=='<')||((x)=='>')||((x)==';')|| \
|
|
||||||
((x)=='*')||((x)=='\\')||((x)=='"'))
|
|
||||||
|
|
||||||
#define mhl_shell_escape_nottoesc(x) \
|
|
||||||
(((x)!=0) && (!mhl_shell_escape_toesc((x))))
|
|
||||||
|
|
||||||
/** To be compatible with the general posix command lines we have to escape
|
|
||||||
strings for the command line
|
|
||||||
|
|
||||||
/params const char * in
|
|
||||||
string for escaping
|
|
||||||
/returns
|
|
||||||
return escaped string (later need to free)
|
|
||||||
*/
|
|
||||||
static inline char* mhl_shell_escape_dup(const char* src)
|
|
||||||
{
|
|
||||||
if ((src==NULL)||(!(*src)))
|
|
||||||
return strdup("");
|
|
||||||
|
|
||||||
char* buffer = calloc(1, strlen(src)*2+2);
|
|
||||||
char* ptr = buffer;
|
|
||||||
|
|
||||||
/* look for the first char to escape */
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
char c;
|
|
||||||
/* copy over all chars not to escape */
|
|
||||||
while ((c=(*src)) && mhl_shell_escape_nottoesc(c))
|
|
||||||
{
|
|
||||||
*ptr = c;
|
|
||||||
ptr++;
|
|
||||||
src++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* at this point we either have an \0 or an char to escape */
|
|
||||||
if (!c)
|
|
||||||
return buffer;
|
|
||||||
|
|
||||||
*ptr = '\\';
|
|
||||||
ptr++;
|
|
||||||
*ptr = c;
|
|
||||||
ptr++;
|
|
||||||
src++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Unescape paths or other strings for e.g the internal cd
|
|
||||||
shell-unescape within a given buffer (writing to it!)
|
|
||||||
|
|
||||||
/params const char * src
|
|
||||||
string for unescaping
|
|
||||||
/returns
|
|
||||||
return unescaped string
|
|
||||||
*/
|
|
||||||
static inline char* mhl_shell_unescape_buf(char* text)
|
|
||||||
{
|
|
||||||
if (!text)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* look for the first \ - that's quick skipover if there's nothing to escape */
|
|
||||||
char* readptr = text;
|
|
||||||
while ((*readptr) && ((*readptr)!='\\')) readptr++;
|
|
||||||
if (!(*readptr)) return text;
|
|
||||||
|
|
||||||
/* if we're here, we're standing on the first '\' */
|
|
||||||
char* writeptr = readptr;
|
|
||||||
char c;
|
|
||||||
while ((c = *readptr))
|
|
||||||
{
|
|
||||||
if (c=='\\')
|
|
||||||
{
|
|
||||||
readptr++;
|
|
||||||
switch ((c = *readptr))
|
|
||||||
{
|
|
||||||
case 'n': (*writeptr) = '\n'; writeptr++; break;
|
|
||||||
case 'r': (*writeptr) = '\r'; writeptr++; break;
|
|
||||||
case 't': (*writeptr) = '\t'; writeptr++; break;
|
|
||||||
|
|
||||||
case ' ':
|
|
||||||
case '\\':
|
|
||||||
case '#':
|
|
||||||
case '$':
|
|
||||||
case '%':
|
|
||||||
case '(':
|
|
||||||
case ')':
|
|
||||||
case '[':
|
|
||||||
case ']':
|
|
||||||
case '{':
|
|
||||||
case '}':
|
|
||||||
case '<':
|
|
||||||
case '>':
|
|
||||||
case '!':
|
|
||||||
case '*':
|
|
||||||
case '?':
|
|
||||||
case '~':
|
|
||||||
case '`':
|
|
||||||
case '"':
|
|
||||||
case ';':
|
|
||||||
case '\0': /* end of string! malformed escape string */
|
|
||||||
goto out;
|
|
||||||
default:
|
|
||||||
(*writeptr) = c; writeptr++; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else /* got a normal character */
|
|
||||||
{
|
|
||||||
(*writeptr) = *readptr;
|
|
||||||
writeptr++;
|
|
||||||
}
|
|
||||||
readptr++;
|
|
||||||
}
|
|
||||||
out:
|
|
||||||
*writeptr = 0;
|
|
||||||
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Check if char in pointer contain escape'd chars
|
|
||||||
|
|
||||||
/params const char * in
|
|
||||||
string for checking
|
|
||||||
/returns
|
|
||||||
return TRUE if string contain escaped chars
|
|
||||||
otherwise return FALSE
|
|
||||||
*/
|
|
||||||
static inline bool
|
|
||||||
mhl_shell_is_char_escaped ( const char *in )
|
|
||||||
{
|
|
||||||
if (in == NULL || !*in || in[0] != '\\')
|
|
||||||
return false;
|
|
||||||
if (mhl_shell_escape_toesc(in[1]))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
28
mhl/memory.h
28
mhl/memory.h
@ -1,28 +0,0 @@
|
|||||||
#ifndef MHL_MEMORY_H
|
|
||||||
#define MHL_MEMORY_H
|
|
||||||
|
|
||||||
#include <memory.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/* allocate a chunk of stack memory, uninitialized */
|
|
||||||
#define mhl_mem_alloc_u(sz) (malloc(sz))
|
|
||||||
|
|
||||||
/* allocate a chunk of stack memory, zeroed */
|
|
||||||
#define mhl_mem_alloc_z(sz) (calloc(1,sz))
|
|
||||||
|
|
||||||
/* free a chunk of memory from stack, passing NULL does no harm */
|
|
||||||
static inline void mhl_mem_free(void* ptr)
|
|
||||||
{
|
|
||||||
if (ptr) free(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* free an ptr and NULL it */
|
|
||||||
#define MHL_PTR_FREE(ptr) do { mhl_mem_free(ptr); (ptr) = NULL; } while (0)
|
|
||||||
|
|
||||||
/* allocate a chunk on stack - automatically free'd on function exit */
|
|
||||||
#define mhl_stack_alloc(sz) (alloca(sz))
|
|
||||||
|
|
||||||
/* re-alloc memory chunk */
|
|
||||||
#define mhl_mem_realloc(ptr,sz) (realloc(ptr,sz))
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,49 +0,0 @@
|
|||||||
#ifndef MHL_STRHASH_H
|
|
||||||
#define MHL_STRHASH_H
|
|
||||||
|
|
||||||
#include <hash.h>
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
|
|
||||||
static void __mhl_strhash_free_key(void* ptr)
|
|
||||||
{
|
|
||||||
g_free(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __mhl_strhash_free_dummy(void* ptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef hash MHL_STRHASH;
|
|
||||||
|
|
||||||
#define MHL_STRHASH_DECLARE(n) MHL_STRHASH n;
|
|
||||||
|
|
||||||
#define MHL_STRHASH_INIT(h) \
|
|
||||||
hash_initialise(h, 997U, \
|
|
||||||
hash_hash_string, \
|
|
||||||
hash_compare_string, \
|
|
||||||
hash_copy_string, \
|
|
||||||
__mhl_strhash_free_key, \
|
|
||||||
__mhl_strhash_free_dummy)
|
|
||||||
|
|
||||||
#define MHL_STRHASH_DECLARE_INIT(n) \
|
|
||||||
MHL_STRHASH_DECLARE(n); \
|
|
||||||
MHL_STRHASH_INIT(&n);
|
|
||||||
|
|
||||||
#define MHL_STRHASH_DEINIT(ht) \
|
|
||||||
hash_deinitialise(ht)
|
|
||||||
|
|
||||||
static inline void mhl_strhash_addkey(MHL_STRHASH* ht, const char* key, void* value)
|
|
||||||
{
|
|
||||||
hash_insert(ht, (char*)key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void* mhl_strhash_lookup(MHL_STRHASH* ht, const char* key)
|
|
||||||
{
|
|
||||||
void* retptr;
|
|
||||||
if (hash_retrieve(ht, (char*)key, &retptr))
|
|
||||||
return retptr;
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
172
mhl/string.h
172
mhl/string.h
@ -1,172 +0,0 @@
|
|||||||
#ifndef MHL_STRING_H
|
|
||||||
#define MHL_STRING_H
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
|
|
||||||
#define mhl_str_dup(str) ((str ? strdup(str) : strdup("")))
|
|
||||||
#define mhl_str_ndup(str,len) ((str ? strndup(str,len) : strdup("")))
|
|
||||||
#define mhl_str_len(str) ((str ? strlen(str) : 0))
|
|
||||||
|
|
||||||
#define ISSPACE(c) isspace((unsigned char)(c))
|
|
||||||
#define TOUPPER(c) toupper((unsigned char)(c))
|
|
||||||
|
|
||||||
static inline char * mhl_str_dup_range(const char * s_start, const char * s_bound)
|
|
||||||
{
|
|
||||||
return mhl_str_ndup(s_start, s_bound - s_start);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline char* mhl_str_trim(char* str)
|
|
||||||
{
|
|
||||||
if (!str) return NULL; /* NULL string ?! bail out. */
|
|
||||||
|
|
||||||
/* find the first non-space */
|
|
||||||
char* start; for (start=str; ((*str) && (!ISSPACE(*str))); str++);
|
|
||||||
|
|
||||||
/* only spaces ? */
|
|
||||||
if (!(*str)) { *str = 0; return str; }
|
|
||||||
|
|
||||||
/* get the size (cannot be empty - caught above) */
|
|
||||||
size_t _sz = strlen(str);
|
|
||||||
|
|
||||||
/* find the proper end */
|
|
||||||
char* end;
|
|
||||||
for (end=(str+_sz-1); ((end>str) && (ISSPACE(*end))); end--);
|
|
||||||
end[1] = 0; /* terminate, just to be sure */
|
|
||||||
|
|
||||||
/* if we have no leading spaces, just trucate */
|
|
||||||
if (start==str) { end++; *end = 0; return str; }
|
|
||||||
|
|
||||||
/* if it's only one char, dont need memmove for that */
|
|
||||||
if (start==end) { str[0]=*start; str[1]=0; return str; }
|
|
||||||
|
|
||||||
/* by here we have a (non-empty) region between start and end */
|
|
||||||
memmove(str,start,(end-start+1));
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void mhl_str_toupper(char* str)
|
|
||||||
{
|
|
||||||
if (str)
|
|
||||||
for (;*str;str++)
|
|
||||||
*str = TOUPPER(*str);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* note: we use ((char*)(1)) as terminator - NULL is a valid argument ! */
|
|
||||||
static const char * mhl_s_c_sep__ = (const char *)1;
|
|
||||||
/* _NEVER_ call this function directly ! */
|
|
||||||
static inline char* mhl_str_concat_hlp__(const char* va_start_dummy, ...)
|
|
||||||
{
|
|
||||||
char * result;
|
|
||||||
size_t result_len = 0;
|
|
||||||
char * p;
|
|
||||||
const char * chunk;
|
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start(args,va_start_dummy);
|
|
||||||
while ((chunk = va_arg(args, const char*)) != mhl_s_c_sep__)
|
|
||||||
{
|
|
||||||
if (chunk)
|
|
||||||
{
|
|
||||||
result_len += strlen (chunk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
if (result_len == 0)
|
|
||||||
return mhl_str_dup("");
|
|
||||||
|
|
||||||
/* now as we know how much to copy, allocate the buffer + '\0'*/
|
|
||||||
result = (char*)mhl_mem_alloc_u (result_len + 1);
|
|
||||||
|
|
||||||
p = result;
|
|
||||||
|
|
||||||
va_start(args,va_start_dummy);
|
|
||||||
while ((chunk = va_arg(args, const char*)) != mhl_s_c_sep__)
|
|
||||||
{
|
|
||||||
if (chunk)
|
|
||||||
{
|
|
||||||
size_t chunk_len = strlen (chunk);
|
|
||||||
memcpy (p, chunk, chunk_len);
|
|
||||||
p += chunk_len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
*p = '\0';
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define mhl_str_concat(...) (mhl_str_concat_hlp__(mhl_s_c_sep__, __VA_ARGS__, mhl_s_c_sep__))
|
|
||||||
|
|
||||||
static inline char* mhl_str_reverse(char* ptr)
|
|
||||||
{
|
|
||||||
if (!ptr) return NULL; /* missing string */
|
|
||||||
if (!(ptr[0] && ptr[1])) return ptr; /* empty or 1-ch string */
|
|
||||||
|
|
||||||
size_t _sz = strlen(ptr);
|
|
||||||
char* start = ptr;
|
|
||||||
char* end = ptr+_sz-1;
|
|
||||||
|
|
||||||
while (start<end)
|
|
||||||
{
|
|
||||||
char c = *start;
|
|
||||||
*start = *end;
|
|
||||||
*end = c;
|
|
||||||
start++;
|
|
||||||
end--;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* strcpy is unsafe on overlapping memory areas, so define memmove-alike
|
|
||||||
* string function. Has sense only when dest <= src.
|
|
||||||
*/
|
|
||||||
static inline char * mhl_strmove(char * dest, const char * src)
|
|
||||||
{
|
|
||||||
size_t n = strlen (src) + 1; /* + '\0' */
|
|
||||||
|
|
||||||
/* strictly speaking, this invokes undefined behavior as soon as dest and src are pointers into different objects. */
|
|
||||||
assert (dest<=src);
|
|
||||||
|
|
||||||
return memmove(dest, src, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline char* mhl_str_dir_plus_file(const char* dirname, const char* filename)
|
|
||||||
{
|
|
||||||
/* make sure we have valid strings */
|
|
||||||
if (!dirname)
|
|
||||||
dirname="";
|
|
||||||
|
|
||||||
if (!filename)
|
|
||||||
filename="";
|
|
||||||
|
|
||||||
/* skip leading slashes on filename */
|
|
||||||
while (*filename == '/')
|
|
||||||
filename++;
|
|
||||||
|
|
||||||
/* skip trailing slashes on dirname */
|
|
||||||
size_t dnlen = strlen(dirname);
|
|
||||||
while ((dnlen != 0) && (dirname[dnlen-1]=='/'))
|
|
||||||
dnlen--;
|
|
||||||
|
|
||||||
size_t fnlen = strlen(filename);
|
|
||||||
char* buffer = mhl_mem_alloc_z(dnlen+fnlen+2); /* enough space for dirname, /, filename, zero */
|
|
||||||
char* ptr = buffer;
|
|
||||||
|
|
||||||
memcpy(ptr, dirname, dnlen);
|
|
||||||
ptr+=dnlen;
|
|
||||||
*ptr = '/';
|
|
||||||
ptr++;
|
|
||||||
memcpy(ptr, filename, fnlen);
|
|
||||||
ptr+=fnlen;
|
|
||||||
*ptr = 0;
|
|
||||||
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* MHL_STRING_H */
|
|
18
mhl/types.h
18
mhl/types.h
@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
Micro Helper Library: generic type declarations
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MHL_TYPES_H
|
|
||||||
#define MHL_TYPES_H
|
|
||||||
|
|
||||||
#if !defined(__bool_true_false_are_defined) && !defined(false) && !defined(true) && !defined(bool)
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
false = 0,
|
|
||||||
true = 1
|
|
||||||
} bool;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -30,9 +30,6 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "win.h" /* Our window tools */
|
#include "win.h" /* Our window tools */
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
|
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "charsets.h"
|
#include "charsets.h"
|
||||||
|
|
||||||
|
@ -34,9 +34,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "cmd.h" /* Our definitions */
|
#include "cmd.h" /* Our definitions */
|
||||||
#include "fileopctx.h" /* file_op_context_new() */
|
#include "fileopctx.h" /* file_op_context_new() */
|
||||||
|
@ -22,9 +22,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "setup.h" /* For the externs */
|
#include "setup.h" /* For the externs */
|
||||||
|
@ -27,10 +27,6 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
#include <mhl/escape.h>
|
|
||||||
|
|
||||||
#include "global.h" /* home_dir */
|
#include "global.h" /* home_dir */
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "widget.h" /* WInput */
|
#include "widget.h" /* WInput */
|
||||||
|
@ -30,10 +30,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/escape.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
@ -24,9 +24,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "mouse.h"
|
#include "mouse.h"
|
||||||
|
@ -24,9 +24,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
|
@ -27,9 +27,6 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <mhl/types.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "ecs.h"
|
#include "ecs.h"
|
||||||
|
|
||||||
|
@ -19,9 +19,6 @@
|
|||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
@ -27,9 +27,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
|
10
src/file.c
10
src/file.c
@ -50,10 +50,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/escape.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "eregex.h"
|
#include "eregex.h"
|
||||||
@ -1805,13 +1801,13 @@ panel_operate (void *source_panel, FileOperation operation,
|
|||||||
*/
|
*/
|
||||||
if (force_single)
|
if (force_single)
|
||||||
/* just copy */
|
/* just copy */
|
||||||
dest_dir_ = mhl_str_dup (dest_dir);
|
dest_dir_ = g_strdup (dest_dir);
|
||||||
else
|
else
|
||||||
/* add trailing separator */
|
/* add trailing separator */
|
||||||
if (*dest_dir && strcmp(&dest_dir[strlen(dest_dir)-1], PATH_SEP_STR)) {
|
if (*dest_dir && strcmp(&dest_dir[strlen(dest_dir)-1], PATH_SEP_STR)) {
|
||||||
dest_dir_ = mhl_str_concat (dest_dir, PATH_SEP_STR);
|
dest_dir_ = g_strconcat (dest_dir, PATH_SEP_STR);
|
||||||
} else {
|
} else {
|
||||||
dest_dir_ = mhl_str_dup (dest_dir);
|
dest_dir_ = g_strdup (dest_dir);
|
||||||
}
|
}
|
||||||
if (!dest_dir_) {
|
if (!dest_dir_) {
|
||||||
file_op_context_destroy (ctx);
|
file_op_context_destroy (ctx);
|
||||||
|
@ -52,9 +52,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "setup.h" /* verbose */
|
#include "setup.h" /* verbose */
|
||||||
#include "dialog.h" /* do_refresh() */
|
#include "dialog.h" /* do_refresh() */
|
||||||
|
@ -27,9 +27,6 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
@ -27,10 +27,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <mhl/types.h>
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
@ -48,9 +48,6 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
|
@ -36,9 +36,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h" /* COLS */
|
#include "tty.h" /* COLS */
|
||||||
#include "color.h" /* dialog_colors */
|
#include "color.h" /* dialog_colors */
|
||||||
|
@ -20,9 +20,6 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "mouse.h" /* Gpm_Event */
|
#include "mouse.h" /* Gpm_Event */
|
||||||
|
@ -32,10 +32,6 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/types.h>
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "mouse.h"
|
#include "mouse.h"
|
||||||
|
@ -42,9 +42,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h" /* COLS */
|
#include "tty.h" /* COLS */
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
@ -26,9 +26,6 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/types.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
@ -33,9 +33,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
|
@ -23,9 +23,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
|
@ -29,9 +29,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h" /* attrset() */
|
#include "tty.h" /* attrset() */
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
@ -28,9 +28,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "profile.h"
|
#include "profile.h"
|
||||||
|
|
||||||
|
@ -27,9 +27,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
|
@ -23,9 +23,6 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
@ -415,14 +412,14 @@ panel_load_setup (WPanel *panel, const char *section)
|
|||||||
|
|
||||||
/* User formats */
|
/* User formats */
|
||||||
g_free (panel->user_format);
|
g_free (panel->user_format);
|
||||||
panel->user_format = mhl_str_dup (get_profile_string (section, "user_format",
|
panel->user_format = g_strdup (get_profile_string (section, "user_format",
|
||||||
DEFAULT_USER_FORMAT,
|
DEFAULT_USER_FORMAT,
|
||||||
profile_name));
|
profile_name));
|
||||||
for (i = 0; i < LIST_TYPES; i++){
|
for (i = 0; i < LIST_TYPES; i++){
|
||||||
g_free (panel->user_status_format [i]);
|
g_free (panel->user_status_format [i]);
|
||||||
g_snprintf (buffer, sizeof (buffer), "user_status%d", i);
|
g_snprintf (buffer, sizeof (buffer), "user_status%d", i);
|
||||||
panel->user_status_format [i] =
|
panel->user_status_format [i] =
|
||||||
mhl_str_dup (get_profile_string (section, buffer,
|
g_strdup (get_profile_string (section, buffer,
|
||||||
DEFAULT_USER_FORMAT, profile_name));
|
DEFAULT_USER_FORMAT, profile_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,9 +44,6 @@
|
|||||||
# include <stropts.h> /* For I_PUSH */
|
# include <stropts.h> /* For I_PUSH */
|
||||||
#endif /* HAVE_STROPTS_H */
|
#endif /* HAVE_STROPTS_H */
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h" /* LINES */
|
#include "tty.h" /* LINES */
|
||||||
#include "panel.h" /* current_panel */
|
#include "panel.h" /* current_panel */
|
||||||
|
@ -41,10 +41,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/types.h>
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "treestore.h"
|
#include "treestore.h"
|
||||||
#include "profile.h"
|
#include "profile.h"
|
||||||
|
@ -23,9 +23,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
|
65
src/util.c
65
src/util.c
@ -34,10 +34,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/escape.h>
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "profile.h"
|
#include "profile.h"
|
||||||
#include "main.h" /* mc_home */
|
#include "main.h" /* mc_home */
|
||||||
@ -1550,12 +1546,14 @@ Q_ (const char *s)
|
|||||||
/** To be compatible with the general posix command lines we have to escape
|
/** To be compatible with the general posix command lines we have to escape
|
||||||
strings for the command line
|
strings for the command line
|
||||||
|
|
||||||
/params const char * in
|
\params in
|
||||||
string for escaping
|
string for escaping
|
||||||
/returns
|
|
||||||
|
\returns
|
||||||
return escaped string (later need to free)
|
return escaped string (later need to free)
|
||||||
*/
|
*/
|
||||||
static char* shell_escape(const char* src)
|
char*
|
||||||
|
shell_escape(const char* src)
|
||||||
{
|
{
|
||||||
if ((src==NULL)||(!(*src)))
|
if ((src==NULL)||(!(*src)))
|
||||||
return strdup("");
|
return strdup("");
|
||||||
@ -1590,12 +1588,14 @@ static char* shell_escape(const char* src)
|
|||||||
/** Unescape paths or other strings for e.g the internal cd
|
/** Unescape paths or other strings for e.g the internal cd
|
||||||
shell-unescape within a given buffer (writing to it!)
|
shell-unescape within a given buffer (writing to it!)
|
||||||
|
|
||||||
/params const char * src
|
\params src
|
||||||
string for unescaping
|
string for unescaping
|
||||||
/returns
|
|
||||||
|
\returns
|
||||||
return unescaped string
|
return unescaped string
|
||||||
*/
|
*/
|
||||||
static char* shell_unescape(char* text)
|
char*
|
||||||
|
shell_unescape(char* text)
|
||||||
{
|
{
|
||||||
if (!text)
|
if (!text)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1660,53 +1660,20 @@ out:
|
|||||||
|
|
||||||
/** Check if char in pointer contain escape'd chars
|
/** Check if char in pointer contain escape'd chars
|
||||||
|
|
||||||
/params const char * in
|
\params in
|
||||||
string for checking
|
string for checking
|
||||||
/returns
|
|
||||||
|
\returns
|
||||||
return TRUE if string contain escaped chars
|
return TRUE if string contain escaped chars
|
||||||
otherwise return FALSE
|
otherwise return FALSE
|
||||||
*/
|
*/
|
||||||
static gboolean
|
gboolean
|
||||||
shell_is_char_escaped ( const char *in )
|
shell_is_char_escaped ( const char *in )
|
||||||
{
|
{
|
||||||
if (in == NULL || !*in || in[0] != '\\')
|
if (in == NULL || !*in || in[0] != '\\')
|
||||||
return false;
|
return FALSE;
|
||||||
if (shell_escape_toesc(in[1]))
|
if (shell_escape_toesc(in[1]))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*FIXME: move back to concat_dir_and_file */
|
|
||||||
static char* str_dir_plus_file(const char* dirname, const char* filename)
|
|
||||||
{
|
|
||||||
/* make sure we have valid strings */
|
|
||||||
if (!dirname)
|
|
||||||
dirname="";
|
|
||||||
|
|
||||||
if (!filename)
|
|
||||||
filename="";
|
|
||||||
|
|
||||||
/* skip leading slashes on filename */
|
|
||||||
while (*filename == '/')
|
|
||||||
filename++;
|
|
||||||
|
|
||||||
/* skip trailing slashes on dirname */
|
|
||||||
size_t dnlen = strlen(dirname);
|
|
||||||
while ((dnlen != 0) && (dirname[dnlen-1]=='/'))
|
|
||||||
dnlen--;
|
|
||||||
|
|
||||||
size_t fnlen = strlen(filename);
|
|
||||||
/*TODO: was previously calloc(1,dnlen+fnlen+2) - please review*/
|
|
||||||
char* buffer = g_malloc(dnlen+fnlen+2); /* enough space for dirname, /, filename, zero */
|
|
||||||
char* ptr = buffer;
|
|
||||||
|
|
||||||
memcpy(ptr, dirname, dnlen);
|
|
||||||
ptr+=dnlen;
|
|
||||||
*ptr = '/';
|
|
||||||
ptr++;
|
|
||||||
memcpy(ptr, filename, fnlen);
|
|
||||||
ptr+=fnlen;
|
|
||||||
*ptr = 0;
|
|
||||||
|
|
||||||
return buffer;
|
|
||||||
}
|
|
11
src/util.h
11
src/util.h
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
|
||||||
/* Returns its argument as a "modifiable" string. This function is
|
/* Returns its argument as a "modifiable" string. This function is
|
||||||
* intended to pass strings to legacy libraries that don't know yet
|
* intended to pass strings to legacy libraries that don't know yet
|
||||||
* about the "const" modifier. The return value of this function
|
* about the "const" modifier. The return value of this function
|
||||||
@ -256,4 +257,14 @@ extern int ascii_alpha_to_cntrl (int ch);
|
|||||||
#undef Q_
|
#undef Q_
|
||||||
const char *Q_ (const char *s);
|
const char *Q_ (const char *s);
|
||||||
|
|
||||||
|
|
||||||
|
gboolean shell_is_char_escaped ( const char * );
|
||||||
|
char *shell_unescape( char * );
|
||||||
|
char *shell_escape( const char * );
|
||||||
|
|
||||||
|
#define str_dup_range(s_start, s_bound) (g_strndup(s_start, s_bound - s_start))
|
||||||
|
#define str_move(dest, src) (g_strlcpy(dest,src,strlen(src)))
|
||||||
|
|
||||||
|
#define MC_PTR_FREE(ptr) do { g_free(ptr); (ptr) = NULL; } while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,10 +41,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/types.h>
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "execute.h"
|
#include "execute.h"
|
||||||
#include "wtools.h" /* message() */
|
#include "wtools.h" /* message() */
|
||||||
@ -430,7 +426,7 @@ canonicalize_pathname (char *path)
|
|||||||
if (p[0] == PATH_SEP && p[1] == PATH_SEP) {
|
if (p[0] == PATH_SEP && p[1] == PATH_SEP) {
|
||||||
s = p + 1;
|
s = p + 1;
|
||||||
while (*(++s) == PATH_SEP);
|
while (*(++s) == PATH_SEP);
|
||||||
mhl_strmove (p + 1, s);
|
str_move (p + 1, s);
|
||||||
}
|
}
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
@ -439,7 +435,7 @@ canonicalize_pathname (char *path)
|
|||||||
p = lpath;
|
p = lpath;
|
||||||
while (*p) {
|
while (*p) {
|
||||||
if (p[0] == PATH_SEP && p[1] == '.' && p[2] == PATH_SEP)
|
if (p[0] == PATH_SEP && p[1] == '.' && p[2] == PATH_SEP)
|
||||||
mhl_strmove (p, p + 2);
|
str_move (p, p + 2);
|
||||||
else
|
else
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
@ -455,7 +451,7 @@ canonicalize_pathname (char *path)
|
|||||||
lpath[1] = 0;
|
lpath[1] = 0;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
mhl_strmove (lpath, lpath + 2);
|
str_move (lpath, lpath + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,10 +497,10 @@ canonicalize_pathname (char *path)
|
|||||||
if (p[3] != 0) {
|
if (p[3] != 0) {
|
||||||
if (s == lpath && *s == PATH_SEP) {
|
if (s == lpath && *s == PATH_SEP) {
|
||||||
/* "/../foo" -> "/foo" */
|
/* "/../foo" -> "/foo" */
|
||||||
mhl_strmove (s + 1, p + 4);
|
str_move (s + 1, p + 4);
|
||||||
} else {
|
} else {
|
||||||
/* "token/../foo" -> "foo" */
|
/* "token/../foo" -> "foo" */
|
||||||
mhl_strmove (s, p + 4);
|
str_move (s, p + 4);
|
||||||
}
|
}
|
||||||
p = (s > lpath) ? s - 1 : s;
|
p = (s > lpath) ? s - 1 : s;
|
||||||
continue;
|
continue;
|
||||||
|
@ -43,10 +43,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <mhl/types.h>
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "cmd.h" /* For view_other_cmd */
|
#include "cmd.h" /* For view_other_cmd */
|
||||||
|
@ -34,10 +34,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <mhl/types.h>
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
|
@ -29,9 +29,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "color.h" /* dialog_colors */
|
#include "color.h" /* dialog_colors */
|
||||||
|
@ -22,9 +22,6 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
#include "../src/tty.h" /* enable/disable interrupt key */
|
#include "../src/tty.h" /* enable/disable interrupt key */
|
||||||
#include "../src/wtools.h" /* message() */
|
#include "../src/wtools.h" /* message() */
|
||||||
|
@ -28,9 +28,6 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
#include "../src/tty.h" /* enable/disable interrupt key */
|
#include "../src/tty.h" /* enable/disable interrupt key */
|
||||||
#include "../src/wtools.h" /* message() */
|
#include "../src/wtools.h" /* message() */
|
||||||
|
@ -36,9 +36,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
#include "../src/tty.h" /* enable/disable interrupt key */
|
#include "../src/tty.h" /* enable/disable interrupt key */
|
||||||
#include "../src/wtools.h" /* message() */
|
#include "../src/wtools.h" /* message() */
|
||||||
|
10
vfs/fish.c
10
vfs/fish.c
@ -42,6 +42,7 @@
|
|||||||
#include "../src/tty.h" /* enable/disable interrupt key */
|
#include "../src/tty.h" /* enable/disable interrupt key */
|
||||||
#include "../src/wtools.h" /* message() */
|
#include "../src/wtools.h" /* message() */
|
||||||
#include "../src/main.h" /* print_vfs_message */
|
#include "../src/main.h" /* print_vfs_message */
|
||||||
|
#include "../src/util.h"
|
||||||
#include "utilvfs.h"
|
#include "utilvfs.h"
|
||||||
#include "xdirentry.h"
|
#include "xdirentry.h"
|
||||||
#include "vfs.h"
|
#include "vfs.h"
|
||||||
@ -50,9 +51,6 @@
|
|||||||
#include "tcputil.h"
|
#include "tcputil.h"
|
||||||
#include "../src/unixcompat.h"
|
#include "../src/unixcompat.h"
|
||||||
#include "fish.h"
|
#include "fish.h"
|
||||||
#include "../mhl/memory.h"
|
|
||||||
#include "../mhl/string.h"
|
|
||||||
#include "../mhl/escape.h"
|
|
||||||
|
|
||||||
int fish_directory_timeout = 900;
|
int fish_directory_timeout = 900;
|
||||||
|
|
||||||
@ -524,10 +522,10 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
|||||||
--linkname_bound; // skip trailing "
|
--linkname_bound; // skip trailing "
|
||||||
}
|
}
|
||||||
|
|
||||||
ent->name = mhl_str_dup_range(filename, filename_bound);
|
ent->name = str_dup_range(filename, filename_bound);
|
||||||
shell_unescape(ent->name);
|
shell_unescape(ent->name);
|
||||||
|
|
||||||
ent->ino->linkname = mhl_str_dup_range(linkname, linkname_bound);
|
ent->ino->linkname = str_dup_range(linkname, linkname_bound);
|
||||||
shell_unescape(ent->ino->linkname);
|
shell_unescape(ent->ino->linkname);
|
||||||
} else {
|
} else {
|
||||||
// we expect: "escaped-name"
|
// we expect: "escaped-name"
|
||||||
@ -541,7 +539,7 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
|||||||
--filename_bound;
|
--filename_bound;
|
||||||
}
|
}
|
||||||
|
|
||||||
ent->name = mhl_str_dup_range(filename, filename_bound);
|
ent->name = str_dup_range(filename, filename_bound);
|
||||||
shell_unescape(ent->name);
|
shell_unescape(ent->name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -69,9 +69,6 @@ What to do with this?
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
#include "../src/tty.h" /* enable/disable interrupt key */
|
#include "../src/tty.h" /* enable/disable interrupt key */
|
||||||
#include "../src/wtools.h" /* message() */
|
#include "../src/wtools.h" /* message() */
|
||||||
|
3
vfs/gc.c
3
vfs/gc.c
@ -31,9 +31,6 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <ctype.h> /* is_digit() */
|
#include <ctype.h> /* is_digit() */
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
#include "../src/tty.h" /* enable/disable interrupt key */
|
#include "../src/tty.h" /* enable/disable interrupt key */
|
||||||
#include "../src/wtools.h" /* message() */
|
#include "../src/wtools.h" /* message() */
|
||||||
|
@ -5,9 +5,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
#include "../src/tty.h" /* enable/disable interrupt key */
|
#include "../src/tty.h" /* enable/disable interrupt key */
|
||||||
#include "../src/wtools.h" /* message() */
|
#include "../src/wtools.h" /* message() */
|
||||||
|
@ -34,9 +34,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
#include "../src/tty.h" /* enable/disable interrupt key */
|
#include "../src/tty.h" /* enable/disable interrupt key */
|
||||||
#include "../src/wtools.h" /* message() */
|
#include "../src/wtools.h" /* message() */
|
||||||
|
@ -51,9 +51,6 @@
|
|||||||
#include <ext2fs/ext2fs.h>
|
#include <ext2fs/ext2fs.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
#include "../src/tty.h" /* enable/disable interrupt key */
|
#include "../src/tty.h" /* enable/disable interrupt key */
|
||||||
#include "../src/wtools.h" /* message() */
|
#include "../src/wtools.h" /* message() */
|
||||||
|
@ -22,10 +22,6 @@
|
|||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <mhl/types.h>
|
|
||||||
#include <mhl/memory.h>
|
|
||||||
#include <mhl/string.h>
|
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
#include "../src/tty.h" /* enable/disable interrupt key */
|
#include "../src/tty.h" /* enable/disable interrupt key */
|
||||||
#include "../src/wtools.h" /* message() */
|
#include "../src/wtools.h" /* message() */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user