Commit | Line | Data |
---|---|---|
bcf1365c DF |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
5 | */ | |
6 | ||
7 | #ifndef lint | |
8 | char copyright[] = | |
9 | "@(#) Copyright (c) 1980 Regents of the University of California.\n\ | |
10 | All rights reserved.\n"; | |
11 | #endif not lint | |
12 | ||
13 | #ifndef lint | |
14 | static char sccsid[] = "@(#)pwd.c 5.1 (Berkeley) %G%"; | |
15 | #endif not lint | |
16 | ||
1b66014a BJ |
17 | /* |
18 | * Print working (current) directory | |
19 | */ | |
7a02fcc7 SL |
20 | #include <stdio.h> |
21 | #include <sys/param.h> | |
1b66014a | 22 | |
7a02fcc7 | 23 | char *getwd(); |
1b66014a BJ |
24 | |
25 | main() | |
26 | { | |
7a02fcc7 | 27 | char pathname[MAXPATHLEN + 1]; |
1b66014a | 28 | |
7a02fcc7 SL |
29 | if (getwd(pathname) == NULL) { |
30 | fprintf(stderr, "pwd: %s\n", pathname); | |
31 | exit(1); | |
1b66014a | 32 | } |
7a02fcc7 | 33 | printf("%s\n", pathname); |
1b66014a BJ |
34 | exit(0); |
35 | } |