more bugs fixed -- found doing regression testing
[oweals/busybox.git] / coreutils / pwd.c
index c5ce6ff891bca5c65717d47e9e1365079154982c..da089f37c89de894bc126159b8ead12d37c64cde 100644 (file)
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
 /*
  * Mini pwd implementation for busybox
  *
  *
  */
 
-#include "internal.h"
+#include "busybox.h"
 #include <stdio.h>
 #include <dirent.h>
+#include <errno.h>
 
-extern int
-pwd_main(int argc, char * * argv)
+extern int pwd_main(int argc, char **argv)
 {
-       char            buf[NAME_MAX];
+       char buf[BUFSIZ + 1];
 
-       if ( getcwd(buf, sizeof(buf)) == NULL ) {
-               perror("get working directory");
-               exit( FALSE);
-       }
+       if (getcwd(buf, sizeof(buf)) == NULL)
+               perror_msg_and_die("getcwd");
 
-       printf("%s\n", buf);
-       exit( TRUE);
+       puts(buf);
+       return EXIT_SUCCESS;
 }