diff options
author | 1999-04-29 22:36:41 +0000 | |
---|---|---|
committer | 1999-04-29 22:36:41 +0000 | |
commit | 0a5f61bb653fdff7c29c2275df78c7f019a04c0c (patch) | |
tree | 0b6e610f8913b7c1e30fd7bf5bfc62edcbbd93e5 /gnu/usr.bin/perl/mint/pwd.c | |
parent | Y2K fix: allow 'shutdown yymmddhhmm' to work in the next century. (diff) | |
download | wireguard-openbsd-0a5f61bb653fdff7c29c2275df78c7f019a04c0c.tar.xz wireguard-openbsd-0a5f61bb653fdff7c29c2275df78c7f019a04c0c.zip |
perl5.005_03
Diffstat (limited to 'gnu/usr.bin/perl/mint/pwd.c')
-rw-r--r-- | gnu/usr.bin/perl/mint/pwd.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/mint/pwd.c b/gnu/usr.bin/perl/mint/pwd.c new file mode 100644 index 00000000000..c2711996de9 --- /dev/null +++ b/gnu/usr.bin/perl/mint/pwd.c @@ -0,0 +1,43 @@ +/* pwd.c - replacement for broken pwd command. + * Copyright 1997 Guido Flohr, <gufl0000@stud.uni-sb.de>. + * Do with it as you please. + */ +#include <stdio.h> +#include <limits.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#if defined(__STDC__) || defined(__cplusplus) +int main (int argc, char* argv[]) +#else +int main (argc, argv) + int argc; + char* argv[]; +#endif +{ + char path_buf[PATH_MAX + 1]; + + if (argc > 1) { + int i; + + fflush (stdout); + fputs (argv[0], stderr); + fputs (": ignoring garbage arguments\n", stderr); + } + + if (!getcwd (path_buf, PATH_MAX + 1)) { + fflush (stdout); + /* Save space, memory and the whales, avoid fprintf. */ + fputs (argv[0], stderr); + fputs (": can\'t get current working directory: ", stderr); + fputs (strerror (errno), stderr); + fputc ('\n', stderr); + return 1; + } + if (puts (path_buf) < 0) { + return 1; + } + return 0; +} +/* End of pwd.c. */ |