diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-01-13 16:50:17 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-01-13 16:50:17 +0000 |
commit | 61ae2fbf8676dafa05a9a9a710fde421f30a2071 (patch) | |
tree | 4f497a4eee07a49f48be8badf49ad54f068f11f8 /mint/pwd.c | |
parent | b8f0c030659550e4d527ee8f11cd2f012f1bd1b0 (diff) | |
download | perl-61ae2fbf8676dafa05a9a9a710fde421f30a2071.tar.gz |
Atari MiNT port by Guido Flohr <gufl0000@stud.uni-sb.de>
(the diffs were based on 5.004_02). Tested by Guido
and Frank Naumann <fnaumann@prinz-atm.CS.Uni-Magdeburg.De>.
p4raw-id: //depot/cfgperl@2594
Diffstat (limited to 'mint/pwd.c')
-rw-r--r-- | mint/pwd.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/mint/pwd.c b/mint/pwd.c new file mode 100644 index 0000000000..c2711996de --- /dev/null +++ b/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. */ |