int main() { printpathto( get_inode( "." ) ); /* print path to here */ putchar('\n'); /* then add newline */ return 0; }
void printpathto(ino_t this_inode) { ino_t my_inode; char its_name[BUFSIZ]; if (get_inode("..") != this_inode) { chdir(".."); /* enter parent dir */ inum_to_name(this_inode, its_name); my_inode = get_inode("."); printpathto(my_inode); printf("/%s", its_name); } }
void printpathto (ino_t this_inode) { ino_t my_inode; char its_name[BUFSIZE]; if (get_inode("..") != this_inode) { chdir(".."); inum_to_name(this_inode, its_name, BUFSIZE); my_inode = get_inode("."); printpathto(my_inode); printf("%s", its_name); } }
/* recursively print dir name of this_inode * get parent_inode of this_inode * print name of this_inode * recursively call method of parent_inode */ void printpathto(ino_t this_inode) { ino_t my_inode; char its_name[BUFSIZ]; if (get_inode("..") != this_inode) { chdir(".."); /* dir name of this_inode depends on parent dir file*/ inum_to_name(this_inode, its_name, BUFSIZ); my_inode = get_inode("."); printpathto(my_inode); printf("/%s", its_name); } }
printpathto( ino_t this_inode ) /* * prints path leading down to an object with this inode * kindof recursive */ { int my_inode ; char its_name[BUFSIZ]; chdir( ".." ); /* up one dir */ inum_to_name( this_inode , its_name ); /* get its name */ my_inode = get_inode( "." ); /* print head */ if ( my_inode != get_inode( ".." ) ) /* of pathname */ printpathto( my_inode ); /* recursively */ printf("/%s", its_name ); /* now print */ /* name of this */ }
int main(){ printpathto(get_inode(".")); putchar('\n'); return 0; }
int main() { printpathto(); putchar('\n'); return 0; }
int main(int argc, char *argv[]) { printpathto (get_inode(".")); putchar('\n'); return 0; }