3 * utils.c -- various utility routines
7 * This code is Copyright (c) 2006, by the authors of nmh. See the
8 * COPYRIGHT file in the root directory of the nmh distribution for
9 * complete copyright information.
17 mh_xmalloc(size_t size)
22 adios(NULL, "Tried to malloc 0 bytes");
24 memory = malloc(size);
26 adios(NULL, "Malloc failed");
32 mh_xrealloc(void *ptr, size_t size)
37 adios(NULL, "Tried to realloc 0bytes");
39 memory = realloc(ptr, size);
41 adios(NULL, "Realloc failed");
49 static char curwd[PATH_MAX];
51 if (!getcwd (curwd, PATH_MAX)) {
52 admonish (NULL, "unable to determine working directory");
53 if (!mypath || !*mypath
54 || (strcpy (curwd, mypath), chdir (curwd)) == -1) {
61 if ((cp = curwd + strlen (curwd) - 1) > curwd && *cp == '/')