add -display option for eesh patch

SVN revision: 360
This commit is contained in:
Carsten Haitzler 1999-09-22 02:16:37 +00:00
parent 80a8e772f7
commit 7692d897cc
4 changed files with 51 additions and 31 deletions

View File

@ -254,3 +254,4 @@ extern List lists;
extern Window comms_win;
extern Window my_win;
extern Root root;
extern char *display_name;

View File

@ -5,3 +5,4 @@ List lists;
Window comms_win;
Window my_win;
Root root;
char *display_name;

View File

@ -14,9 +14,49 @@ main(int argc, char **argv)
int i, j, k;
fd_set fd;
char ret;
char *command;
waitonly = 0;
lists.next = NULL;
display_name = NULL;
command = NULL;
for (i = 0; i < argc; i++)
{
if (!strcmp(argv[i], "-e"))
{
if (i != (argc - 1))
{
command = argv[++i];
}
}
else if (!strcmp(argv[i], "-ewait"))
{
waitonly = 1;
if (i != (argc - 1))
command = argv[++i];
}
else if (!strcmp(argv[i], "-display"))
{
if (i != (argc - 1))
display_name = duplicate(argv[++i]);
}
else if ((!strcmp(argv[i], "-h")) ||
(!strcmp(argv[i], "--h")) ||
(!strcmp(argv[i], "-help")) ||
(!strcmp(argv[i], "--help")))
{
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",
argv[0]);
printf("Use \"%s\" by itself to enter the \"interactive mode\"\n"
"Ctrl-D will exit interactive mode (EOF)\n"
"use \"help\" from inside interactive mode for further "
"assistance\n", argv[0]);
exit(0);
}
}
SetupX();
CommsSetup();
CommsFindCommsWindow();
@ -35,37 +75,14 @@ main(int argc, char **argv)
CommsSend(e, "set info Enlightenment IPC Shell - talk to E direct");
/* CommsSend(e, "set pixmap 0"); */
for (i = 0; i < argc; i++)
if (command)
{
if (!strcmp(argv[i], "-e"))
{
if (i != (argc - 1))
{
CommsSend(e, argv[++i]);
XSync(disp, False);
exit(0);
}
}
else if (!strcmp(argv[i], "-ewait"))
{
waitonly = 1;
if (i != (argc - 1))
CommsSend(e, argv[++i]);
}
else if ((!strcmp(argv[i], "-h")) ||
(!strcmp(argv[i], "--h")) ||
(!strcmp(argv[i], "-help")) ||
(!strcmp(argv[i], "--help")))
{
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",
argv[0]);
printf("Use \"%s\" by itself to enter the \"interactive mode\"\n"
"Ctrl-D will exit interactive mode (EOF)\n"
"use \"help\" from inside interactive mode for further "
"assistance\n", argv[0]);
exit(0);
}
CommsSend(e, command);
if (!waitonly)
{
XSync(disp, False);
exit(0);
}
}
XSync(disp, False);

View File

@ -5,7 +5,8 @@ SetupX()
{
EDBUG(6, "SetupX");
/* Open a connection to the diplay nominated by the DISPLAY variable */
disp = XOpenDisplay(NULL);
/* Or set with the -display option */
disp = XOpenDisplay(display_name);
/* if cannot connect to display */
if (!disp)
{