int err; /* file descriptor for the child process's standard error */
} Process;
-int execute(char** cmd, Process* proc);
void detach(Process* proc);
void terminate(Process* proc, int sig);
char* cmdread(char** cmd);
#define PIPE_READ 0
#define PIPE_WRITE 1
-int execute(char** cmd, Process* proc) {
+static int execute(char** cmd, Process* proc) {
int inpipe[2], outpipe[2], errpipe[2];
/* create the pipes */
if ((pipe(inpipe) < 0) || (pipe(outpipe) < 0) || (pipe(errpipe) < 0))
static void copy(void);
static void paste(void);
static void search(void);
+static void execute(void);
static void find(char* arg);
// Tag/Cmd Execution
{ KEY_CTRL_C, copy },
{ KEY_CTRL_V, paste },
{ KEY_CTRL_F, search },
+ { KEY_CTRL_E, execute },
{ 0, NULL }
};
#endif
static char* ShellCmd[] = { "/bin/sh", "-c", NULL, NULL };
-
/* Main Routine
*****************************************************************************/
int main(int argc, char** argv) {
free(str);
}
+static void execute(void) {
+ char* str = view_getstr(currview(), NULL);
+ if (str) exec(str);
+ free(str);
+}
+
static void find(char* arg) {
view_findstr(getview(EDIT), arg);
}
char op = '\0';
if (*cmd == '!' || *cmd == '<' || *cmd == '|' || *cmd == '>')
op = *cmd, cmd++;
+ ShellCmd[2] = cmd;
/* execute the command */
char *input = NULL, *output = NULL;
enum RegionId dest = EDIT;