Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

please add ability to run sh files from file manager #50

Closed
sergey6661313 opened this issue Apr 5, 2023 · 4 comments
Closed

please add ability to run sh files from file manager #50

sergey6661313 opened this issue Apr 5, 2023 · 4 comments

Comments

@sergey6661313
Copy link

why do I need a file manager that can't run files?

@sikmir
Copy link
Contributor

sikmir commented Apr 5, 2023

b spawn a shell in the current directory

Why not spawn a shell and run a command?

@sergey6661313
Copy link
Author

b spawn a shell in the current directory

Why not spawn a shell and run a command?

I have to type in the shell the name of the file. I thought the file manager was needed for this: in order not to type anything again.

@afify
Copy link
Owner

afify commented Apr 5, 2023

diff --git a/config.def.h b/config.def.h
index 7e7c200..41880ee 100644
--- a/config.def.h
+++ b/config.def.h
@@ -54,12 +54,14 @@ static const char *mupdf[]        = { "mupdf", "-I" };
 static const char *libreoffice[]  = { "libreoffice" };
 static const char *gimp[]         = { "gimp" };
 static const char *r2[]           = { "r2", "-c", "vv" };
+static const char *sh_cmd[]           = { "sh" };
 
 /* extensions*/
 static const char *images[]    = { "bmp", "jpg", "jpeg", "png", "gif", "webp", "xpm" };
 static const char *pdf[]       = { "epub", "pdf" };
 static const char *arts[]      = { "xcf" };
 static const char *obj[]       = { "o", "a", "so" };
+static const char *shell_ext[]     = { "sh" };
 static const char *videos[]    = { "avi", "flv", "wav", "webm", "wma", "wmv",
 				   "m2v", "m4a", "m4v", "mkv", "mov", "mp3",
 				   "mp4", "mpeg", "mpg" };
@@ -73,6 +75,7 @@ static Rule rules[] = {
 	{documents, LEN(documents), libreoffice, LEN(libreoffice) },
 	{arts,      LEN(arts),      gimp,        LEN(gimp)        },
 	{obj,       LEN(obj),       r2,          LEN(r2)          },
+	{shell_ext,     LEN(shell_ext),     sh_cmd,          LEN(sh_cmd)          },
 };
 
 /* normal keys */

@sergey6661313

@sergey6661313
Copy link
Author

diff --git a/config.def.h b/config.def.h
index 7aae364..d74de02 100644
--- a/config.def.h
+++ b/config.def.h
@@ -59,12 +59,14 @@ static const char *mupdf[]        = { "mupdf" };
 static const char *libreoffice[]  = { "libreoffice" };
 static const char *gimp[]         = { "gimp" };
 static const char *r2[]           = { "r2", "-c", "vv" };
+static const char *sh[]           = { "sh" };
 
 /* extensions*/
 static const char *images[]    = { "bmp", "jpg", "jpeg", "png", "gif", "webp", "xpm" };
 static const char *pdf[]       = { "epub", "pdf" };
 static const char *arts[]      = { "xcf" };
 static const char *obj[]       = { "o", "a", "so" };
+static const char *shell_ext[]     = { "sh" };
 static const char *videos[]    = { "avi", "flv", "wav", "webm", "wma", "wmv",
 				   "m2v", "m4a", "m4v", "mkv", "mov", "mp3",
 				   "mp4", "mpeg", "mpg" };
@@ -78,6 +80,7 @@ static Rule rules[] = {
 	{documents, LEN(documents), libreoffice, LEN(libreoffice) },
 	{arts,      LEN(arts),      gimp,        LEN(gimp)        },
 	{obj,       LEN(obj),       r2,          LEN(r2)          },
+	{shell_ext,     LEN(shell_ext),     sh,          LEN(sh)          },
 };
 
 /* normal keys */

[sfm-0.4]$ make
sfm build options:
CFLAGS   = -std=c99 -pedantic -Wextra -Wall -Wno-unused-parameter -Os -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -DVERSION="0.4"
LDFLAGS  = -pthread -s
CC       = cc
cc -c -std=c99 -pedantic -Wextra -Wall -Wno-unused-parameter -Os -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -DVERSION=\"0.4\" sfm.c
In file included from sfm.c:227:
config.h:57:20: error: conflicting types for 'sh'; have 'const char *[]'
   57 | static const char *sh[]           = { "sh"};
      |                    ^~
sfm.c:200:13: note: previous definition of 'sh' with type 'char[8]'
  200 | static char sh[] = "/bin/sh";
      |             ^~
sfm.c: In function 'get_shell':
sfm.c:1875:26: warning: assignment to 'char *' from incompatible pointer type 'const char **' [-Wincompatible-pointer-types]
 1875 |                 shell[0] = sh;
      |                          ^
sfm.c: At top level:
sfm.c:200:13: warning: 'sh' defined but not used [-Wunused-variable]
  200 | static char sh[] = "/bin/sh";
      |             ^~
make: *** [Makefile:18: sfm.o] Error 1

@afify afify closed this as completed Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants