Merge release-5-0 into master
[alexxy/gromacs.git] / src / gromacs / gmxlib / main.cpp
index 253e69ce31dcbc604e5d58dc67c544f0523198a8..bda57a6a7918a78db0baa07c5734a867e74c7c64 100644 (file)
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef GMX_NATIVE_WINDOWS
+#include <process.h>
+#endif
 
-#include "gromacs/utility/smalloc.h"
 #include "types/commrec.h"
-#include "gmx_fatal.h"
 #include "network.h"
 #include "main.h"
 #include "macros.h"
-#include "gromacs/fileio/futil.h"
+#include "gromacs/utility/futil.h"
 #include "gromacs/fileio/filenm.h"
 #include "gromacs/fileio/gmxfio.h"
-#include "gromacs/utility/cstringutil.h"
 #include "copyrite.h"
 
+#include "gromacs/utility/basenetwork.h"
+#include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/exceptions.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxmpi.h"
 #include "gromacs/utility/programcontext.h"
+#include "gromacs/utility/smalloc.h"
 
 /* The source code in this file should be thread-safe.
          Please keep it that way. */
 
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef GMX_NATIVE_WINDOWS
-#include <process.h>
-#endif
-
 #define BUFSIZE 1024
 
-
 static void par_fn(char *base, int ftp, const t_commrec *cr,
                    gmx_bool bAppendSimId, gmx_bool bAppendNodeId,
                    char buf[], int bufsize)
@@ -223,26 +220,6 @@ void check_multi_int64(FILE *log, const gmx_multisim_t *ms,
 }
 
 
-int gmx_gethostname(char *name, size_t len)
-{
-    if (len < 8)
-    {
-        gmx_incons("gmx_gethostname called with len<8");
-    }
-#if defined(HAVE_UNISTD_H) && !defined(__native_client__)
-    if (gethostname(name, len-1) != 0)
-    {
-        strncpy(name, "unknown", 8);
-        return -1;
-    }
-    return 0;
-#else
-    strncpy(name, "unknown", 8);
-    return -1;
-#endif
-}
-
-
 void gmx_log_open(const char *lognm, const t_commrec *cr, gmx_bool bMasterOnly,
                   gmx_bool bAppendFiles, FILE** fplog)
 {