glut/lib/mui/browser.c
/* get the current working directory (the following 3 routines are from pwd.c) */
get the current working directory (the following 3 routines are from pwd.c)
get the current working directory ( the following 3 routines are from pwd . c )
void pwd(void)
{
	for(off = 0;;) {
		if(stat(dot, &d) < 0) {
			fprintf(stderr, "pwd: cannot stat .!\n");
			exit(2);
		}
		if ((file = opendir(dotdot)) == NULL) {
			fprintf(stderr,"pwd: cannot open ..\n");
			exit(2);
		}
		if(fstat(file->dd_fd, &dd) < 0) {
			fprintf(stderr, "pwd: cannot stat ..!\n");
			exit(2);
		}
		if(chdir(dotdot) < 0) {
			fprintf(stderr, "pwd: cannot chdir to ..\n");
			exit(2);
		}
		if(d.st_dev == dd.st_dev) {
			if(d.st_ino == dd.st_ino) {
				prname();
				chdir(directory);
				return;
			}
			do
				if ((dir = readdir(file)) == NULL) {
					fprintf(stderr, "pwd: read error in ..\n");
					exit(2);
				}
			while (dir->d_ino != d.st_ino);
		}
		else do {
				if((dir = readdir(file)) == NULL) {
					fprintf(stderr, "pwd: read error in ..\n");
					exit(2);
				}
				stat(dir->d_name, &dd);
		} while(dd.st_ino != d.st_ino || dd.st_dev != d.st_dev);
		(void)closedir(file);
		if (cat()) {
			chdir(directory);
			return;
		}
	}
}
void pwd ( void ) { for ( off = 0 ; ; ) { if ( stat ( dot , & d ) < 0 ) { fprintf ( stderr , " \n " ) ; exit ( 2 ) ; } if ( ( file = opendir ( dotdot ) ) == NULL ) { fprintf ( stderr , " \n " ) ; exit ( 2 ) ; } if ( fstat ( file -> dd_fd , & dd ) < 0 ) { fprintf ( stderr , " \n " ) ; exit ( 2 ) ; } if ( chdir ( dotdot ) < 0 ) { fprintf ( stderr , " \n " ) ; exit ( 2 ) ; } if ( d . st_dev == dd . st_dev ) { if ( d . st_ino == dd . st_ino ) { prname ( ) ; chdir ( directory ) ; return ; } do if ( ( dir = readdir ( file ) ) == NULL ) { fprintf ( stderr , " \n " ) ; exit ( 2 ) ; } while ( dir -> d_ino != d . st_ino ) ; } else do { if ( ( dir = readdir ( file ) ) == NULL ) { fprintf ( stderr , " \n " ) ; exit ( 2 ) ; } stat ( dir -> d_name , & dd ) ; } while ( dd . st_ino != d . st_ino || dd . st_dev != d . st_dev ) ; ( void ) closedir ( file ) ; if ( cat ( ) ) { chdir ( directory ) ; return ; } } }
get the current working directory (the following 3 routines are from pwd.c)
get the current working directory ( the following 3 routines are from pwd . c )