From faaf8a52df1461001e89cc7510ddb502de19aac1 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 12 Mar 2001 01:06:09 +0000 Subject: [PATCH] client code added SVN revision: 4366 --- Makefile.am | 2 +- client/Makefile.am | 12 ++++++++ client/client.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 1 + 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 client/Makefile.am create mode 100644 client/client.c diff --git a/Makefile.am b/Makefile.am index 9c5790859..a80ebd0a6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = intl po src lib +SUBDIRS = intl po src lib client MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess \ config.h.in config.sub configure install-sh \ diff --git a/client/Makefile.am b/client/Makefile.am new file mode 100644 index 000000000..7eb3ced71 --- /dev/null +++ b/client/Makefile.am @@ -0,0 +1,12 @@ +## Process this file with automake to produce Makefile.in + +INCLUDES = \ + -I$(top_srcdir)/intl + +bin_PROGRAMS = e_ipc_client + +e_ipc_client_SOURCES = \ +client.c + +e_ipc_client_LDADD = + diff --git a/client/client.c b/client/client.c new file mode 100644 index 000000000..6cf7c2099 --- /dev/null +++ b/client/client.c @@ -0,0 +1,75 @@ +#include +#include +#include +#include +#include +#include +#include + +struct _coords { + int xid; + int x; + int y; +}; + +typedef struct _coords coords; + +int main(void) +{ + struct sockaddr_un cli_sun; + int fd, opcode, retval, size; + char buf[100]; + coords p; + + if((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) { + perror("socket() error"); + exit(1); + } + + bzero(&cli_sun, sizeof(cli_sun)); + cli_sun.sun_family = AF_UNIX; + strncpy(cli_sun.sun_path, ".e/ecom", sizeof(cli_sun.sun_path)); + + if (connect(fd, (struct sockaddr*)&cli_sun, sizeof(cli_sun)) < 0) + { + fprintf(stderr, "EIPC Connect Error.\n"); exit(1); + } + + /* move a window */ + opcode = 1; + p.xid = 5; + p.x = 100; + p.y = 300; + + if(write(fd, &opcode, sizeof(opcode)) == -1) + perror("Cannot write data"); + + size = sizeof(p); + + if(write(fd, &size, sizeof(size)) == -1) + perror("Cannot write data"); + + if(write(fd, &p, sizeof(p)) == -1) + perror("Cannot write data"); + + read(fd, &size, sizeof(size)); + read(fd, &retval, size); + + printf("Window move successful? %d\n", retval); + + /* get e version */ + opcode = 0; + + if(write(fd, &opcode, sizeof(opcode)) == -1) + perror("Cannot write data"); + + read(fd, &size, sizeof(size)); + read(fd, &buf, size); + + printf("Enlightenment Version: %s\n", buf); + + printf("Closing socket.\n"); + close(fd); + + return(0); +} diff --git a/configure.in b/configure.in index d37b29927..8ce01eed9 100644 --- a/configure.in +++ b/configure.in @@ -100,6 +100,7 @@ AC_OUTPUT([ Makefile src/Makefile lib/Makefile +client/Makefile intl/Makefile po/Makefile.in ])