From:	AITGW::"FILESERV@WKUVX1.BITNET" 16-MAR-1992 09:40:42.66
To:	ARISIA::EVERHART
CC:	
Subj:	LOOK.04_OF_04

Received: by AITGW.DECnet (utk-mail11 v1.5) ; Mon, 16 Mar 92 09:39:58 EST
Received: from ukcc.uky.edu by aitgw.ge.com (5.65/GE Gateway 1.5)
	id AA01782; Mon, 16 Mar 92 09:39:44 -0500
Message-Id: <9203161439.AA01782@aitgw.ge.com>
Received: from ukcc.uky.edu by UKCC.uky.edu (IBM VM SMTP V2R2)
   with BSMTP id 6607; Mon, 16 Mar 92 09:36:18 EST
Received: from UKCC by ukcc.uky.edu (Mailer R2.08) with BSMTP id 4519; Mon, 16
 Mar 92 09:36:17 EST
Received: from WKUVX1.BITNET by ukcc.uky.edu (Mailer R2.08) with BSMTP id 4518;
 Mon, 16 Mar 92 09:36:16 EST
Received: by WKUVX1.BITNET (MX V3.0A) id 16031; Mon, 16 Mar 1992 08:32:43 CST
Date: Mon, 16 Mar 1992 08:32:43 CST
From: FILESERV-Mgr@WKUVX1.BITNET
Reply-To: FILESERV@WKUVX1.BITNET
Subject: LOOK.04_OF_04
To: ARISIA::EVERHART
 
