summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d4dfc22)
SCCS-vsn: bin/pwd/pwd.c 5.6
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)pwd.c 5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)pwd.c 5.6 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <errno.h>
#include <stdio.h>
char *p;
while ((ch = getopt(argc, argv, "")) != EOF)
char *p;
while ((ch = getopt(argc, argv, "")) != EOF)
case '?':
default:
usage();
case '?':
default:
usage();
- p = getcwd(NULL, 0);
- if (p) {
- (void)printf("%s\n", p);
- exit(0);
+ if ((p = getcwd(NULL, 0)) == NULL) {
+ err(1, NULL);
+ exit(1);
- (void)fprintf(stderr, "pwd: %s\n", strerror(errno));
- exit(1);
+ (void)printf("%s\n", p);
+ exit(0);