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