Beispiel #1
0
/*
 * FileSPVAR - build file special variables
 */
void FileSPVAR( void )
{
    char        path[FILENAME_MAX];
    char        drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
    int         i;

    /*
     * build path
     */
    if( CurrentFile == NULL ) {
        VarAddGlobalStr( "F", "" );
        VarAddGlobalStr( "H", "" );
        drive[0] = dir[0] = fname[0] = ext[0] = 0;
    } else {
        VarAddGlobalStr( "F", CurrentFile->name );
        VarAddGlobalStr( "H", CurrentFile->home );
        ConditionalChangeDirectory( CurrentFile->home );
        _splitpath( CurrentFile->name, drive, dir, fname, ext );
    }
    VarAddGlobalStr( "P1", dir );
    VarAddGlobalStr( "D1", drive );
    strcpy( path, drive );
    strcat( path, dir );
    i = strlen( path ) - 1;
    if( path[i] == FILE_SEP && i > 0 ) {
        path[i] = 0;
    }
    if( CurrentFile != NULL ) {
        PushDirectory( path );
        ChangeDirectory( path );
        GetCWD2( path, FILENAME_MAX );
        PopDirectory();
    } else {
        path[0] = 0;
    }
    if( path[strlen(path) - 1] == FILE_SEP ) {
        StrMerge( 2, path, fname, ext );
    } else {
        StrMerge( 3, path,FILE_SEP_STR, fname, ext );
    }
    _splitpath( path, drive, dir, fname, ext );
    VarAddGlobalStr( "D", drive );
    VarAddGlobalStr( "P", dir );
    VarAddGlobalStr( "N", fname );
    VarAddGlobalStr( "E", ext );

} /* FileSPVAR */
Beispiel #2
0
/*
 * popd command
 */
INT CommandPopd (LPTSTR rest)
{
	INT ret = 0;
	if (!_tcsncmp(rest, _T("/?"), 2))
	{
		ConOutResPuts(STRING_DIRSTACK_HELP2);
		return 0;
	}

	if (nStackDepth == 0)
		return 1;

	ret = _tchdir(lpStackTop->szPath) != 0;
	PopDirectory ();

	return ret;
}
Beispiel #3
0
/*
 * destroy directory stack
 */
VOID DestroyDirectoryStack (VOID)
{
	while (nStackDepth)
		PopDirectory ();
}