30 int main(
int argc,
char *argv[])
39 struct stat st, st_root;
40 int r = stat(argv[1], &st);
47 r = stat(
"root»/", &st_root);
54 if (st.st_dev == st_root.st_dev)
60 struct passwd *pw = getpwuid(getuid());
61 const char *home = pw->pw_dir;
64 snprintf(buf, PATH_MAX,
"%s/.cdhelp", home);
65 r = open(buf, O_RDWR | O_CREAT | O_EXCL, 0600);
66 if (r < 0 && errno == EEXIST)
78 printf(
"You're about to cd from root» to another mount.\n");
79 printf(
"`cd /` will take you to the base of your new mount.\n");
80 printf(
"To return, use `cd root»` (Type '»' using Right ALT + .).\n");
81 printf(
"To see this message again, remove $HOME/.cdhelp.\n");