Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / imd / imdsocket.c
index 13c602d55aa20b9585e8fa8f23536bdeee1c962b..ef70405d931d6e5f5219c3c5a5bda7ec8462f012 100644 (file)
@@ -33,7 +33,7 @@
  * the research papers on the package. Check out http://www.gromacs.org.
  */
 
-/*! \libinternal \file
+/*! \internal \file
  *
  * \brief
  * Implements functions of imdsocket.h.
  *
  * \author Martin Hoefling, Carsten Kutzner <ckutzne@gwdg.de>
  *
- * \inlibraryapi
  * \ingroup module_imd
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
+#include "imdsocket.h"
 
+#include "config.h"
 
+#include <errno.h>
 #include <string.h>
-#include "smalloc.h"
-#include "gmx_fatal.h"
-#include "imdsocket.h"
-#include "imd.h"
 
+#include "gromacs/imd/imd.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
 
 #ifdef GMX_NATIVE_WINDOWS
 #ifdef GMX_HAVE_WINSOCK
@@ -79,7 +79,6 @@ extern int imdsock_winsockinit()
 #endif
 #else
 /* On UNIX, we can use nice errors from errno.h */
-#include <errno.h>
 #include <unistd.h>
 #endif
 
@@ -133,7 +132,7 @@ extern IMDSocket* imdsock_create()
 
 extern int imdsock_bind(IMDSocket *sock, int port)
 {
-    int ret = -1;
+    int ret;
 
 
 #ifdef GMX_IMD
@@ -143,6 +142,8 @@ extern int imdsock_bind(IMDSocket *sock, int port)
 
     /* Try to bind to address and port ...*/
     ret = bind(sock->sockfd, (struct sockaddr *) &sock->address, sizeof(sock->address));
+#else
+    ret = -1;
 #endif
 
     if (ret)
@@ -156,12 +157,14 @@ extern int imdsock_bind(IMDSocket *sock, int port)
 
 extern int imd_sock_listen(IMDSocket *sock)
 {
-    int ret = -1;
+    int ret;
 
 
 #ifdef GMX_IMD
     /* Try to set to listening state */
     ret = listen(sock->sockfd, MAXIMDCONNECTIONS);
+#else
+    ret = -1;
 #endif
 
     if (ret)
@@ -175,7 +178,7 @@ extern int imd_sock_listen(IMDSocket *sock)
 
 extern IMDSocket* imdsock_accept(IMDSocket *sock)
 {
-    int       ret = -1;
+    int       ret;
 
 #ifdef GMX_IMD
     socklen_t length;
@@ -207,7 +210,7 @@ extern IMDSocket* imdsock_accept(IMDSocket *sock)
 
 extern int imdsock_getport(IMDSocket *sock, int *port)
 {
-    int                ret = -1;
+    int                ret;
 #ifdef GMX_IMD
     struct sockaddr_in sin;
     socklen_t          len;