/* cdir.c program to emulate unix cd command */ /* cc -o cdir cdir.c */ #include<stdio.h> /* #include<sys/dir.h> */ main(int argc,char **argv) { if (argc < 2) { printf("Usage: %s <pathname>\n",argv[0]); exit(1); } if (chdir(argv[1]) != 0) { printf("Error in \"chdir\"\n"); exit(1); } }