-+-+-+-+-+-+-+-+ START OF PART 4 -+-+-+-+-+-+-+-+
X`09    CHECKRESULT(smg$erase_pasteboard(&p_id));
X`09    CHECKRESULT(smg$paste_virtual_display(&k_bar.id, &p_id,
X`09`09&k_bar.firstrow, &k_bar.firstcol));
X`09    CHECKRESULT(new_page());
X`09    CHECKRESULT(smg$paste_virtual_display(&vdisp.id, &p_id,
X`09`09&vdisp.firstrow, &vdisp.firstcol));
X`09    return SS$_NORMAL;
X`09case 'T':
X`09case 't':
X`09case '/':
X`09    vf_inf.bintxt = (vf_inf.bintxt == SS$_NORMAL)
X`09`09? $_ABNORMAL : SS$_NORMAL;
X`09case REREAD:
X`09    return RELOOK;
X`09case EXIT:
X`09case BREAK:
X`09case 'X':
X`09case 'x':
X`09    return EXIT_NORMAL;
X`09case 'Q':
X`09case 'q':
X`09    return 0;
X`09`7D
X    return SS$_NORMAL;
X`7D
X
X`09/* First acquaintance */
X
Xint
Xget_acquaintance(unsigned short *key)
X`7B
X    int key_reply = SS$_NORMAL;
X    int`09mem_all = vdisp.wid + 5;
X
X    memset(line, '\0', (size_t)MAXLINE);
X    memset(no_line, '\0', (size_t)MAXLINE);
X    rpt`09    = 0;
X    *key    = 0;
X    wn`09    = 0;
X
X    vf_inf.home`09    = (int *)malloc((size_t)(mem_all * sizeof(int)));
X    vf_inf.current  = vf_inf.end = vf_inf.all = 0;
X
X    while(vf_inf.all < vdisp.wid)
X    `7B
X`09vf_inf.home`5Bvf_inf.all`5D = sh_tell();
X`09vf_inf.all++;
X`09if (sh_fgets(line, MAXLINE, SS$_NORMAL) == -1) break;
X        CHECKRESULT(smg$put_line(&vdisp.id, outline(line)));
X    `7D
X    CHECKRESULT(smg$paste_virtual_display(&vdisp.id, &p_id,
X`09&vdisp.firstrow, &vdisp.firstcol));
X    CHECKRESULT(smg$paste_virtual_display(&k_bar.id, &p_id,
X`09&k_bar.firstrow, &k_bar.firstcol));
X    if (vf_inf.all < vdisp.wid) return SS$_NORMAL;
X
X    CHECKRESULT(headline());
X    vf_inf.end = $_ABNORMAL;
X
X    do
X    `7B
X`09if (vf_inf.all >= mem_all)
X`09`7B
X`09    mem_all *= 2;
X`09    vf_inf.home = (int *)realloc(vf_inf.home,
X`09        (size_t)(mem_all * sizeof(int)));
X`09`7D
X`09vf_inf.home`5Bvf_inf.all`5D = sh_tell();
X
X`09    if (rpt != 0)
X`09    `7B
X`09`09if (rpt == $_ABNORMAL) key_reply = working();
X`09`09if (vf_inf.all % READKEY_STEP == 0)
X`09`09`7B
X`09`09    if (key_reply == SS$_NORMAL)
X`09`09`09key_reply = key_processing(*key);
X`09`09    else if (key_reply == 0) key_reply = SS$_NORMAL;
X`09`09    if (key_reply != SS$_NORMAL) return key_reply;
X`09`09    sh_seek(vf_inf.home`5Bvf_inf.all`5D);
X`09`09`7D
X`09`09if (rpt == 0) CHECKRESULT(headline());
X`09    `7D
X`09    else if ((vf_inf.all % READKEY_STEP == 0) &&
X`09`09(smg$read_keystroke(&k_id, key, NULL, &timeout) == SS$_NORMAL))
X`09    `7B
X`09`09wn = 0;
X`09`09key_reply = key_processing(*key);
X`09`09if (key_reply != SS$_NORMAL) return key_reply;
X`09`09sh_seek(vf_inf.home`5Bvf_inf.all`5D);
X`09`09if (rpt == 0) CHECKRESULT(headline());
X`09    `7D
X
X`09vf_inf.all++;
X    `7D
X    while(sh_fgets(line, MAXLINE, $_ABNORMAL) != -1);
X
X    vf_inf.end = vf_inf.all - vdisp.wid - 1;
X    return (rpt != 0) ? key_processing(*key) : SS$_NORMAL;
X`7D
X
X`09/* Main view routine */
X
Xint
Xview_manager(char file_name_to_view`5B`5D)
X`7B
X    unsigned short svch = 0;
X    int num = 0;
X
X    if (file_name_to_view`5B0`5D == '?')
X    `7B
X`09putchar('\n');
X`09memset(line, 'A', (size_t)MAXLINE);
X`09line`5BMAXLINE`5D = '\0';
X`09if (lib$sys_trnlog(&hlnm, &lnmlen, outline(line))
X`09    != SS$_NORMAL) strcpy(line, HELPCOMMAND);
X`09lib$do_command(outline(line));
X`09exit(SS$_NORMAL);
X    `7D
X
X    vdisp.f_spec = sh_fname(file_name_to_view);
X    if (vdisp.f_spec == NULL)
X        printf("\n%%LOOK-F-FFERR, Failed to find file %s.\n", file_name_to_v
View);
X    else
X    do
X`09if (sh_open(vdisp.f_spec) != -1)
X`09`7B
X`09    num = (init_screen() == SS$_NORMAL)
X`09`09? get_acquaintance(&svch) : $_ABNORMAL;
X
X`09    while (num == SS$_NORMAL)
X`09`09if (headline() == SS$_NORMAL)
X`09`09`7B
X`09`09    if (smg$read_keystroke(&k_id, &svch) == SS$_NORMAL)
X`09`09`09num = key_processing(svch);
X`09`09`7D
X`09`09else num = $_ABNORMAL;
X
X`09    if (num != $_ABNORMAL)
X`09`09switch(free_screen())
X`09`09`7B
X`09`09case $_ABNORMAL:    num = $_ABNORMAL;`09break;
X`09`09case NO_CLOSE:`09    num = NO_CLOSE;`09break;
X`09`09`7D
X
X`09    switch(num)
X`09    `7B
X`09    case $_ABNORMAL:
X`09`09printf("\n%%LOOK-F-LKERR, Failed to use screen.");
X`09    case 0:
X`09`09exit(SS$_NORMAL);
X`09    case RELOOK:
X`09`09break;
X`09    case NO_CLOSE:
X`09`09printf("\n%%LOOK-F-FCERR, Failed to close file %s.\n",
X`09`09    vdisp.f_spec);
X`09    default:
X`09`09vdisp.f_spec = sh_fname(NULL);
X`09`09vf_inf.bintxt = 0;
X`09    `7D
X`09`7D
X`09else
X`09`7B
X`09    printf("\n%%LOOK-F-FOERR, Failed to open file %s.\n", vdisp.f_spec);
X`09    vdisp.f_spec = sh_fname(NULL);
X`09`7D
X    while(vdisp.f_spec != NULL);
X`7D
X
X`09/* Now, real MAIN */
X
Xmain(int arguments, char *parameter`5B`5D)
X`7B
X    unsigned char buzz`5B`5D =
X    `7B
X        '\50',
X        '\224',
X        '\102',
X        '\235',
X        '\123',
X        '\225',
X        '\123',
X        '\236',
X        '\101',
X        '\334',
X        '\132',
X        '\205',
X        '\51',
X        '\263',
X        '\76',
X        '\246',
X        '\74',
X        '\343',
X        '\127',
X        '\307',
X        '\116',
X        '\320',
X        '\103',
X        '\305',
X        '\125',
X        '\334',
X        '\17',
X        '\320',
X        '\146',
X        '\327',
X        '\170',
X        '\253',
X        '\164',
X        '\305',
X        '\125',
X        '\334',
X        '\114',
X        '\300',
X        '\126',
X        '\313',
X        '\135',
X        '\320',
X        '\134',
X        '\310',
X        '\31',
X        '\0'
X    `7D;
X    char a_file_name`5BFNAMLEN`5D = "";
X    int i = 0;
X    char *b_file_name = "Fast file viewer V5.27.";
X
X    for (i = strlen(buzz) - 1; i > 0; i--) buzz`5Bi`5D = (`7Ebuzz`5Bi`5D) `5
VE buzz`5Bi-1`5D;
X    if (arguments > 1)
X    `7B
X`09printf("%s%s", b_file_name, buzz);
X`09for (i = 1; i < arguments; i++) view_manager(parameter`5Bi`5D);
X    `7D
X    else
X    `7B
X`09do
X`09`7B
X`09    printf("_File(s) : ");
X`09    gets(a_file_name);
X`09    putchar('\n');
X`09`7D while(a_file_name`5B0`5D == '\0');
X
X`09printf("%s%s", b_file_name, buzz);
X`09for (b_file_name = strtok(a_file_name, " "); b_file_name != NULL;
X`09    b_file_name = strtok(NULL, " ")) view_manager(b_file_name);
X    `7D
X`7D
$ CALL UNPACK [.LOOK]LOOK.C;1 424146396
$ create 'f'
X`09`09`09LOOK software forever!
X`09`09`09----------------------
X
XI.     This LOOK software is a free software product.
X
XII.    Restrictions:
X`091. VAX/VMS v 5.X (and higher);
X`092. VAXC compiler v 3.0 (at least I used this version myself);
X
XIII.   Some installation notes.
X`09LOOK software uses the following environment:
X`09    1. Symbolic name "look" to invoke LOOK software.
X`09`09Example: $ look :== $disk$a9:`5Bkovalyov`5Dlook
X
X`09    2. Logical name "LOOK$HELP" - full command to invoke HELP
X`09`09as looking of help text file.
X`09`09Example: $ define LOOK$HELP "look view$view_hlp.view$hlp"
X
X`09    3. Logical name "LOOK$EDIT" - command format to invoke
X`09`09text editor you prefer. Syntax of this format:
X`09`09"Editor_name %s`5B keyword_to_define_start_row %u`5D",
X`09`09(really usual C format specification).
X`09`09Examples: $ define LOOK$EDIT "ed/tpu %s"
X`09`09or:
X`09`09          $ define LOOK$EDIT "lse %s /start_position=(%u,1)"
X`09`09(I recommend you the last one if you have LSEDIT software).
X
X`09All this environment is defined by command file BUILDLOOK.COM
X`09(assuming that executable and help text are located in the
X        default directory; default text editor - ED/TPU with no
X`09start positioning).
X
XIV.`09`09`09I need your opinion about this program.
X`09`09`09Please address it to Serge Kovalyov,
X`09`09`09630090, Budker Institute of Nuclear Physics,
X`09`09`0911 Lavrentyeva,
X`09`09`09Novisibirsk, Russia.
X`09`09`09E-mail: Kovalyov@vxinp.inp.nsk.su
X`09`09`09Phone: (3832)35-91-47
X`09`09`09Fax:   (3832)35-21-63
$ CALL UNPACK [.LOOK]README.1ST;1 557914200
$ create 'f'
X`09`09*** HELP FOR FAST FILE VIEWER ***
X
X  *** Now you are using the viewer to read the HELP for the viewer itself **
V*
X
X   You invoke the viewer entering the command:
X
X`09LOOK`5B file_name`5D`5B file_name...`5D
X
XIf you omit file_name,  the viewer will ask you for it.  Using '?'  instead
V of
Xfile_name leads you to read this HELP. Wildcard in file_name is allowed.
X
X   In  the lower row  of the screen  you  see  the keybar  enumerating  usab
Vle
Xalphabetic hot keys (both uppercase & lowercase are active).  Besides, you c
Van
Xuse the four cursor keys, <PREVSCREEN>, <NEXTSCREEN> & <FIND> (equals to 'F'
V).
X   Usage of cursor keys is standard.  But if you try to push the cursor out
V of
Xthe visible space, it will lead either to it's change (e. g., previous or ne
Vxt
Xline will appear  or the text will scroll right or left)  or  to bell  warni
Vng
Xthat you are  on the limits of the file  (e. g., on the beginning or the end
V).
X   Using  <PREVSCREEN>/<NEXTSCREEN> keys  you can scroll the text by the who
Vle
Xpages.
X
X   Now you just used some of these keys to read the continuation.  Here is t
Vhe
Xlist of the hot keys:
X   'P':`09(the same as <HELP>(F15) key) invokes this HELP file to the viewer
V.
X   'X': (the same as <EXIT>(F10) key) exits from the view of current file.
X   'Q': quits from the viewer at all.
X   'H':`09leads to view  of the beginning of the file;  places the cursor to
V the
X`09very beginning.
X   'E': leads  to  view  of  the end  of  the file;  places  the cursor to t
Vhe`20
X`09beginning of the last line of the file.
X   'R': the first hit of this key places the cursor  to the right bound of t
Vhe
X`09screen (if it wasn't there before); next hits scroll the text by pages
X`09in right direction (until possible).
X   'L': the first hit of this key  places the cursor  to the left bound of t
Vhe
X`09screen (if it wasn't there before); next hits scroll the text by pages
X`09in left direction (until possible).
X   'F': (the  same  as  <FIND> key)  invites you  from the lower bound  of t
Vhe
X        viewer field  to input  the template  to seek for  in file;  search
V is
X        case-insensitive & forward;  input templates  (up to 20)  are buffer
Ved
X        (like commands in DCL);  found template is marked  by bold character
Vs;
X        if nothing was found,  then the diagnostic appears and you are invit
Ved
X        to press any key to continue.
X   'N': tries  to seek for  next location  of the template  given by  the la
Vst
X`09invoking of Find; search properties are the same as above.
X   'D': executes a text editor for given file.
X   'G': asks for  the number of line to go to  and after  line number enteri
Vng
X        goes  to view of the context of line  with this number.  You can ent
Ver
X        number with percent sign (e. g., 32%),  which will lead viewer to vi
Vew
X        the  context  of  line  correspondent  to  given  percentage  of  fi
Vle
X        containing.  Note  that entered numbers  are buffered  up to 20 - ju
Vst
X        like search templates.
X   'S': creates and executes the standard subprocess.
X   'W': changes  the screen width  from 80  to 132 positions  and  vice vers
Va;
X`09don't use it if your terminal doesn't support 132-position width.
X   'T': (the same as '/') changes the mode of file  representation:  text fo
Vrm
X        or hexadecimal dump.
X
X   Then, the standard REFRESH key <CTRL/W> is supported.
X   The REREAD key <CTRL/R> leads simply to reread the file from the beginnin
Vg.
X
X   In the upper row  of the screen  you see  the headline  showing  file nam
Ve,`20
Xcursor location (row & column) & the approximate part of file currently havi
Vng
Xread (in percents).  When the viewer is working on something (e. g., finding
V a
Xtemplate),  the headline disappears & the working diagnosis  (with approxima
Vte
Xfile fraction  just processed)  appears in the last line  of the viewer fiel
Vd.
XWhile viewer hard works on something you can press 'X' or 'x' (as if for exi
Vt)
X& working will be simply stopped.
X
X   Note that the viewer is filetype-sensitive;  i. e.,  when you try to view
V a
Xbinary (non-text) file, the viewer will show it as a hexadecimal dump.
X
X   If a wildcard presented  in a file_name,  an  "EXIT"  command ('X',  'x'
V or
X<EXIT>(F10) key) leads you to view next file whose name satisfies the wildca
Vrd
Xtemplate.  If no one found, viewer quits.  Analogically, if you specify a li
Vst
Xof files in command line, after "EXIT" you will view next file in the list.
V To
Xstop viewer execution at any moment, use QUIT (hotkey 'Q').
X
X`09`09`09I need your opinion about this program.
X`09`09`09Please address it to Serge Kovalyov,
X`09`09`09630090, Budker Institute of Nuclear Physics,
X`09`09`0911 Lavrentyeva,
X`09`09`09Novisibirsk, Russia.
X`09`09`09E-mail: Kovalyov@vxinp.inp.nsk.su
X`09`09`09Phone: (3832)35-91-47
X`09`09`09Fax:   (3832)35-21-63
X
X     *** Press 'X', 'x' or <EXIT>(F10) and return to view of your file ***
$ CALL UNPACK [.LOOK]VIEW$VIEW_HLP.VIEW$HLP;1 2133692742
$ v=f$verify(v)
$ EXIT
