Utilities/RB_Change_To_Docdir [ Functions ]
FUNCTION
Saves current working directory and then changes to document dir
SOURCE
void RB_Change_To_Docdir( char *docname ) { char tmp[TEMP_BUF_SIZE], *namestart; int len; // Check if we have a valid directory name in the docname namestart = strrchr( docname, '/' ); if ( namestart == NULL ) RB_Panic( "Unable to get the directory name of '%s'", docname ); // Just for sure RB_Change_Back_To_CWD( ); // Save CWD getcwd( tmp, sizeof( tmp ) ); cwd = RB_StrDup( tmp ); // Get the name of doc directory and change into it len = namestart - docname; strncpy( tmp, docname, len ); tmp[len] = 0; chdir( tmp ); }