src/stand/ficl/loader.c
/*      isdir? - Return whether an fd corresponds to a directory.
 *
 * isdir? ( fd -- bool )
 */
isdir. - Return whether an fd corresponds to a directory.
isdir.
isdir . - Return whether an fd corresponds to a directory . isdir .
static void isdirQuestion(FICL_VM *pVM)
{
    struct stat sb;
    FICL_INT flag;
    int fd;
#if FICL_ROBUST > 1
    vmCheckStack(pVM, 1, 1);
#endif
    fd = stackPopINT(pVM->pStack);
    flag = FICL_FALSE;
    do {
        if (fd < 0)
            break;
        if (fstat(fd, &sb) < 0)
            break;
        if (!S_ISDIR(sb.st_mode))
            break;
        flag = FICL_TRUE;
    } while (0);
    stackPushINT(pVM->pStack, flag);
}
static void isdirQuestion ( FICL_VM * pVM ) { struct stat sb ; FICL_INT flag ; int fd ; #if FICL_ROBUST > 1 vmCheckStack ( pVM , 1 , 1 ) ; #endif fd = stackPopINT ( pVM -> pStack ) ; flag = FICL_FALSE ; do { if ( fd < 0 ) break ; if ( fstat ( fd , & sb ) < 0 ) break ; if ( ! S_ISDIR ( sb . st_mode ) ) break ; flag = FICL_TRUE ; } while ( 0 ) ; stackPushINT ( pVM -> pStack , flag ) ; }
isdir?
isdir?