1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
/* pwd.ccc -- Misosys C program to print the Unix working directory of xtrs */
/* Copyright (c) 1998, Timothy Mann */
/* This software may be copied, modified, and used for any purpose
* without fee, provided that (1) the above copyright notice is
* retained, and (2) modified versions are clearly marked as having
* been modified, with the modifier's name and the date included. */
/* Last modified on Tue Dec 15 16:59:26 PST 1998 by mann */
#option redirect 0
#include "xtrsemt.h"
#include "xtrsemt.ccc" /* could use separate compilation instead */
usage()
{
fprintf(stderr, "usage: pwd\n");
exit(1);
}
#define ERRBUFSIZE 256
#define DIRBUFSIZE 512
int main(argc, argv)
int argc;
char **argv;
{
int i;
char *ret;
char errbuf[ERRBUFSIZE];
char dirbuf[DIRBUFSIZE];
if (argc != 1) {
usage();
}
ret = emt_getcwd(dirbuf, DIRBUFSIZE);
if (ret == NULL) {
emt_strerror(errno, errbuf, ERRBUFSIZE);
fprintf(stderr, "pwd: %s\n", errbuf);
exit(1);
}
printf("%s\n", dirbuf);
exit(0);
}
|