#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <errno.h>
#if HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#include <stdio.h>
#include <errno.h>
#include "f2c.h"
#if HAVE_GETCWD
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#else
extern char *getcwd ();
#endif
extern void s_copy (register char *a, register char *b, ftnlen la, ftnlen lb);
integer
G77_getcwd_0 (char *str, const ftnlen Lstr)
{
int i;
char *ret;
ret = getcwd (str, Lstr);
if (ret == NULL)
return errno;
for (i = strlen (str); i < Lstr; i++)
str[i] = ' ';
return 0;
}
#elif HAVE_GETWD
# include <sys/param.h>
extern char *getwd ();
extern void s_copy (register char *a, register char *b, ftnlen la, ftnlen lb);
integer
G77_getcwd_0 (char *str, const ftnlen Lstr)
{
char pathname[MAXPATHLEN];
size_t l;
if (getwd (pathname) == NULL)
{
return errno;
}
else
{
s_copy (str, pathname, Lstr, strlen (str));
return 0;
}
}
#else
extern void s_copy (register char *a, register char *b, ftnlen la, ftnlen lb);
integer
G77_getcwd_0 (char *str, const ftnlen Lstr)
{
return errno = ENOSYS;
}
#endif