parent
16491b4d25
commit
b1228e176b
72
eesh/E.h
72
eesh/E.h
|
@ -67,42 +67,42 @@
|
||||||
#define LIST_TYPE_CLIENT 1
|
#define LIST_TYPE_CLIENT 1
|
||||||
|
|
||||||
typedef struct _list
|
typedef struct _list
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
char *name;
|
char *name;
|
||||||
int id;
|
int id;
|
||||||
void *item;
|
void *item;
|
||||||
|
|
||||||
struct _list *next;
|
struct _list *next;
|
||||||
}
|
}
|
||||||
List;
|
List;
|
||||||
|
|
||||||
typedef struct _client
|
typedef struct _client
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
Window win;
|
Window win;
|
||||||
char *msg;
|
char *msg;
|
||||||
char *clientname;
|
char *clientname;
|
||||||
char *version;
|
char *version;
|
||||||
char *author;
|
char *author;
|
||||||
char *email;
|
char *email;
|
||||||
char *web;
|
char *web;
|
||||||
char *address;
|
char *address;
|
||||||
char *info;
|
char *info;
|
||||||
Pixmap pmap;
|
Pixmap pmap;
|
||||||
}
|
}
|
||||||
Client;
|
Client;
|
||||||
|
|
||||||
typedef struct _root
|
typedef struct _root
|
||||||
{
|
{
|
||||||
Window win;
|
Window win;
|
||||||
Visual *vis;
|
Visual *vis;
|
||||||
int depth;
|
int depth;
|
||||||
Colormap cmap;
|
Colormap cmap;
|
||||||
int scr;
|
int scr;
|
||||||
int w, h;
|
int w, h;
|
||||||
Window focuswin;
|
Window focuswin;
|
||||||
}
|
}
|
||||||
Root;
|
Root;
|
||||||
|
|
||||||
int EExit(void *code);
|
int EExit(void *code);
|
||||||
|
@ -219,11 +219,17 @@ extern int debug_level;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Alert(char *fmt,...);
|
void Alert(char *fmt, ...);
|
||||||
void InitStringList(void);
|
void InitStringList(void);
|
||||||
void AssignIgnoreFunction(int (*FunctionToAssign) (void *), void *params);
|
void AssignIgnoreFunction(int (*FunctionToAssign) (void *),
|
||||||
void AssignRestartFunction(int (*FunctionToAssign) (void *), void *params);
|
|
||||||
void AssignExitFunction(int (*FunctionToAssign) (void *), void *params);
|
void *params);
|
||||||
|
void AssignRestartFunction(int (*FunctionToAssign) (void *),
|
||||||
|
|
||||||
|
void *params);
|
||||||
|
void AssignExitFunction(int (*FunctionToAssign) (void *),
|
||||||
|
|
||||||
|
void *params);
|
||||||
void AssignTitleText(char *text);
|
void AssignTitleText(char *text);
|
||||||
void AssignIgnoreText(char *text);
|
void AssignIgnoreText(char *text);
|
||||||
void AssignRestartText(char *text);
|
void AssignRestartText(char *text);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2000 Carsten Haitzler, Geoff Harrison and various contributors
|
Copyright (C) 2000 Carsten Haitzler, Geoff Harrison and various contributors
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ int call_level;
|
||||||
int debug_level;
|
int debug_level;
|
||||||
|
|
||||||
void
|
void
|
||||||
Alert(char *fmt,...)
|
Alert(char *fmt, ...)
|
||||||
{
|
{
|
||||||
char text[10240];
|
char text[10240];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
10
eesh/comms.c
10
eesh/comms.c
|
@ -49,11 +49,11 @@ CommsFindCommsWindow()
|
||||||
if (a != None)
|
if (a != None)
|
||||||
{
|
{
|
||||||
s = NULL;
|
s = NULL;
|
||||||
XGetWindowProperty(disp, root.win, a, 0, 14, False, AnyPropertyType, &ar,
|
XGetWindowProperty(disp, root.win, a, 0, 14, False, AnyPropertyType,
|
||||||
&format, &num, &after, &s);
|
&ar, &format, &num, &after, &s);
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
comms_win = 0;
|
comms_win = 0;
|
||||||
sscanf((char *)s, "%*s %x", (unsigned int *)&comms_win);
|
sscanf((char *)s, "%*s %x", (unsigned int *)&comms_win);
|
||||||
XFree(s);
|
XFree(s);
|
||||||
}
|
}
|
||||||
|
@ -68,8 +68,8 @@ CommsFindCommsWindow()
|
||||||
if (comms_win)
|
if (comms_win)
|
||||||
{
|
{
|
||||||
XGetWindowProperty(disp, comms_win, a, 0, 14, False,
|
XGetWindowProperty(disp, comms_win, a, 0, 14, False,
|
||||||
AnyPropertyType, &ar, &format, &num, &after,
|
AnyPropertyType, &ar, &format, &num,
|
||||||
&s);
|
&after, &s);
|
||||||
if (s)
|
if (s)
|
||||||
XFree(s);
|
XFree(s);
|
||||||
else
|
else
|
||||||
|
|
43
eesh/file.c
43
eesh/file.c
|
@ -230,8 +230,7 @@ cp(char *s, char *ss)
|
||||||
EDBUG_RETURN_;
|
EDBUG_RETURN_;
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t
|
time_t moddate(char *s)
|
||||||
moddate(char *s)
|
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
@ -327,7 +326,8 @@ char *
|
||||||
username(int uid)
|
username(int uid)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
#ifndef __EMX__
|
|
||||||
|
#ifndef __EMX__
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
|
|
||||||
EDBUG(9, "username");
|
EDBUG(9, "username");
|
||||||
|
@ -339,8 +339,8 @@ username(int uid)
|
||||||
EDBUG_RETURN(s);
|
EDBUG_RETURN(s);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if ((s = getenv("USER")) != NULL)
|
if ((s = getenv("USER")) != NULL)
|
||||||
EDBUG_RETURN(duplicate(s));
|
EDBUG_RETURN(duplicate(s));
|
||||||
#endif
|
#endif
|
||||||
EDBUG_RETURN(duplicate("unknown"));
|
EDBUG_RETURN(duplicate("unknown"));
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,8 @@ char *
|
||||||
homedir(int uid)
|
homedir(int uid)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
#ifndef __EMX__
|
|
||||||
|
#ifndef __EMX__
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
|
|
||||||
EDBUG(9, "homedir");
|
EDBUG(9, "homedir");
|
||||||
|
@ -361,10 +362,10 @@ homedir(int uid)
|
||||||
EDBUG_RETURN(s);
|
EDBUG_RETURN(s);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if ((s = getenv("HOME")) != NULL)
|
if ((s = getenv("HOME")) != NULL)
|
||||||
EDBUG_RETURN(duplicate(s));
|
EDBUG_RETURN(duplicate(s));
|
||||||
if ((s = getenv("TMP")) != NULL)
|
if ((s = getenv("TMP")) != NULL)
|
||||||
EDBUG_RETURN(duplicate(s));
|
EDBUG_RETURN(duplicate(s));
|
||||||
#endif
|
#endif
|
||||||
EDBUG_RETURN(duplicate("/tmp"));
|
EDBUG_RETURN(duplicate("/tmp"));
|
||||||
}
|
}
|
||||||
|
@ -372,7 +373,7 @@ homedir(int uid)
|
||||||
char *
|
char *
|
||||||
usershell(int uid)
|
usershell(int uid)
|
||||||
{
|
{
|
||||||
#ifndef __EMX__
|
#ifndef __EMX__
|
||||||
char *s;
|
char *s;
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
|
|
||||||
|
@ -386,7 +387,7 @@ usershell(int uid)
|
||||||
}
|
}
|
||||||
EDBUG_RETURN(duplicate("/bin/sh"));
|
EDBUG_RETURN(duplicate("/bin/sh"));
|
||||||
#else
|
#else
|
||||||
EDBUG_RETURN(duplicate("sh.exe"));
|
EDBUG_RETURN(duplicate("sh.exe"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -612,9 +613,9 @@ pathtoexec(char *file)
|
||||||
s[len] = 0;
|
s[len] = 0;
|
||||||
s = Erealloc(s, len + 2 + exelen);
|
s = Erealloc(s, len + 2 + exelen);
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
if (s[len-1] != '/')
|
if (s[len - 1] != '/')
|
||||||
#endif
|
#endif
|
||||||
strcat(s, "/");
|
strcat(s, "/");
|
||||||
strcat(s, file);
|
strcat(s, file);
|
||||||
if (canexec(s))
|
if (canexec(s))
|
||||||
EDBUG_RETURN(s);
|
EDBUG_RETURN(s);
|
||||||
|
@ -630,9 +631,9 @@ pathtoexec(char *file)
|
||||||
s[len] = 0;
|
s[len] = 0;
|
||||||
s = Erealloc(s, len + 2 + exelen);
|
s = Erealloc(s, len + 2 + exelen);
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
if (s[len-1] != '/')
|
if (s[len - 1] != '/')
|
||||||
#endif
|
#endif
|
||||||
strcat(s, "/");
|
strcat(s, "/");
|
||||||
strcat(s, file);
|
strcat(s, file);
|
||||||
if (canexec(s))
|
if (canexec(s))
|
||||||
EDBUG_RETURN(s);
|
EDBUG_RETURN(s);
|
||||||
|
@ -652,7 +653,7 @@ pathtofile(char *file)
|
||||||
#ifndef __EMX__
|
#ifndef __EMX__
|
||||||
if (file[0] == '/')
|
if (file[0] == '/')
|
||||||
#else
|
#else
|
||||||
if (_fnisabs(file))
|
if (_fnisabs(file))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (exists(file))
|
if (exists(file))
|
||||||
|
@ -679,9 +680,9 @@ pathtofile(char *file)
|
||||||
s[len] = 0;
|
s[len] = 0;
|
||||||
s = Erealloc(s, len + 2 + exelen);
|
s = Erealloc(s, len + 2 + exelen);
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
if (s[len-1] != '/')
|
if (s[len - 1] != '/')
|
||||||
#endif
|
#endif
|
||||||
strcat(s, "/");
|
strcat(s, "/");
|
||||||
strcat(s, file);
|
strcat(s, file);
|
||||||
if (exists(s))
|
if (exists(s))
|
||||||
EDBUG_RETURN(s);
|
EDBUG_RETURN(s);
|
||||||
|
@ -697,9 +698,9 @@ pathtofile(char *file)
|
||||||
s[len] = 0;
|
s[len] = 0;
|
||||||
s = Erealloc(s, len + 2 + exelen);
|
s = Erealloc(s, len + 2 + exelen);
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
if (s[len-1] != '/')
|
if (s[len - 1] != '/')
|
||||||
#endif
|
#endif
|
||||||
strcat(s, "/");
|
strcat(s, "/");
|
||||||
strcat(s, file);
|
strcat(s, file);
|
||||||
if (exists(s))
|
if (exists(s))
|
||||||
EDBUG_RETURN(s);
|
EDBUG_RETURN(s);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2000 Carsten Haitzler, Geoff Harrison and various contributors
|
* Copyright (C) 2000 Carsten Haitzler, Geoff Harrison and various contributors
|
||||||
*
|
*
|
||||||
|
@ -52,7 +53,8 @@ FindItem(char *name, int id, int find_by, int type)
|
||||||
{
|
{
|
||||||
while (ptr)
|
while (ptr)
|
||||||
{
|
{
|
||||||
if ((ptr->type == type) && (!strcmp(name, ptr->name)) && (ptr->id == id))
|
if ((ptr->type == type) && (!strcmp(name, ptr->name))
|
||||||
|
&& (ptr->id == id))
|
||||||
EDBUG_RETURN(ptr->item);
|
EDBUG_RETURN(ptr->item);
|
||||||
ptr = ptr->next;
|
ptr = ptr->next;
|
||||||
}
|
}
|
||||||
|
@ -140,7 +142,8 @@ RemoveItem(char *name, int id, int find_by, int type)
|
||||||
{
|
{
|
||||||
while (ptr)
|
while (ptr)
|
||||||
{
|
{
|
||||||
if ((ptr->type == type) && (!strcmp(name, ptr->name)) && (ptr->id == id))
|
if ((ptr->type == type) && (!strcmp(name, ptr->name))
|
||||||
|
&& (ptr->id == id))
|
||||||
{
|
{
|
||||||
if (pptr)
|
if (pptr)
|
||||||
pptr->next = ptr->next;
|
pptr->next = ptr->next;
|
||||||
|
|
39
eesh/main.c
39
eesh/main.c
|
@ -24,16 +24,18 @@
|
||||||
#include "E.h"
|
#include "E.h"
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
#include <io.h> /* for select() in EMX */
|
#include <io.h> /* for select() in EMX */
|
||||||
#endif
|
#endif
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
extern char waitonly;
|
extern char waitonly;
|
||||||
|
|
||||||
static int stdin_state;
|
static int stdin_state;
|
||||||
void restore_stdin_state(void);
|
void restore_stdin_state(void);
|
||||||
void restore_stdin_state(void) {
|
void
|
||||||
|
restore_stdin_state(void)
|
||||||
|
{
|
||||||
fcntl(0, F_SETFL, stdin_state);
|
fcntl(0, F_SETFL, stdin_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,24 +61,23 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (i != (argc - 1))
|
if (i != (argc - 1))
|
||||||
{
|
{
|
||||||
command = argv[++i];
|
command = argv[++i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-ewait"))
|
else if (!strcmp(argv[i], "-ewait"))
|
||||||
{
|
{
|
||||||
waitonly = 1;
|
waitonly = 1;
|
||||||
if (i != (argc - 1))
|
if (i != (argc - 1))
|
||||||
command = argv[++i];
|
command = argv[++i];
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-display"))
|
else if (!strcmp(argv[i], "-display"))
|
||||||
{
|
{
|
||||||
if (i != (argc - 1))
|
if (i != (argc - 1))
|
||||||
display_name = duplicate(argv[++i]);
|
display_name = duplicate(argv[++i]);
|
||||||
}
|
}
|
||||||
else if ((!strcmp(argv[i], "-h")) ||
|
else if ((!strcmp(argv[i], "-h")) ||
|
||||||
(!strcmp(argv[i], "--h")) ||
|
(!strcmp(argv[i], "--h")) ||
|
||||||
(!strcmp(argv[i], "-help")) ||
|
(!strcmp(argv[i], "-help")) || (!strcmp(argv[i], "--help")))
|
||||||
(!strcmp(argv[i], "--help")))
|
|
||||||
{
|
{
|
||||||
printf("%s [ -e \"Command to Send to Enlightenment then exit\"]\n"
|
printf("%s [ -e \"Command to Send to Enlightenment then exit\"]\n"
|
||||||
" [ -ewait \"Command to Send to E then wait for a reply then exit\"]\n",
|
" [ -ewait \"Command to Send to E then wait for a reply then exit\"]\n",
|
||||||
|
@ -109,18 +110,18 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
if (command)
|
if (command)
|
||||||
{
|
{
|
||||||
CommsSend(e, command);
|
CommsSend(e, command);
|
||||||
if (!waitonly)
|
if (!waitonly)
|
||||||
{
|
{
|
||||||
XSync(disp, False);
|
XSync(disp, False);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XSync(disp, False);
|
XSync(disp, False);
|
||||||
j = 0;
|
j = 0;
|
||||||
stdin_state = fcntl(0, F_GETFL, 0);
|
stdin_state = fcntl(0, F_GETFL, 0);
|
||||||
atexit( restore_stdin_state );
|
atexit(restore_stdin_state);
|
||||||
fcntl(0, F_SETFL, O_NONBLOCK);
|
fcntl(0, F_SETFL, O_NONBLOCK);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue