1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

added nana stuff

added lock option in docked icons
This commit is contained in:
kojima
1999-10-20 03:25:06 +00:00
parent 914648cc2b
commit eb87c40967
39 changed files with 1833 additions and 501 deletions

View File

@@ -1394,97 +1394,3 @@ SendHelperMessage(WScreen *scr, char type, int workspace, char *msg)
}
free(buffer);
}
typedef struct {
WScreen *scr;
char *command;
} _tuple;
static void
shellCommandHandler(pid_t pid, unsigned char status, _tuple *data)
{
if (status == 127) {
char *buffer;
buffer = wstrappend(_("Could not execute command: "), data->command);
wMessageDialog(data->scr, _("Error"), buffer, _("OK"), NULL, NULL);
free(buffer);
} else if (status != 127) {
/*
printf("%s: %i\n", data->command, status);
*/
}
free(data->command);
free(data);
}
void
ExecuteShellCommand(WScreen *scr, char *command)
{
static char *shell = NULL;
pid_t pid;
/*
* This have a problem: if the shell is tcsh (not sure about others)
* and ~/.tcshrc have /bin/stty erase ^H somewhere on it, the shell
* will block and the command will not be executed.
if (!shell) {
shell = getenv("SHELL");
if (!shell)
shell = "/bin/sh";
}
*/
shell = "/bin/sh";
pid = fork();
if (pid==0) {
SetupEnvironment(scr);
#ifdef HAVE_SETPGID
setpgid(0, 0);
#endif
execl(shell, shell, "-c", command, NULL);
wsyserror("could not execute %s -c %s", shell, command);
Exit(-1);
} else if (pid < 0) {
wsyserror("cannot fork a new process");
} else {
_tuple *data = wmalloc(sizeof(_tuple));
data->scr = scr;
data->command = wstrdup(command);
wAddDeathHandler(pid, (WDeathHandler*)shellCommandHandler, data);
}
}
void dbprintf(char *format, ...)
{
va_list args;
va_start(args, format);
vprintf(format, args);
fflush(stdout);
va_end(args);
}
void dbputs(char *text)
{
puts(text);
fflush(stdout);
}