|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T c
Length: 941 (0x3ad)
Types: TextFile
Names: »cwd.c«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
└─⟦this⟧ »EUUGD11/euug-87hel/sec1/shar/cwd.c«
/*
** Return current working directory. Something for everyone.
*/
/* LINTLIBRARY */
#include "shar.h"
RCS("$Header: cwd.c,v 1.3 87/03/02 11:03:21 rs Exp $")
#ifdef PWDGETENV
/* ARGSUSED */
char *
Cwd(p, i)
char *p;
int i;
{
char *q;
return((q = getenv(PWDGETENV)) ? strcpy(p, q) : NULL);
}
#endif /* PWDGETENV */
#ifdef GETWD
/* ARGSUSED1 */
char *
Cwd(p, size)
char *p;
int size;
{
return(getwd(p) ? p : NULL);
}
#endif /* GETWD */
#ifdef GETCWD
char *
Cwd(p, size)
char *p;
int size;
{
return(getcwd(p, size) ? p : NULL);
}
#endif /* GETCWD */
#ifdef PWDPOPEN
extern FILE *popen();
char *
Cwd(p, size)
char *p;
int size;
{
FILE *F;
int i;
if (F = popen("exec pwd", "r")) {
if (fgets(p, size, F) && p[i = strlen(p) - 1] == '\n') {
p[i] = '\0';
(void)fclose(F);
return(p);
}
(void)fclose(F);
}
return(NULL);
}
#endif /* PWDPOPEN */