This file is indexed.

/usr/share/doc/xviewg/examples/seln_svc/seln_line.c is in xview-examples 3.2p1.4-28.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
/*
 * seln_line.c -- demonstrate how to use the selection service to get
 * the line number of the primary selection in a textsw.
 */
#include <stdio.h>
#include <xview/xview.h>
#include <xview/textsw.h>
#include <xview/panel.h>
#include <xview/seln.h>

Textsw  textsw;

main(argc, argv)
char *argv[];
{
    Frame       frame;
    Panel       panel;
    void        exit();
    int         seln_proc();

    xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);

    frame = (Frame)xv_create(NULL, FRAME,
        FRAME_SHOW_FOOTER,      TRUE,
        NULL);

    panel = (Panel)xv_create(frame, PANEL,
        WIN_WIDTH,              WIN_EXTEND_TO_EDGE,
        NULL);

    (void) xv_create(panel, PANEL_BUTTON,
        PANEL_LABEL_STRING,     "Quit",
        PANEL_NOTIFY_PROC,      exit,
        NULL);
    (void) xv_create(panel, PANEL_BUTTON,
        PANEL_LABEL_STRING,     "Get Selection",
        PANEL_NOTIFY_PROC,      seln_proc,
        PANEL_CLIENT_DATA,      frame,
        NULL);
    (void) xv_create(panel, PANEL_TEXT,
        PANEL_LABEL_STRING,             "No-op:",
        PANEL_VALUE_DISPLAY_LENGTH,     30,
        NULL);

    window_fit(panel);

    textsw = (Textsw)xv_create(frame, TEXTSW,
        WIN_X,                  0,
        WIN_BELOW,              panel,
        WIN_ROWS,               10,
        WIN_COLUMNS,            80,
        TEXTSW_FILE_CONTENTS,   "/etc/passwd",
        NULL);
    window_fit(frame);
    xv_main_loop(frame);
}

int
seln_proc(item, event)
Panel_item item;
Event *event; /* unused */
{
    Frame         frame = (Frame)xv_get(item, PANEL_CLIENT_DATA);
    Seln_holder   holder;
    Seln_request *buffer;
    int           line_number;
    char         msg[32];

    /* 
     * get primary selection 
     */
    holder = seln_inquire(SELN_PRIMARY);
    /* 
     * ask for the data containing line number of the first
     * character of the selection
     */
    buffer = seln_ask(&holder,
        SELN_REQ_FAKE_LEVEL, SELN_LEVEL_LINE,
        SELN_REQ_FIRST_UNIT, 0,
        NULL);
    /*
     * determine the window that contains the selection
     */
    if (seln_holder_same_client(&holder, (char *)textsw)) {
        xv_set(frame,
            FRAME_LEFT_FOOTER, "selection in textsw",
            NULL);
        /* 
         * convert data into the line number 
         */
        sprintf(msg, "Selection: line %ld",
            *(long *)(buffer->data + 3 * sizeof(Seln_attribute)));
        xv_set(frame,
            FRAME_RIGHT_FOOTER, msg,
            NULL);
    } else
        xv_set(frame,
            FRAME_LEFT_FOOTER, "selection elsewhere",
            NULL);

    return XV_OK;
}