client code added
authorCarsten Haitzler <raster@rasterman.com>
Mon, 12 Mar 2001 01:06:09 +0000 (01:06 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Mon, 12 Mar 2001 01:06:09 +0000 (01:06 +0000)
SVN revision: 4366

Makefile.am
client/Makefile.am [new file with mode: 0644]
client/client.c [new file with mode: 0644]
configure.in

index 9c57908..a80ebd0 100644 (file)
@@ -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 (file)
index 0000000..7eb3ced
--- /dev/null
@@ -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 (file)
index 0000000..6cf7c20
--- /dev/null
@@ -0,0 +1,75 @@
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <stdio.h>
+
+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);
+}
index d37b299..8ce01ee 100644 (file)
@@ -100,6 +100,7 @@ AC_OUTPUT([
 Makefile
 src/Makefile
 lib/Makefile
+client/Makefile
 intl/Makefile
 po/Makefile.in
 ])