#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
#ifdef KR_headers
extern void s_copy ();
integer G77_getcwd_0 (str, Lstr)
char *str; ftnlen Lstr;
#else
extern void s_copy(register char *a, register char *b, ftnlen la, ftnlen lb);
integer G77_getcwd_0 (char *str, const ftnlen Lstr)
#endif
{
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 ();
#ifdef KR_headers
extern VOID s_copy ();
integer G77_getcwd_0 (str, Lstr)
char *str; ftnlen Lstr;
#else
extern void s_copy(register char *a, register char *b, ftnlen la, ftnlen lb);
integer G77_getcwd_0 (char *str, const ftnlen Lstr)
#endif
{
char pathname[MAXPATHLEN];
size_t l;
if (getwd (pathname) == NULL) {
return errno;
} else {
s_copy (str, pathname, Lstr, strlen (str));
return 0;
}
}
#else
#ifdef KR_headers
extern VOID s_copy ();
integer G77_getcwd_0 (str, Lstr)
char *str; ftnlen Lstr;
#else
extern void s_copy(register char *a, register char *b, ftnlen la, ftnlen lb);
integer G77_getcwd_0 (char *str, const ftnlen Lstr)
#endif
{
return errno = ENOSYS;
}
#endif