commands.cc
static void page_current_file(DirList *dl)
{
    const char *file = get_file_name(dl);
    if (is_directory(file))
    {
        if (strcmp(file, ".") == 0 || (strcmp(file, "..") == 0 &&
                                       strcmp(dl->name(), "/") == 0))
            return;

        if (!read_and_exec_perm(file))
        {
            message("need read & exec permissions to edit `%'", file);
            move_cursor(dl->savedYPos(), dl->savedXPos());
            synch_display();
            return;
        }

        dired(file);
    }
    else if (is_regular_file(file))
    {
        char *pager = getenv("PAGER");
        if (pager == 0) pager = "more";
        String cmd = String(pager) + " " + file;
        clear_display();
        move_to_message_line();
        synch_display();
        exec_with_system(cmd, 0);
        if (the_sort_order() == ACCESS_TIME ||
            the_sort_order() == INODE_CHANGE_TIME)
            //
            // Re-read the listing line for this file
            // and insert into the directory listing.
            // This way, changes in file characteristics are
            // reflected in the soon-to-be updated listing.
            // Since we\'ve only paged the file, the listing should only
            // change, if we\'re interested in the access or inode-
            // modification times.
            //
            reread_listing_line(dl, file); 
        redisplay();
    }
    else
    {
        message("can only page through regular files and directories");
        move_cursor(dl->savedYPos(), dl->savedXPos());
        synch_display();
    }
}
/*
** page_current_file - attempt to page the current file in the DirList.
**                     If we have a directory, we edit it.
*/
attempt to page the current file in the DirList.
If we have a directory, we edit it.
attempt to page the current file in the DirList . If we have a directory we edit it .
static void page_current_file(DirList *dl)
{
    const char *file = get_file_name(dl);
    if (is_directory(file))
    {
        if (strcmp(file, ".") == 0 || (strcmp(file, "..") == 0 &&
                                       strcmp(dl->name(), "/") == 0))
            return;
        if (!read_and_exec_perm(file))
        {
            message("need read & exec permissions to edit `%'", file);
            move_cursor(dl->savedYPos(), dl->savedXPos());
            synch_display();
            return;
        }
        dired(file);
    }
    else if (is_regular_file(file))
    {
        char *pager = getenv("PAGER");
        if (pager == 0) pager = "more";
        String cmd = String(pager) + " " + file;
        clear_display();
        move_to_message_line();
        synch_display();
        exec_with_system(cmd, 0);
        if (the_sort_order() == ACCESS_TIME ||
            the_sort_order() == INODE_CHANGE_TIME)
             Re-read the listing line for this file
             and insert into the directory listing.
             This way, changes in file characteristics are
             reflected in the soon-to-be updated listing.
             Since we\'ve only paged the file, the listing should only
             change, if we\'re interested in the access or inode-
             modification times.
            reread_listing_line(dl, file); 
        redisplay();
    }
    else
    {
        message("can only page through regular files and directories");
        move_cursor(dl->savedYPos(), dl->savedXPos());
        synch_display();
    }
}
static void page_current_file ( DirList * dl ) { const char * file = get_file_name ( dl ) ; if ( is_directory ( file ) ) { if ( strcmp ( file , " " ) == 0 || ( strcmp ( file , " " ) == 0 && strcmp ( dl -> name ( ) , " " ) == 0 ) ) return ; if ( ! read_and_exec_perm ( file ) ) { message ( " " , file ) ; move_cursor ( dl -> savedYPos ( ) , dl -> savedXPos ( ) ) ; synch_display ( ) ; return ; } dired ( file ) ; } else if ( is_regular_file ( file ) ) { char * pager = getenv ( " " ) ; if ( pager == 0 ) pager = " " ; String cmd = String ( pager ) + " " + file ; clear_display ( ) ; move_to_message_line ( ) ; synch_display ( ) ; exec_with_system ( cmd , 0 ) ; if ( the_sort_order ( ) == ACCESS_TIME || the_sort_order ( ) == INODE_CHANGE_TIME ) reread_listing_line ( dl , file ) ; redisplay ( ) ; } else { message ( " " ) ; move_cursor ( dl -> savedYPos ( ) , dl -> savedXPos ( ) ) ; synch_display ( ) ; } }
page_current_file - attempt to page the current file in the DirList.
page_current_file - attempt to page the current file in the DirList .
// // Re-read the listing line for this file // and insert into the directory listing. // This way, changes in file characteristics are // reflected in the soon-to-be updated listing. // Since we\'ve only paged the file, the listing should only // change, if we\'re interested in the access or inode- // modification times. //