Code Monkey home page Code Monkey logo

Comments (4)

sikmir avatar sikmir commented on August 25, 2024

b spawn a shell in the current directory

Why not spawn a shell and run a command?

from sfm.

sergey6661313 avatar sergey6661313 commented on August 25, 2024

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.

from sfm.

afify avatar afify commented on August 25, 2024
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

from sfm.

sergey6661313 avatar sergey6661313 commented on August 25, 2024
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

from sfm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.