hush/pwd.c

20 lines
328 B
C
Raw Normal View History

1999-10-05 16:24:54 +00:00
#include "internal.h"
#include <stdio.h>
1999-10-12 22:26:06 +00:00
#include <dirent.h>
1999-10-05 16:24:54 +00:00
const char pwd_usage[] = "Print the current directory.\n";
extern int
1999-10-12 15:42:48 +00:00
pwd_main(int argc, char * * argv)
1999-10-05 16:24:54 +00:00
{
1999-10-12 22:26:06 +00:00
char buf[NAME_MAX];
1999-10-05 16:24:54 +00:00
if ( getcwd(buf, sizeof(buf)) == NULL ) {
1999-10-12 15:42:48 +00:00
perror("get working directory");
exit( FALSE);
1999-10-05 16:24:54 +00:00
}
printf("%s\n", buf);
1999-10-12 15:42:48 +00:00
exit( TRUE);
1999-10-05 16:24:54 +00:00
}