New function: iso2709_out. This function is the reverse of iso2709_cvt.
[egate.git] / util / gipc.c
index 8116745..bd224d0 100644 (file)
@@ -2,7 +2,10 @@
  * Europagate, 1995
  *
  * $Log: gipc.c,v $
- * Revision 1.1  1995/03/27 08:24:59  adam
+ * Revision 1.2  1995/03/28 08:03:46  adam
+ * Non-blocking open used when sync is set.
+ *
+ * Revision 1.1  1995/03/27  08:24:59  adam
  * New module gip: Gateway IPc module.
  * New module gw-db: Gateway hash-db module (user information table).
  *
@@ -36,19 +39,23 @@ int gipc_open (GIP gip, const char *server, int sync)
     }
     else
     {
-        gip->wfd = open (server, O_WRONLY);
-       gip->rfd = open (gip->name, O_RDONLY);
+        gip->wfd = open (server, O_WRONLY|O_NONBLOCK);
+       gip->rfd = open (gip->name, O_RDONLY|O_NONBLOCK);
     }
     if (gip->rfd == -1)
         return -1;
     if (gip->wfd == -1)
-        return -1;
+        return -2;
+    fcntl (gip->wfd, F_SETFL, ~(O_NONBLOCK|O_APPEND));
+    fcntl (gip->rfd, F_SETFL, ~(O_NONBLOCK|O_APPEND));
     return 0;
 }
 
 int gipc_close (GIP gip)
 {
-    close (gip->rfd);
-    close (gip->wfd);
+    if (gip->rfd != -1)
+        close (gip->rfd);
+    if (gip->wfd != -1)
+        close (gip->wfd);
     return 0;
 }