chiark / gitweb /
*** empty log message ***
authorjames <james>
Thu, 7 Feb 2008 15:42:49 +0000 (15:42 +0000)
committerjames <james>
Thu, 7 Feb 2008 15:42:49 +0000 (15:42 +0000)
apps/ipc.c [new file with mode: 0644]
apps/ipc.h [new file with mode: 0644]
apps/sympathyd.c

diff --git a/apps/ipc.c b/apps/ipc.c
new file mode 100644 (file)
index 0000000..708a5e1
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * ipc.c:
+ *
+ * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
+ * All rights reserved.
+ *
+ */
+
+static char rcsid[] = "$Id$";
+
+/*
+ * $Log$
+ * Revision 1.1  2008/02/07 15:42:49  james
+ * *** empty log message ***
+ *
+ */
+
diff --git a/apps/ipc.h b/apps/ipc.h
new file mode 100644 (file)
index 0000000..9ac3642
--- /dev/null
@@ -0,0 +1,5 @@
+
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#define SOCKPATH "/tmp/sympathy"
index 8bed929..a535ac6 100644 (file)
@@ -10,13 +10,44 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.2  2008/02/07 15:42:49  james
+ * *** empty log message ***
+ *
  * Revision 1.1  2008/02/05 14:25:49  james
  * *** empty log message ***
  *
  */
 
 #include "sympathy.h"
+#include "ipc.h"
 
 int main(int argc,char *argv[])
 {
+int fd;
+struct sockaddr_un sun={0};
+
+fd=socket(PF_UNIX,SOCK_STREAM,0);
+if (fd<0) {
+       perror("socket");
+       exit(1);
+}
+
+sun.sun_family=AF_UNIX;
+strcpy(sun.sun_path,SOCKPATH);
+
+unlink(SOCKPATH);
+
+if (bind(fd,(struct sockaddr *) &sun,sizeof(sun))<0)  {
+       perror("bind");
+       exit(1);
+}
+
+if (listen(fd,5)<0) {
+       perror("listen");
+       exit(1);
+}
+
+
+
+
 }