*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
+#include "gromacs/legacyheaders/readinp.h"
#include <stdio.h>
#include <stdlib.h>
-#include "typedefs.h"
-#include "string2.h"
-#include "gromacs/fileio/futil.h"
-#include "smalloc.h"
-#include "readinp.h"
-#include "macros.h"
+
#include "gromacs/fileio/gmxfio.h"
-#include "names.h"
-#include "warninp.h"
-#include "gmx_fatal.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/warninp.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/utility/smalloc.h"
t_inpfile *read_inpfile(const char *fn, int *ninp,
warninp_t wi)
fprintf(debug, "Reading MDP file %s\n", fn);
}
- in = ffopen(fn, "r");
+ in = gmx_ffopen(fn, "r");
nin = lc = 0;
do
inp[nin-1].count = 0;
inp[nin-1].bObsolete = FALSE;
inp[nin-1].bSet = FALSE;
- inp[nin-1].name = strdup(lbuf);
- inp[nin-1].value = strdup(rbuf);
+ inp[nin-1].name = gmx_strdup(lbuf);
+ inp[nin-1].value = gmx_strdup(rbuf);
}
else
{
{
/* override */
sfree(inp[found_index].value);
- inp[found_index].value = strdup(rbuf);
+ inp[found_index].value = gmx_strdup(rbuf);
sprintf(warn_buf,
"Overriding existing parameter \"%s\" with value \"%s\"\n",
lbuf, rbuf);
}
while (ptr);
- ffclose(in);
+ gmx_ffclose(in);
if (debug)
{
fprintf(stderr, "Replacing old mdp entry '%s' by '%s'\n",
inp[i].name, new_entry);
sfree(inp[i].name);
- inp[i].name = strdup(new_entry);
+ inp[i].name = gmx_strdup(new_entry);
}
else
{
notfound = TRUE;
i = (*ninp)++;
srenew(*inp, (*ninp));
- (*inp)[i].name = strdup(name);
+ (*inp)[i].name = gmx_strdup(name);
(*inp)[i].bSet = TRUE;
}
(*inp)[i].count = (*inp)[0].inp_count++;
if (ii == -1)
{
sprintf(buf, "%d", def);
- (*inp)[(*ninp)-1].value = strdup(buf);
+ (*inp)[(*ninp)-1].value = gmx_strdup(buf);
return def;
}
if (ii == -1)
{
sprintf(buf, "%"GMX_PRId64, def);
- (*inp)[(*ninp)-1].value = strdup(buf);
+ (*inp)[(*ninp)-1].value = gmx_strdup(buf);
return def;
}
if (ii == -1)
{
sprintf(buf, "%g", def);
- (*inp)[(*ninp)-1].value = strdup(buf);
+ (*inp)[(*ninp)-1].value = gmx_strdup(buf);
return def;
}
if (def)
{
sprintf(buf, "%s", def);
- (*inp)[(*ninp)-1].value = strdup(buf);
+ (*inp)[(*ninp)-1].value = gmx_strdup(buf);
}
else
{
if (ii == -1)
{
- (*inp)[(*ninp)-1].value = strdup(defs[0]);
+ (*inp)[(*ninp)-1].value = gmx_strdup(defs[0]);
return 0;
}
fprintf(stderr, "%s\n", buf);
}
- (*inp)[ii].value = strdup(defs[0]);
+ (*inp)[ii].value = gmx_strdup(defs[0]);
return 0;
}