string escaping

This commit is contained in:
nova
2026-05-01 22:17:33 +02:00
parent 6372dbba69
commit 1711926003
6 changed files with 85 additions and 61 deletions

View File

@@ -234,20 +234,19 @@ void move_right(){
} else {
unsigned long i = 0;
char match = 0;
char *mime = get_mimetype(mid_content[selected_file_current].file_name);
char *mime = get_mimetype(&mid_content[selected_file_current]);
char *extension = strrchr(mid_content[selected_file_current].file_name, '.');
if (extension != NULL) {
for (i = 0; i < file_extension_default_count; i++) {
if (strstr(extension, file_extension_default_cmd[i].file_extension)) {
char *cmd;
concat(cmd, file_extension_default_cmd[i].command, " ./\'", 0);
concat(cmd, cmd, mid_content[selected_file_current].file_name, 1);
concat(cmd, cmd, "\'", 1);
cmd = parse_cmd(file_extension_default_cmd[i].command, &mid_content[selected_file_current]);
printf("\n%s\n",cmd);
if (system(cmd) == -1) {
/*do nothing*/
}
free(cmd);
curs_set(1); /*for some reason, 1 here turns it invisible once again */
match = 1;
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_RELOAD_FULL | STATUS_RELOAD_DIRECTORY);
@@ -259,7 +258,7 @@ void move_right(){
for (i = 0; i < mimetype_default_count; i++) {
if (strstr(mime, mimetype_default_cmd[i].mimetype)) {
char *cmd = parse_cmd_char(mimetype_default_cmd[i].command, mid_content[selected_file_current].file_name);
char *cmd = parse_cmd(mimetype_default_cmd[i].command, &mid_content[selected_file_current]);
if (system(cmd) == -1) {
/*do nothing*/
}