home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1152 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  39.3 KB

  1. From: pjc@pcbox.UUCP (Paul J. Condie)
  2. Newsgroups: alt.sources
  3. Subject: menu(1)  part 10 of 11
  4. Message-ID: <432@pcbox.UUCP>
  5. Date: 6 Apr 90 17:57:32 GMT
  6.  
  7.  
  8. #!/bin/sh
  9. # this is part 10 of a multipart archive
  10. # do not concatenate these parts, unpack them in order with /bin/sh
  11. # file utilities.d/libgeti.d/popmenu.c continued
  12. #
  13. CurArch=10
  14. if test ! -r s2_seq_.tmp
  15. then echo "Please unpack part 1 first!"
  16.      exit 1; fi
  17. ( read Scheck
  18.   if test "$Scheck" != $CurArch
  19.   then echo "Please unpack part $Scheck next!"
  20.        exit 1;
  21.   else exit 0; fi
  22. ) < s2_seq_.tmp || exit 1
  23. echo "x - Continuing file utilities.d/libgeti.d/popmenu.c"
  24. sed 's/^X//' << 'SHAR_EOF' >> utilities.d/libgeti.d/popmenu.c
  25. X        switch ( ch )
  26. X        {
  27. X           case KEY_DOWN:
  28. X           case KEY_RIGHT:
  29. X            fptr = (fptr >= menu->NumItems+1) ? 1 : ++fptr;
  30. X
  31. X            /* stroll off window? */
  32. X            if ( fptr-top+1 > menu->winSize || fptr == 1 )
  33. X            {
  34. X                if ( fptr == 1 )
  35. X                    top = 1 ;
  36. X                else
  37. X                    top += inc ;
  38. X                _showWin( menu, top ) ;
  39. X            }
  40. X            break;
  41. X
  42. X           case KEY_UP:
  43. X           case KEY_LEFT:
  44. X            wrefresh( menu->win ) ;
  45. X            fptr = (fptr <= 1) ? menu->NumItems+1 : --fptr;
  46. X
  47. X            /* stroll off window? */
  48. X            if ( fptr == menu->NumItems+1 || fptr < top )
  49. X            {
  50. X                if ( fptr == menu->NumItems+1 && inc > 0 )
  51. X                    top = menu->NumItems - menu->winSize + 2 ;
  52. X                else
  53. X                    top -= inc ;
  54. X                if ( top < 1 ) top = 1 ;
  55. X                _showWin( menu, top ) ;
  56. X            }
  57. X            break;
  58. X
  59. X           case '0':
  60. X           case '1':
  61. X           case '2':
  62. X           case '3':
  63. X           case '4':
  64. X           case '5':
  65. X           case '6':
  66. X           case '7':
  67. X           case '8':
  68. X           case '9':
  69. X           case 'A':
  70. X           case 'B':
  71. X           case 'C':
  72. X           case 'D':
  73. X           case 'E':
  74. X           case 'F':
  75. X           case 'G':
  76. X           case 'H':
  77. X           case 'I':
  78. X           case 'J':
  79. X           case 'K':
  80. X           case 'L':
  81. X           case 'M':
  82. X           case 'N':
  83. X           case 'O':
  84. X           case 'P':
  85. X           case 'Q':
  86. X           case 'R':
  87. X           case 'S':
  88. X           case 'T':
  89. X           case 'U':
  90. X           case 'V':
  91. X           case 'W':
  92. X           case 'X':
  93. X           case 'Y':
  94. X           case 'Z':
  95. X            wrefresh( menu->win ) ;
  96. X            /* look for first char match from here on down */
  97. X            for ( i=fptr+1; i<=menu->NumItems+1 &&
  98. X                toupper(*menu->items[i-1])!=ch; i++ ) ; 
  99. X
  100. X            /* no match?  how about from here on up? */
  101. X            if ( i > menu->NumItems+1 )
  102. X                for ( i=1; i<fptr &&
  103. X                    toupper(*menu->items[i-1])!=ch; i++ ) ;
  104. X
  105. X            fptr = i ;    /* i would still be fptr if both failed */
  106. X
  107. X            /* need to display a different window? */
  108. X            if ( fptr >= top+menu->winSize || fptr < top )
  109. X            {
  110. X                top = fptr ;
  111. X                _showWin( menu, top ) ;
  112. X            }
  113. X            break ;
  114. X
  115. X           case KEY_RETURN:
  116. X           case KEY_ENTER:
  117. X            menu->ActiveItem = fptr;
  118. X            wrefresh (menu->win);    /* force flush of attributes */
  119. X            putp ( cursor_visible ) ;
  120. X            return (menu->ActiveItem);
  121. X
  122. X           case KEY_CANCEL:
  123. X            putp ( cursor_visible ) ;
  124. X            return (-1);
  125. X
  126. X           case KEY_HELP:
  127. X            ShowHelp (menu->helpfile, "popmenu", LINES);
  128. X            break;
  129. X
  130. X           case KEY_REFRESH:
  131. X            clearok (menu->win, TRUE);
  132. X            wrefresh (menu->win);
  133. X            break;
  134. X
  135. X           default:
  136. X            break;
  137. X        }  /* end switch (ch) */
  138. X    }
  139. X}
  140. X
  141. X/* pjc 7/87 */
  142. X
  143. X_showWin( menu, top )
  144. X    MENU    *menu ;
  145. X    int    top ;
  146. X{
  147. X    register int    i ;
  148. X
  149. X    for (i=0; i < menu->winSize && top+i-1 < menu->NumItems+1; i++)
  150. X        mvwprintw (menu->win, i+1, 2, "%-*s", menu->width, menu->items[top+i-1]);
  151. X    for (; i < menu->winSize ; i++)
  152. X        mvwprintw (menu->win, i+1, 2, "%*s", menu->width, " ");
  153. X}
  154. SHAR_EOF
  155. echo "File utilities.d/libgeti.d/popmenu.c is complete"
  156. chmod 0644 utilities.d/libgeti.d/popmenu.c || echo "restore of utilities.d/libgeti.d/popmenu.c fails"
  157. echo "x - extracting utilities.d/libgeti.d/GetInput.h (Text)"
  158. sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/GetInput.h &&
  159. X#ifndef LINT
  160. Xstatic char ID_GetInput[] = "%W%   DeltaDate %G%   ExtrDate %H%";
  161. X#endif
  162. X
  163. X/*
  164. X**    Type of allowable characters
  165. X*/
  166. X
  167. X#define    ALPHANUM    ' '
  168. X#define    ALPHA        'A'
  169. X#define    NUMERIC        '9'
  170. X#define    SET        'E'
  171. X#define    MENU        'M'
  172. X#define    UPPER        'U'
  173. X#define    UPPER_AN    'V'
  174. X#define    HEX        'H'
  175. X#define    STATE        'S'
  176. X#define    ZIP        'Z'
  177. X#define    DATE        'D'
  178. X#define    TIME        'T'
  179. X#define    PROTECT        'P'
  180. X
  181. X/*
  182. X**    Adjust/Fill
  183. X*/
  184. X
  185. X#define    NOFILL        ' '
  186. X#define    RTADJ_ZFILL    'Z'
  187. X#define    RTADJ_BFILL    'B'
  188. X#define    LFADJ_ZFILL    'z'
  189. X#define    LFADJ_BFILL    'b'
  190. X
  191. X/*
  192. X**    'C' field types
  193. X*/
  194. X
  195. X#define CHAR        '0'
  196. X#define INT        '1'
  197. X#define SHORT        '2'
  198. X#define LONG        '3'
  199. X#define DOUBLE        '4'
  200. X#define MONEY        'M'
  201. X#define FLOAT        '5'
  202. X
  203. X/*
  204. X**    Union to take care of a field that could be any valid
  205. X**        'c' field type.
  206. X*/
  207. X
  208. Xtypedef union FldUnion {
  209. X    long    *longVal ;
  210. X    double    *doubleVal ;
  211. X    float    *floatVal ;
  212. X    int    *intVal ;
  213. X    short    *shortVal ;
  214. X    char    *strVal ;
  215. X} *FldUnPointer ;
  216. X
  217. X
  218. X#define AUTONEXT    TRUE
  219. X#define NOAUTO        FALSE
  220. X
  221. X#define MUSTENTER    TRUE
  222. X#define NOMUST        FALSE
  223. X
  224. X#define NOHELP        ""
  225. X#define NORANGE        NULL
  226. X#define NOMSG        NULL
  227. X#define NOMASK        NULL
  228. X#define NOTAG        ""
  229. X#define    A_SAME        -1        /* same as what's on the screen */
  230. X
  231. X
  232. X#ifndef KEY_RETURN
  233. X#   define KEY_RETURN    '\r'
  234. X#endif
  235. X#ifndef KEY_BEG
  236. X#   define KEY_BEG    0542
  237. X#endif
  238. X#ifndef KEY_END
  239. X#   define KEY_END    0550
  240. X#endif
  241. X#ifndef    KEY_SAVE
  242. X#   define KEY_SAVE    0571
  243. X#endif
  244. X#ifndef    KEY_PRINT
  245. X#   define KEY_PRINT     0532
  246. X#endif
  247. X#ifndef    KEY_HELP
  248. X#   define KEY_HELP     0553
  249. X#endif
  250. X#ifndef    KEY_REFRESH
  251. X#   define KEY_REFRESH     0565
  252. X#endif
  253. X#ifndef    KEY_TAB
  254. X#   define KEY_TAB     '\t'
  255. X#endif
  256. X#ifndef    KEY_BTAB
  257. X#   define KEY_BTAB     0541
  258. X#endif
  259. X#ifndef    KEY_CANCEL
  260. X#   define KEY_CANCEL     0543
  261. X#endif
  262. X#ifndef    KEY_ACCEPT
  263. X#   define KEY_ACCEPT     1000
  264. X#endif
  265. X#ifndef    KEY_TOC
  266. X#   define KEY_TOC     1001
  267. X#endif
  268. X
  269. X#define NOKEY        '\0'
  270. X#define KEY_CTLA    '\001'
  271. X#define KEY_CTLB    '\002'
  272. X#define KEY_CTLC    '\003'
  273. X#define KEY_CTLD    '\004'
  274. X#define KEY_CTLE    '\005'
  275. X#define KEY_CTLF    '\006'
  276. X#define KEY_CTLG    '\007'
  277. X#define KEY_CTLH    '\010'
  278. X#define KEY_CTLI    '\011'
  279. X#define KEY_CTLJ    '\012'
  280. X#define KEY_CTLK    '\013'
  281. X#define KEY_CTLL    '\014'
  282. X#define KEY_CTLM    '\015'
  283. X#define KEY_CTLN    '\016'
  284. X#define KEY_CTLO    '\017'
  285. X#define KEY_CTLP    '\020'
  286. X#define KEY_CTLQ    '\021'
  287. X#define KEY_CTLR    '\022'
  288. X#define KEY_CTLS    '\023'
  289. X#define KEY_CTLT    '\024'
  290. X#define KEY_CTLU    '\025'
  291. X#define KEY_CTLV    '\026'
  292. X#define KEY_CTLW    '\027'
  293. X#define KEY_CTLX    '\030'
  294. X#define KEY_CTLY    '\031'
  295. X#define KEY_CTLZ    '\032'
  296. X
  297. X/*
  298. X**  Macros
  299. X*/
  300. X#define wattrOn(a, b)    wattrset(a, b)
  301. X#define wattrOff(a)    wattrset(a, 0)
  302. X#ifndef BELL
  303. X#define    BELL    printf ("%c", 7)
  304. X#endif
  305. X
  306. X#define    CLEARROW(row)    { \
  307. X                int    col; \
  308. X                int    tmprow; \
  309. X                tmprow = ((row%100) == row) ? row : row/100; \
  310. X                col = ((row%100) == row) ? 0 : row%100; \
  311. X                for (; col<=COLS-2; col++) \
  312. X                    mvwaddch (stdscr, tmprow,col, ' '); \
  313. X            }
  314. SHAR_EOF
  315. chmod 0644 utilities.d/libgeti.d/GetInput.h || echo "restore of utilities.d/libgeti.d/GetInput.h fails"
  316. echo "x - extracting utilities.d/libgeti.d/keys.h (Text)"
  317. sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/keys.h &&
  318. X#ifndef LINT
  319. Xstatic char ID_keys[] = "%W%   DeltaDate %G%   ExtrDate %H%";
  320. X#endif
  321. X
  322. Xextern int    KeyReturn;
  323. Xextern int      KeyDown;
  324. Xextern int      KeyUp;
  325. Xextern int      KeyTab;
  326. Xextern int      KeyBTab;
  327. Xextern int      KeyAccept;
  328. X
  329. Xextern int      KeyBeg;
  330. Xextern int      KeyEnd;
  331. Xextern int      KeyRight;
  332. Xextern int      KeyLeft;
  333. Xextern int      KeyBackspace;
  334. Xextern int      KeyEOL;
  335. Xextern int      KeyDL;
  336. Xextern int      KeyDC;
  337. Xextern int      KeyIC;
  338. X
  339. Xextern int      KeyHelp;
  340. Xextern int      KeyTOC;
  341. Xextern int      KeyRedraw;
  342. Xextern int      KeySave;
  343. Xextern int      KeyPrint;
  344. Xextern int      KeyCancel;
  345. SHAR_EOF
  346. chmod 0644 utilities.d/libgeti.d/keys.h || echo "restore of utilities.d/libgeti.d/keys.h fails"
  347. echo "x - extracting utilities.d/libgeti.d/makefile (Text)"
  348. sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/makefile &&
  349. X# %W%   DeltaDate %G%   ExtrDate %H%
  350. X
  351. XTITLE = GETINPUT
  352. X
  353. XINSTALLLIB     = 
  354. XINSTALLHDR    =
  355. XMANDIR         = .
  356. X
  357. X#CC = cc
  358. X
  359. X###  CFLAG settings
  360. X
  361. X###  Sys5
  362. XCFLAGS = -O
  363. X###  Xenix
  364. X#CFLAGS = -O -DM_TERMINFO -LARGE -Ml -Mlt34 -F 4000
  365. X
  366. XARFLAGS = rv
  367. X
  368. XLIBS = libgeti.a -lcurses -lc
  369. X
  370. X
  371. XCFILES = AdjField.c DateFun.c DisPrmpt.c FindSet.c GetSetLen.c \
  372. X    GetInput.c IsDate.c IsFldOk.c IsMask.c IsRange.c IsState.c IsTime.c \
  373. X    ReDispFld.c ScrnOut.c ShowChar.c ShowSet.c ShowHelp.c \
  374. X    popmenu.c BuildMenu.c checkmask.c doinsert.c InitGetI.c drawbox.c \
  375. X    RingMenu.c
  376. X
  377. XHFILES = GetInput.h keys.h
  378. XMANPAGES = GetInput.3X popmenu.3 drawbox.3 ShowHelp.3
  379. X
  380. XOBJECTS =${CFILES:.c=.o}
  381. X
  382. Xinstall : libgeti.a
  383. X    -ln libgeti.a ../../libgeti.a
  384. X    -ln GetInput.h ../../GetInput.h
  385. X
  386. Xtest : libgeti.a _Main.o
  387. X    $(CC) $(CFLAGS) _Main.o $(LIBS) -o test.out
  388. X
  389. Xlibgeti.a : $(OBJECTS)
  390. X    ar $(ARFLAGS) libgeti.a $?
  391. X
  392. Xlint:
  393. X    lint -I$(INCDIR) _Main.c $(CFILES) -lcurses > lint.out
  394. X
  395. Xprint :
  396. X    PrintPrg $(MANPAGES) makefile $(CFILES) $(HFILES) _Main.c | lp -t$(TITLE)
  397. X
  398. Xshar:
  399. X    shar -b GetInput.hlp $(MANPAGES) makefile $(CFILES) $(HFILES) _Main.c > libgeti.shar
  400. X
  401. Xclean :
  402. X    rm -f *.o core libgeti.a test.out lint.out libgeti.shar \
  403. X    ../../libgeti.a ../../GetInput.h libgeti.shar.Z
  404. X
  405. X#####
  406. X#####
  407. X
  408. X_Main.o:    _Main.c GetInput.h keys.h
  409. XAdjField.o:    AdjField.c GetInput.h
  410. XDisPrmpt.o:    DisPrmpt.c GetInput.h
  411. XFindSet.o:    FindSet.c GetInput.h
  412. XGetSetLen.o:    GetSetLen.c GetInput.h
  413. XGetInput.o:    GetInput.c GetInput.h keys.h
  414. XIsDate.o:    IsDate.c GetInput.h
  415. XIsFldOk.o:    IsFldOk.c GetInput.h
  416. XIsMask.o:    IsMask.c GetInput.h
  417. XIsRange.o:    IsRange.c GetInput.h
  418. XIsTime.o:    IsTime.c GetInput.h
  419. XReDispFld.o:    ReDispFld.c GetInput.h
  420. XScrnOut.o:    ScrnOut.c GetInput.h
  421. XShowChar.o:    ShowChar.c GetInput.h
  422. XShowSet.o:    ShowSet.c GetInput.h
  423. SHAR_EOF
  424. chmod 0644 utilities.d/libgeti.d/makefile || echo "restore of utilities.d/libgeti.d/makefile fails"
  425. echo "x - extracting utilities.d/libgeti.d/GetInput.3X (Text)"
  426. sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/GetInput.3X &&
  427. X. \ %W% DeltaDate %G% ExtrDate %H% 
  428. X.TH GETINPUT 3X "libgeti"
  429. X.SH NAME
  430. XGetInput \- manages terminal input using curses
  431. X.SH SYNOPSIS
  432. X.LP
  433. X.nf
  434. X#include <curses.h>
  435. X#include "GetInput.h"
  436. X
  437. Xint GetInput (win, row, col, &Fld, FldAttribute, FldMask,
  438. X              FldRange, FldLength, FldMin, FldCharType, 
  439. X              FldAdjust, FldType, FldExit, MustEnter, 
  440. X              ErrRow, MsgRow, PromptMsg, HelpFile, HelpTag)
  441. X
  442. XWINDOW        *win;
  443. Xint           row, col, FldAttrbute, FldLength, FldMin, 
  444. X              FldExit, MustEnter, ErrRow, MsgRow;
  445. XFldUnPointer  Fld;
  446. Xchar          *FldMask, *FldRange, FldCharType, FldAdjust, 
  447. X              FldType, *PromptMsg, HelpFile[], HelpTag[];
  448. X.fi
  449. X.SH DESCRIPTION
  450. XGets terminal input using curses(3X). 
  451. XGetInput uses a field by field approach.  All
  452. Xedits and processing are performed for that field as the user
  453. Xmoves from field to field.  It is not a fill form methodology where
  454. Xall edits and processing are performed after the user has inputed
  455. Xa number of fields in a form.
  456. X
  457. X.SH GETTING STARTED
  458. XYou need to include GetInput.h in your program.
  459. X
  460. XCurses tty modes should be - cbreak(), noecho(), nonl() and
  461. Xkeypad () if you want to use arrow keys and the like.
  462. X
  463. XYou should trap and ignore SIGALRM (see BUGS).
  464. X
  465. X.SS Defining Keyboard Keys
  466. XGetInput uses a number of keyboard keys to tell it what to do.
  467. XA default value to the various keys is automatically assigned when you use
  468. Xthis library.  Those default values may be changed by declaring the variable
  469. Xas extern in your program and assigning a new value.
  470. XIn addition to the default variable values, if the terminal
  471. Xhas an associated curses key defined (see curses.h) that key may also be used.
  472. XFor example, ^b (KeyBeg) is the default value to place cursor at beginning 
  473. Xof a field but if there is a key defined for KEY_BEG, in curses, then that
  474. Xkey may also be used.  If the value of KeyBeg and KEY_BEG are different, 
  475. XGetInput will return the value of KEY_BEG not KeyBeg regardless of which 
  476. Xone is pressed.
  477. XNot all keys may have an associated curses key.
  478. XThe "^" indicates press and hold the control key.  A negative one disables
  479. Xthe key, although the associated curses key is still active.
  480. X.br
  481. XBelow is listed the InitGetI() function with the default value and the
  482. Xassociated curses key.
  483. X.nf
  484. X
  485. X/*
  486. X**  InitGetI()
  487. X**    All this does is define some global variables for the keys
  488. X**    used in GetInput(3) and assign some default values.
  489. X*/
  490. X
  491. X#include    <curses.h>
  492. X#include    "GetInput.h"
  493. X
  494. X                /* ACCEPT INPUT KEYS */
  495. X                /* These are the only keys that will return the data inputted into your variable. */
  496. Xint    KeyReturn = '\\r';        /* ^m  KEY_RETURN */
  497. Xint    KeyDown = 10;        /* ^j  KEY_DOWN */
  498. Xint    KeyUp = 11;        /* ^k  KEY_UP */
  499. Xint    KeyTab = '\\t';        /* ^i  KEY_TAB */
  500. Xint    KeyBTab = -1;        /*     KEY_BTAB */
  501. Xint    KeyAccept = 1;        /* ^a  KEY_ACCEPT - Typically this is the key the user presses
  502. X                             to signify he/she is finished with this screen. */
  503. X
  504. X                /* FIELD EDITING KEYS */
  505. Xint    KeyBeg = 2;        /* ^b  KEY_BEG - Place cursor at beginning of field */
  506. Xint    KeyEnd = 5;        /* ^e  KEY_END - Place cursor at end of input in field */
  507. Xint      KeyRight = 12;        /* ^l  KEY_RIGHT - Forward space in field */
  508. Xint      KeyLeft = 8;        /* ^h  KEY_LEFT - Backspace in field (non-destructive) */
  509. Xint      KeyBackspace = '\\b';    /* \\b  KEY_BACKSPACE - Same as KEY_LEFT */
  510. Xint      KeyEOL = 4;        /* ^d  KEY_EOL - Delete from cursor to end of field */
  511. Xint      KeyDL = 3;        /* ^c  KEY_DL - Clear field and home cursor */
  512. Xint      KeyDC = 24;        /* ^x  KEY_DC - Delete a character */
  513. Xint      KeyIC = 20;        /* ^t  KEY_IC - Toggle between type-over and insert mode */
  514. X
  515. X                /* OTHER KEYS */
  516. Xint      KeyRedraw = 18;        /* ^r  KEY_REFRESH - Redraw screen */
  517. Xint      KeySave = 6;        /* ^f  KEY_SAVE - Save screen to a file */
  518. Xint      KeyPrint = 16;        /* ^p  KEY_PRINT - Print screen to lp */
  519. Xint      KeyCancel = 27;        /* esc KEY_CANCEL - Cancel pop-up menu selection */
  520. Xint      KeyHelp = '?';        /*     KEY_HELP - Display help screen */
  521. X                /*        If the user needs to input a "?" you will have to change this. */
  522. Xint      KeyTOC = 20;        /* ^t  KEY_TOC  - When in help display Table of Contents */
  523. X
  524. Xvoid
  525. XInitGetI()
  526. X{
  527. X    /* i don't do nuthin */
  528. X}
  529. X.fi
  530. X
  531. X.SH ARGUMENT DESCRIPTION
  532. X.TP 6
  533. X*win
  534. XA pointer to a curses window that this routine will operate under.
  535. X.TP 
  536. Xrow
  537. XThe row to position cursor on.
  538. X.TP 
  539. Xcol
  540. XThe starting column for field.
  541. X.TP
  542. X&Fld        
  543. XA pointer to a union variable where you have loaded the
  544. Xaddress of your memory variable to accept the input data.  Upon
  545. Xentry to GetInput the value in your memory variable will be
  546. Xdisplayed as the default value.  The type of union you select must be compatible
  547. Xwith the \fIFldType\fP you've specified.
  548. X
  549. X.nf
  550. XFor example:
  551. X    union FldUnion    Fld;
  552. X    double        myvar;
  553. X
  554. X    Fld.doubleVal = &myvar;
  555. X    GetInput (......);
  556. X
  557. X    /*
  558. X    **  After returning from GetInput() what the user typed in will
  559. X    **  be in \fImyvar\fP;
  560. X    */
  561. X
  562. X
  563. X
  564. X/*
  565. X**     Structure of Union
  566. X*/
  567. Xtypedef union FldUnion
  568. X{
  569. X    long    *longVal;
  570. X    double  *doubleVal;
  571. X    float   *floatVal;
  572. X    int     *intVal;
  573. X    short   *shortVal;
  574. X    char    *strVal;
  575. X} *FldUnPointer;
  576. X.fi
  577. X.TP
  578. XFldAttrbute    
  579. XCurses attribute you want your input field to be.  For
  580. Xexample A_REVERSE.  Refer to curses(3X) for further
  581. Xinformation on allowable terminal attributes.
  582. X.br
  583. XA_SAME  is a special attribute that tells GetInput to use
  584. Xthe same attributes that is already on the screen in the
  585. Xfirst column of the field.
  586. X
  587. X. \ **********************************
  588. X.TP
  589. XFldMask
  590. XA char pointer to a mask for the field.  This permits the user to mix 
  591. Xalpha with numeric while letting GetInput do the edit checking.  You can also
  592. Xuse this to format a field.
  593. X
  594. XThe keyword \fBNOMASK\fP may be placed here if no mask is required.
  595. X
  596. XValid masks for a field depend upon the type of field
  597. Xyou specify, see \fIFldCharType\fP.
  598. X
  599. XThe \fIFldLength\fP should not include character positions where no input
  600. Xis allowed in the mask (format characters), because format characters
  601. Xare not returned into \fIFld\fP.  For example, \fIFldCharType = DATE,
  602. XFldMask = "MM/DD/YY"\fP.  The "/" is a format character.  The cursor
  603. Xwill skip over those positions in the field.  Only the characters typed in
  604. Xthe MM DD YY positions will be in your memory variable \fIFld\fP.
  605. XThe FldLength would be six for this case.
  606. X
  607. XBecause the mask is so closely tied to the \fIFldCharType\fP, a complete
  608. Xdescription of what mask characters are valid with what field types is 
  609. Xdescribed under
  610. X\fIFldCharType\fP.  Any character in the mask that is not listed as a valid
  611. Xmask character for that field type becomes a format character.
  612. X. \ **********************************
  613. X.TP
  614. XFldRange
  615. XA char pointer to a set of valid ranges permitted for this field. 
  616. XRanges may be specified as comma separated values ("ONE,TWO,THREE") 
  617. Xor as a range ("1-5"), or a combination of both ("1-5,M,E").
  618. XRange values must be compatible with the \fIFldCharType\fP and \fIFldType\fP 
  619. Xthat you 
  620. Xhave selected.
  621. X.br
  622. XSome examples:
  623. X.nf
  624. X    "1-10"
  625. X    "5,10,15,16"
  626. X    "1-10,20,M,E,32-40"
  627. X    "CA,TX,ID"
  628. X.fi
  629. X
  630. XThe keyword \fBNORANGE\fP may be used if no range checking is to be 
  631. Xperformed for this field.
  632. X. \ **********************************
  633. X.TP
  634. XFldLength
  635. XMaximum length of this field.  For field types (FldCharTypes) SET and MENU 
  636. Xthe field length is automatically set to the longest set value in the FldRange.
  637. X. \ **********************************
  638. X.TP
  639. XFldMin
  640. XIf \fIMUSTENTER\fP is selected in \fIFldExit\fP then this is the minimum
  641. Xrequired input.  Otherwise, it is the minimum required input only if they try 
  642. Xto input something.
  643. X. \ **********************************
  644. X.TP
  645. XFldCharType
  646. XThis argument defines edit checks to be performed on the
  647. Xinput characters as they are being typed in.  If no mask is provided then
  648. Xthe field type itself determines the edit checks to be performed on all
  649. Xcharacters in the field.
  650. X.RS 6
  651. X.TP 11
  652. XALPHANUM
  653. XAny alpha/numeric character is allowed.
  654. X.br
  655. XValid mask characters:
  656. X.nf
  657. X    space    alpha/numeric
  658. X    A    alpha
  659. X    9    numeric
  660. X    U    upper alpha
  661. X    V    upper alpha/numeric
  662. X    H    ???
  663. X.fi
  664. X.TP
  665. XALPHA
  666. XAlpha only.
  667. X.br
  668. XValid mask characters:
  669. X.nf
  670. X    A    alpha
  671. X.fi
  672. X.TP
  673. XNUMERIC
  674. XNumeric only.
  675. X.br
  676. XValid mask characters:
  677. X.nf
  678. X    9    numeric
  679. X.fi
  680. X.TP
  681. XUPPER
  682. XConvert to upper case.  Only alpha permitted.
  683. X.br
  684. XValid mask characters:
  685. X.nf
  686. X    U    upper alpha
  687. X.fi
  688. X.TP
  689. XUPPER_AN
  690. XAlpha and numeric permitted.  Convert alpha characters to upper-case.
  691. X.br
  692. XValid mask characters:
  693. X.nf
  694. X    V    upper alpha/numeric
  695. X.fi
  696. X.TP
  697. XHEX
  698. XOnly hex characters permitted.
  699. X.br
  700. XValid mask characters:
  701. X.nf
  702. X    H    ???
  703. X    space    ???
  704. X.fi
  705. X.TP
  706. XSTATE
  707. XValid two character Post Office abbreviations for the fifty states.
  708. XA edit check is done for a valid state.
  709. X.br
  710. XValid mask characters:
  711. X.nf
  712. X    SS    two character state
  713. X    S    ???
  714. X    space    ???
  715. X.fi
  716. X.TP
  717. XZIP
  718. XPost Office zip code.
  719. X.br
  720. XValid mask characters:
  721. X.nf
  722. X    99999-9999    ???
  723. X.fi
  724. X.TP
  725. XDATE
  726. XA valid date.
  727. X.br
  728. XValid mask characters:
  729. X.nf
  730. X    MM    month  (01-12)
  731. X    DD    day  (01-31)
  732. X    YY    year  (00-99)
  733. X    YYYY    full year with century
  734. X.fi
  735. XThe mask must contain at least MM and DD.  If no mask is specified for the
  736. Xfield a default mask of "MMDDYY" is used.
  737. X.br
  738. XSome examples:
  739. X.nf
  740. X    MMDDYY
  741. X    MM/DD/YY
  742. X    YY-MM-DD
  743. X    MM  DD  YYYY
  744. X.fi
  745. X.TP
  746. XTIME
  747. XA time field.
  748. X.br
  749. XValid mask characters:
  750. X.nf
  751. X    HH    hours  (01-12)
  752. X    MM    minutes  (00-59)
  753. X    SS    seconds  (00-59)
  754. X    TT    tenths  (00-99)
  755. X    II    military hours  (00-24)
  756. X.fi
  757. XSome examples:
  758. X.nf
  759. X    HH:MM
  760. X    HH:MM:SS
  761. X    HH:MM:SS:TT
  762. X    II:MM
  763. X    II:MM:SS
  764. X    II:MM:SS:TT
  765. X.fi
  766. X.TP
  767. XSET
  768. XThis field type specifies a set of values that are acceptable in the input 
  769. Xfield.
  770. XThe acceptable values within the set are specified in the \fIFldRange\fP 
  771. Xargument.  
  772. XThe user selects one of the set values specified in the field range by
  773. Xpressing the space bar, which will toggle through the set values,
  774. Xor by pressing the first character in the desired value.
  775. X
  776. XThe format of the FldRange can only be comma separated values 
  777. X(ex. "CA,ID,TX").  
  778. XRange values, such as "1-5", don't work.  You would have to say "1,2,3,4,5".
  779. X.br
  780. XThe FldLength is automatically set to the longest set value in the FldRange.
  781. X.TP
  782. XMENU
  783. XThis field type is similar to the SET type.  The difference is when the user
  784. Xattempts to type something in the field a pop-up menu of available choices
  785. Xare displyed, as specified in field_range.  
  786. XThe user makes a selection by hi-lighting the choice and pressing return.
  787. X.br
  788. XSee SET type for specifying the FldRange.
  789. XThe limit is ten items in the FldRange.
  790. X.TP
  791. XPROTECT
  792. XThis X's out the field so what is typed on the keyboard can not be seen on
  793. Xthe screen.  Useful for password entry.
  794. X.RE
  795. X. \ ---------------------------------
  796. X.TP
  797. XFldAdjust
  798. XIndicates whether to adjust the text right or left within the field
  799. Xand whether or not to zero or blank fill the field.
  800. X.RS 6
  801. X.TP 15
  802. XNOFILL
  803. Xno action.
  804. X.TP
  805. XRTADJ_ZFILL
  806. Xright adjust, zero fill
  807. X.TP
  808. XRTADJ_BFILL
  809. Xright adjust, blank fill
  810. X.TP
  811. XLFADJ_ZFILL
  812. Xleft adjust, zero fill
  813. X.TP
  814. XLFADJ_BFILL
  815. Xleft adjust, blank fill
  816. X.RE
  817. X. \ ---------------------------------
  818. X.TP 6
  819. XFldType
  820. XThis argument describes the memory variable that is to hold
  821. Xthe input data.  The address that you loaded into "&Fld".
  822. X.RS 6
  823. X.TP 10
  824. XCHAR
  825. Xcharacter field
  826. X.TP
  827. XINT
  828. Xinteger
  829. X.TP
  830. XSHORT
  831. Xshort integer
  832. X.TP
  833. XLONG
  834. Xlong integer
  835. X.TP
  836. XDOUBLE
  837. Xdouble
  838. X.TP
  839. XFLOAT
  840. Xfloating point
  841. X.TP
  842. XMONEY
  843. Xdouble which accepts only two decimal positions.
  844. X.RE
  845. X. \ ---------------------------------
  846. X.TP 11
  847. XFldExit
  848. X.RS 6
  849. X.TP 10
  850. XAUTONEXT
  851. XGetInput() will exit, with the value of KEY_RETURN, when the last character 
  852. Xin the field is keyed in.
  853. X.TP
  854. XNOAUTO
  855. XWill not exit field until a accept key (see defining keyboard keys) is pressed.
  856. X.RE
  857. X. \ ---------------------------------
  858. X.TP
  859. XMustEnter
  860. X.RS 6
  861. X.TP 12
  862. XMUSTENTER
  863. XThis is a must enter field and the value of FldMin must be
  864. Xentered before exiting field.
  865. X.TP
  866. XNOMUST
  867. XNot a must enter field.
  868. X.RE
  869. X. \ ---------------------------------
  870. X.RE
  871. X.TP 6
  872. XErrRow
  873. XIndicates what row/column to display an error message if one occurs.
  874. XThe row specified is for stdscr.
  875. XIf a optional column is to be specified on where to start the message, the
  876. Xformat would be for example 2302 where 23 is the row and 02 is the column.
  877. XOtherwise, a default of column zero is used.
  878. XGetInput will do a clrtoeol() before displaying the error message, therefore,
  879. Xthe entire row must be given over to GetInput.
  880. XIf this row is outside the boundary of the window unpredictable results will
  881. Xoccur, for example, winch() will return garbage.
  882. X.TP
  883. XMsgRow
  884. XIndicates what row to display help messages.
  885. XThe row specified is for stdscr.
  886. XIf a optional column is to be specified on where to start the message, the
  887. Xformat would be for example 2202 where 22 is the row and 02 is the column.
  888. XOtherwise, a default of column zero is used.
  889. XGetInput will do a clrtoeol() before displaying the message, therefore,
  890. Xthe entire row must be given over to GetInput.
  891. XIf this row is outside the boundary of the window unpredictable results will
  892. Xoccur, for example, winch() will return garbage.
  893. X.RS 6
  894. X.TP 10
  895. XNULL
  896. XNo active message line.  Only if PromptMsg == NOMSG.
  897. X.RE
  898. X.TP
  899. X*PromptMsg
  900. XPrompt message to be displayed.  The prompt message is always displayed
  901. Xto stdscr, regardless of the win specified.
  902. X.RS 6
  903. X.TP 10
  904. XNOMSG
  905. XNo message to be displayed.
  906. X.RE
  907. X.TP
  908. XHelpFile
  909. XFile name containing on-line help messages.  Current directory
  910. Xis searched first for helpfile and then getenv("HELPDIR") directory is
  911. Xsearched.
  912. X.RS 6
  913. X.TP 10
  914. XNOHELP
  915. XNo help file is available for this field.
  916. X
  917. X.PP
  918. XThe default helpfile (GetInput.hlp) is shown below.  Where this file is
  919. Xinstalled will vary from machine to machine.
  920. X
  921. X.nf
  922. X\fBGETINPUT\fP
  923. X .TITLE GETINPUT Help
  924. XMover Keys:
  925. X        KEY_RETURN  (^m)    Traverse forwards through the fields.
  926. X        KEY_DOWN  (^j)      Traverse forwards through the fields.
  927. X        KEY_UP  (^k)        Traverse backwards through the fields.
  928. X        KEY_TAB  (^i)       Fast forward through the fields.
  929. X        KEY_BTAB            Fast reverse through the fields.
  930. XField Editing Keys:
  931. X        KEY_BEG  (^b)       Place cursor at beginning of field.
  932. X        KEY_END  (^e)       Place cursor at end of input in field.
  933. X        KEY_RIGHT  (^l)     Forward space within the field.
  934. X        KEY_LEFT  (^h)      Backspace within the field (non-destructive).
  935. X        KEY_BACKSPACE  (^h) Same as KEY_LEFT.
  936. X        KEY_EOL  (^d)       Delete from cursor to end of field.
  937. X        KEY_DL  (^c)        Clear field and home cursor.
  938. X        KEY_DC  (^x)        Delete a character.
  939. X        KEY_IC  (^t)        Toggle between type-over and insert mode.
  940. XOther Keys:
  941. X        KEY_HELP  (?)       Display help screen.
  942. X        KEY_REFRESH  (^r)   Redraw the screen.
  943. X        KEY_ACCEPT  (^a)    Accept all input and exit screen.
  944. X        KEY_CANCEL  (esc)   Cancel all input and exit screen.
  945. X        KEY_SAVE  (^f)      Save screen to a file.
  946. X        KEY_PRINT  (^p)     Print screen to lp.
  947. X\fBGETINPUT\fP
  948. X
  949. X
  950. X
  951. X\fBpopmenu\fP
  952. X.TITLE Pop-Up Menu Help
  953. XSELECTING OPTIONS:
  954. X    To select an option press the "up arrow key",
  955. X    "k", "down arrow key", "j" to place bar on
  956. X    option and press "return".
  957. X
  958. X    KEY_CANCEL (esc)   - Cancel selection.
  959. X\fBpopmenu\fP
  960. X
  961. X
  962. X
  963. X\fBhelp\fP
  964. X.TITLE Using Help
  965. XHelp displays consist of a description displayed in a window.
  966. XIf the description doesn't fit in the window, the Up Arrow and
  967. XDown Arrow keys can be used to view a few more lines of the 
  968. Xdisplay.  Exiting the help system will return the display to 
  969. Xthe state it was in when you asked for help.
  970. X
  971. X   The following keys are active in help:
  972. X        KEY_CANCEL  (esc)   Exit help.
  973. X        KEY_DOWN  (^j)      View a few more lines.
  974. X        KEY_UP  (^k)        View the previous lines.
  975. X        KEY_BEG  (^b)       Display first page.
  976. X        KEY_END  (^e)       Display last page.
  977. X        KEY_TOC  (^t)       Display table of contents.
  978. X\fBhelp\fP
  979. X.fi
  980. X.RE
  981. X.TP
  982. XHelpTag
  983. XTag in help file where messages are to be found.  The tag 
  984. Xsurrounds the help message.  For example:
  985. X.nf
  986. X
  987. Xhelptag
  988. X[ .TITLE  Title line goes here. ]
  989. XI put any help message for the user between the tags.  
  990. XIt can be any length as it will be displayed one screen 
  991. Xat a time.
  992. XThe following screen attributes may be used:
  993. X\\S  =  Standout
  994. X\\B  =  Bold
  995. X\\U  =  Underline
  996. X\\D  =  Dim
  997. X\\R  =  Reverse video
  998. X\\L  =  Blink
  999. X\\N  =  Normal (reset)
  1000. X
  1001. X\\BThis text is in bold face.  \\NBack in normal mode.
  1002. Xhelptag
  1003. X
  1004. XThe \fITABLE_OF_CONTENTS\fP tagname is a special tag describing what
  1005. Xis to be contained in the table of contents menu.  The following is the
  1006. Xsyntax for this tagname.
  1007. XTABLE_OF_CONTENTS
  1008. Xhelpfile   tagname   description
  1009. XTABLE_OF_CONTENTS
  1010. X.fi
  1011. X.RS 6
  1012. X.TP 10
  1013. XNOTAG
  1014. XNo tag.  Should only be used if (HelpFile == NOHELP).
  1015. X.RE
  1016. X.SH EXAMPLE
  1017. X.nf
  1018. X#include <curses.h>
  1019. X#include "GetInput.h"
  1020. X
  1021. Xmain ()
  1022. X{
  1023. X    union FldUnion Fld;
  1024. X    char    name[20], tempstring[50];
  1025. X    int    exitcode;
  1026. X
  1027. X   initscr ();
  1028. X   cbreak ();
  1029. X   noecho ();
  1030. X   nonl ();
  1031. X   keypad (stdscr, TRUE);
  1032. X
  1033. X   name[0] = '\\0';
  1034. X   Fld.strVal = name;
  1035. X   exitcode = GetInput (stdscr, 2, 0, &Fld, A_REVERSE, NOMASK, 
  1036. X                  NORANGE, 20, 0, UPPER_AN, NOFILL, CHAR, 
  1037. X                  NOAUTO, MUSTENTER, 21, 20, 
  1038. X                  "Please enter your name.", NOHELP, NOTAG);
  1039. X
  1040. X   Fld.strVal = tempstring;
  1041. X   exitcode = GetInput (stdscr, 4, 0, &Fld, A_BOLD, "HH:MM:SS:TT",
  1042. X                  NORANGE, 6, 6, TIME, NOFILL, CHAR, AUTONEXT, 
  1043. X                  NOMUST, 20, 21, "Time Field HH:MM:SS:TT", 
  1044. X                  "myhelpfile", "field2");
  1045. X
  1046. X   Fld.strVal = tempstring;
  1047. X   exitcode = GetInput (stdscr, 8, 0, &Fld, A_NORMAL, 
  1048. X                  "(999) 999-9999", NORANGE, 10, 5, NUMERIC, 
  1049. X                  RTADJ_ZFILL, CHAR, NOAUTO, MUSTENTER, 20, NULL, 
  1050. X                  NOMSG, NOHELP, NOTAG);
  1051. X
  1052. X   Fld.strVal = tempstring;
  1053. X   exitcode = GetInput (stdscr, 9, 1, &Fld, A_REVERSE, NOMASK,
  1054. X                  "CA, NV, ID", 2, 2, SET, NOFILL, CHAR, NOAUTO,
  1055. X                  NOMUST, 20, 20, "Select your state.", NOHELP, 
  1056. X                  NOTAG);
  1057. X   endwin ();
  1058. X}
  1059. X.fi
  1060. X.SH AUTHOR
  1061. XIrving Griesman  (original author)
  1062. X.br
  1063. XEnhanced & Maintained by Paul J. Condie
  1064. X.br
  1065. X{ihnp4,lll-crg,qantel,pyramid}!ptsfa!pbody!pcbox!pjc
  1066. X
  1067. X.SH FILES
  1068. XGetInput.hlp    - default GetInput help file.
  1069. X
  1070. X.SH DIAGNOSTICS
  1071. XGetInput returns the the decimal value of the key pressed from the getch()
  1072. Xfunction.  If the key pressed has an associated curses key GetInput returns
  1073. Xthe value of the curses key.  See Defining keyboard keys.
  1074. X
  1075. X.SH SEE ALSO
  1076. Xcurses(3X), popmenu(3).
  1077. X
  1078. X.SH WARNING
  1079. XPutting a field on the same row as your message row or error row may cause
  1080. Xunpredictable results.  This is not recommended.
  1081. X
  1082. X.SH BUGS
  1083. XThere is a bug in curses when you call getch() which this routine does.
  1084. XWhen in keypad() mode and an ESC character is read, curses 
  1085. Xdoes a timed read (1 second) waiting for other characters to appear.  if
  1086. Xsome other characters are received within the one second time interval,
  1087. Xcurses attempts to match the received string with a caps string defined for the terminal (i.e. ESC[A, ESC[B are arrow keys for a vt100 type terminal)
  1088. Xand then returns a #defined int value which can be tested for easily.
  1089. XIn some cases untrapped alarm calls occur.  The solution is to trap (ignore)
  1090. Xalarm calls.
  1091. X.PP
  1092. XOn a mustenter field with a fldmin specified a control key (i.e. KEY_DOWN, etc.)
  1093. Xwill exit the
  1094. Xfield if that is the first key the user presses.  Once the user has tried
  1095. Xto input a value in the field even if he clears the field the control key
  1096. Xwill not exit until fldmin is inputed.
  1097. X
  1098. X.nf
  1099. XThe following example does not turn the reverse video off when you leave the field on the sun.
  1100. Xrc = GetInput (stdscr, 0, 1, &Fld, A_REVERSE, "VVVVVV.VVVVV.VV.VV.V", 
  1101. X    NORANGE, 16, 6, UPPER_AN, NOFILL, CHAR, NOAUTO, MUSTENTER, 
  1102. X    ERRROW, MSGROW, "Please enter niu location.", "cfgsrn.hlp", NOTAG);
  1103. X.fi
  1104. X
  1105. X.PP
  1106. XA core dump of (DisPrmpt at line 37) indicates the string was not null terminated.
  1107. X
  1108. X..PP
  1109. XIf a range is given on a field and a invalid range is inputed and then you
  1110. Xclear the field you are unable to exit field.
  1111. SHAR_EOF
  1112. chmod 0644 utilities.d/libgeti.d/GetInput.3X || echo "restore of utilities.d/libgeti.d/GetInput.3X fails"
  1113. echo "x - extracting utilities.d/libgeti.d/RingMenu.3 (Text)"
  1114. sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/RingMenu.3 &&
  1115. X. \ @(#)RingMenu.3    1.1 DeltaDate 1/22/90 ExtrDate 1/22/90 
  1116. X.po 6
  1117. X.TH RINGMENU 3L
  1118. X.SH NAME
  1119. XRingMenu \- Produce a Ring Menu.
  1120. X
  1121. X.SH SYNOPSIS
  1122. X.B "int RingMenu ( win, line, optNum, title, optTable )"
  1123. X.B "WINDOW *win ;"
  1124. X.B "unsigned short line, optNum ;"
  1125. X.B "char *title, *optTable[][2] ;"
  1126. X
  1127. X.SH DESCRIPTION
  1128. XRingMenu accepts a two dimensional pointers arrary, optTable, as specification to display a ring 
  1129. Xmenu.  OptTable[][0] is the option name, while optTable[][1] is the description for the option.  The 
  1130. Xlast pair of entry in OpTable must be NULL to signify the end of the menu.  The optNumth option is 
  1131. Xhighlighted, or the first item will be highlighted if optNum is 0.  The ring menu will be displayed on 
  1132. Xwindow win on line number line.  Description for option is displayed on the line+1 line.  An option-
  1133. Xal title may be displayed to the left of the ring menu or NULL may be passed if no title is desired..
  1134. X
  1135. XUser may use the arrow keys, or the equivalent control keys to move the highlighted option, and then 
  1136. Xhit the RETURN key to select the desired option.  Or a capital letter match may also select a particu-
  1137. Xlar option, there is no need to hit RETURN in this case.
  1138. X
  1139. XRingMenu accepts at most 20 options.
  1140. X
  1141. X.SH AUTHOR
  1142. XSam S. Lok
  1143. X
  1144. X.SH RETURN VALUES
  1145. XThe position number of the selected option.  The first option being 1.
  1146. X
  1147. X.SH DIAGNOSTICS
  1148. XNone.
  1149. X
  1150. X.SH EXAMPLES
  1151. X    short    option = 1 ;
  1152. X
  1153. X    static    char    *emp_menu[][2] = {    /* The menu */
  1154. X        { "Query",    "Query existing employee" },
  1155. X        { "Add",    "Add new employee" },
  1156. X        { "Change",    "Update existing employee" },
  1157. X        { "Delete",    "Delete existing employee" },
  1158. X        { "Print",    "Screen dump to printer" },
  1159. X        { "Exit",    "Return to menu" },
  1160. X        { NULL,    NULL } 
  1161. X    } ;
  1162. X
  1163. X    option = RingMenu( stdscr, ERRLINE, option, "Employee:", emp_menu ) ;
  1164. X
  1165. X.SH FILES
  1166. XNone.
  1167. X
  1168. X.SH SEE ALSO
  1169. Xmenu(1L), popmenu(3L), GetInput(3L).
  1170. X
  1171. X.SH WARNINGS
  1172. XRingMenu ignores options more than 20.
  1173. XRingMenu.c makes uses of GetInput(3L)'s GetInput.h, keys.h, ShowHelp() and ScrnPrnt(), other-
  1174. Xwise, it is very much self contained.
  1175. SHAR_EOF
  1176. chmod 0444 utilities.d/libgeti.d/RingMenu.3 || echo "restore of utilities.d/libgeti.d/RingMenu.3 fails"
  1177. echo "x - extracting utilities.d/libgeti.d/ShowHelp.3 (Text)"
  1178. sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/ShowHelp.3 &&
  1179. X. \ %W% DeltaDate %G% ExtrDate %H% 
  1180. X.po 6
  1181. X.TH SHOWHELP 3 "libgeti"
  1182. X
  1183. X.SH NAME
  1184. XShowHelp \- creates and displays a help window using curses
  1185. X
  1186. X.SH SYNOPSIS
  1187. X.B "void  ShowHelp (help_file_name, tag, error_row)
  1188. X.br
  1189. X.B "char    help_file_name[];"
  1190. X.br
  1191. X.B "char    tag[];"
  1192. X.br
  1193. X.B "int    error_row;"
  1194. X
  1195. X.SH \s9DESCRIPTION\s0
  1196. X.B ShowHelp
  1197. Xsearches the \fIhelp_file_name\fP for the specified \fItag\fP, creates and
  1198. Xcenters a curses window on the screen.  Then displays the content of the tag
  1199. Xin the window.  The size of the help window is automatically adjusted to the 
  1200. Xsize of message to be displayed.
  1201. X
  1202. X.SS ARGUMENTS
  1203. X.TP 6
  1204. Xhelp_file_name
  1205. XThe unix file name containing the help message to be displayed.
  1206. X.TP 6
  1207. Xtag
  1208. XThe tag in the help file that contains the help message to be displayed.
  1209. X.TP 6
  1210. Xerror_row
  1211. XThe row on the screen (stdscr) to display any error messages.
  1212. X
  1213. X.SH HELP FILE SYNTAX
  1214. XA help file may consist of multiple help tags.  Any text found outside a helptag
  1215. Xis ignored.  See the following example.
  1216. X
  1217. X.nf
  1218. X\fBhelptag\fP
  1219. X[ .TITLE  A optional Title line goes here. ]
  1220. XI put any help message for the user between the tags.  
  1221. XIt can be any length as it will be displayed one screen 
  1222. Xat a time.
  1223. XThe following screen attributes may be used:
  1224. X\\S  =  Standout
  1225. X\\B  =  Bold
  1226. X\\U  =  Underline
  1227. X\\D  =  Dim
  1228. X\\R  =  Reverse video
  1229. X\\L  =  Blink
  1230. X\\N  =  Normal (reset)
  1231. X
  1232. X\\BThis text is in bold face.  \\NBack in normal mode.
  1233. X\fBhelptag\fP
  1234. X
  1235. X
  1236. XThe \fITABLE_OF_CONTENTS\fP tagname is a special tag describing what
  1237. Xis to be contained in the table of contents menu.  The following is the
  1238. Xsyntax for this tagname.
  1239. XTABLE_OF_CONTENTS
  1240. Xhelpfile   tagname   description
  1241. XTABLE_OF_CONTENTS
  1242. X
  1243. X
  1244. X\fBhelp\fP
  1245. X .TITLE Using Help
  1246. XHelp displays consist of a description displayed in a window.
  1247. XIf the description doesn't fit in the window, the Up Arrow and
  1248. XDown Arrow keys can be used to view a few more lines of the 
  1249. Xdisplay.  Exiting the help system will return the display to 
  1250. Xthe state it was in when you asked for help.
  1251. X
  1252. X   The following keys are active in help:
  1253. X        KEY_CANCEL  (esc)   Exit help.
  1254. X        KEY_DOWN  (^j)      View a few more lines.
  1255. X        KEY_UP  (^k)        View the previous lines.
  1256. X        KEY_BEG  (^b)       Display first page.
  1257. X        KEY_END  (^e)       Display last page.
  1258. X        KEY_TOC  (^t)       Display table of contents.
  1259. X\fBhelp\fP
  1260. X.fi
  1261. X
  1262. X.SH AUTHOR
  1263. XPaul J. Condie         2/89
  1264. X.br
  1265. X{ihnp4,lll-crg,qantel,pyramid}!ptsfa!pbody!pcbox!pjc
  1266. X
  1267. X.SH SEE ALSO
  1268. Xcurses(3X).
  1269. SHAR_EOF
  1270. chmod 0644 utilities.d/libgeti.d/ShowHelp.3 || echo "restore of utilities.d/libgeti.d/ShowHelp.3 fails"
  1271. echo "x - extracting utilities.d/libgeti.d/drawbox.3 (Text)"
  1272. sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/drawbox.3 &&
  1273. X. \ @(#)drawbox.3    1.2 DeltaDate 1/22/90 ExtrDate 1/22/90 
  1274. X.po 6
  1275. X.TH DRAWBOX 3 "libgeti"
  1276. X
  1277. X.SH NAME
  1278. Xdrawbox \- draws a box in a curses window
  1279. X
  1280. X.SH SYNOPSIS
  1281. X.B #define    DumbLine    1
  1282. X.br
  1283. X.B #define    StandoutLine    2
  1284. X.br
  1285. X.B #define    SingleLine    3    /* alternate character line */
  1286. X.br
  1287. X.B #define    MosaicLine    4    /* alternate character line */
  1288. X.br
  1289. X.B #define    DiamondLine    5    /* alternate character line */
  1290. X.br
  1291. X.B #define    DotLine        6    /* alternate character line */
  1292. X.br
  1293. X.B #define    PlusLine    7    /* alternate character line */
  1294. X
  1295. Xextern int    KeyHelp;
  1296. X
  1297. X.B "void  drawbox (win, from_row, from_col, to_row, to_col, trythis, trythat, vscroll, help)"
  1298. X.br
  1299. X.B "WINDOW    *win;"
  1300. X.br
  1301. X.B "int    from_row;"
  1302. X.br
  1303. X.B "int    from_col;"
  1304. X.br
  1305. X.B "int    to_row;"
  1306. X.br
  1307. X.B "int    to_col;"
  1308. X.br
  1309. X.B "int    trythis;"
  1310. X.br
  1311. X.B "int    trythat;"
  1312. X.br
  1313. X.B "int    vscroll;"
  1314. X.br
  1315. X.B "int    help;"
  1316. X
  1317. X.SH DESCRIPTION
  1318. X.B Drawbox
  1319. Xdraws a box within a curses window.  This is similar to the box(3X) function
  1320. Xin curses, but provides more flexibility in where to draw the box and what
  1321. Xthe box should look like.
  1322. X
  1323. X.SS ARGUMENTS
  1324. X.TP 6
  1325. Xwin
  1326. XThe curses window to draw the box in.
  1327. X.TP 6
  1328. Xfrom_row, from_col, to_row, to_col
  1329. XDimensions of the box.  Upper left corner and lower right corner of the box.
  1330. XTo draw a box around the whole window (like box(3) does) 
  1331. Xtry: \fI1,1, LINES,COLS\fP as the box dimensions.
  1332. X.TP 6
  1333. Xtrythis
  1334. XWhat line type to try first.  Any one of the #defines shown above.  
  1335. XIf the terminal
  1336. Xdoes not support alternate character lines then drawbox will \fItrythat\fP line.
  1337. X.TP 6
  1338. Xtrythat
  1339. XWhat line to use if trythis doesn't work.  This should not be a
  1340. Xalternate character line.
  1341. X.TP 6
  1342. Xvscroll
  1343. XIf TRUE vertical scroll bars will be drawn in the right side of the box.
  1344. X.TP 6
  1345. Xhelp
  1346. XIf TRUE the help key (KeyHelp) will be displayed in the lower right corner 
  1347. Xof the box to indicate help is available.
  1348. X
  1349. X.SH AUTHOR
  1350. XPaul J. Condie         7/87
  1351. X.br
  1352. X{ihnp4,lll-crg,qantel,pyramid}!ptsfa!pbody!pcbox!pjc
  1353. X
  1354. X.SH EXAMPLE
  1355. X.nf
  1356. X#include    <curses.h>
  1357. X
  1358. X
  1359. Xmain ()
  1360. X{
  1361. X    drawbox (stdscr, 1,1, LINES,COLS, SingleLine, StandoutLine, TRUE, TRUE);
  1362. X}
  1363. X.fi
  1364. X
  1365. X.SH SEE ALSO
  1366. Xcurses(3X).
  1367. SHAR_EOF
  1368. chmod 0444 utilities.d/libgeti.d/drawbox.3 || echo "restore of utilities.d/libgeti.d/drawbox.3 fails"
  1369. echo "x - extracting utilities.d/libgeti.d/popmenu.3 (Text)"
  1370. sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/popmenu.3 &&
  1371. X.po 6
  1372. X.TH POPMENU 3 "libgeti"
  1373. X
  1374. X.SH NAME
  1375. Xpopmenu \- runs a popup type menu
  1376. X
  1377. X.SH SYNOPSIS
  1378. X.B #define    NEWMENU        0
  1379. X.br
  1380. X.B #define    CREATEMENU    -2
  1381. X.br
  1382. X.B #define    DIMWINDOW    -1
  1383. X.br
  1384. X.br
  1385. X.B extern int    KeyHelp;
  1386. X.br
  1387. X.B extern int    KeyCancel;
  1388. X.br
  1389. X.B extern int    KeyUp;
  1390. X.br
  1391. X.B extern int    KeyDown;
  1392. X.br
  1393. X
  1394. X.B "int  popmenu (menu_id)"
  1395. X.br
  1396. X.B "int        menu_id;"
  1397. X
  1398. X.SH \s9DESCRIPTION\s0
  1399. X.B Popmenu
  1400. Xis a generic curses popup menu program.  The synopsis of popmenu will vary
  1401. Xdepending on whether you are initializing a new menu or running
  1402. Xa previously defined menu.  The above synopsis will run menu (menu_id)
  1403. Xthat you have previously defined.
  1404. X.PP
  1405. XPopmenu will return the number (counting from the top of the menu)
  1406. Xof the item selected.  If the user selected the second item in the menu
  1407. Xthen \fIpopmenu\fP will return (2).
  1408. X.br
  1409. XA negative return value indicates the user canceled the selection.
  1410. X.PP
  1411. XAfter you run a menu you will need to touchwin(stdscr); wrefresh(stdscr);
  1412. Xin order to remove the popmenu from the screen.
  1413. X.PP
  1414. XThe KeyCancel defines the key where the user does not want to make any
  1415. Xchoice.  The KeyHelp defines what key is to display the help.  The KeyUp and
  1416. XKeyDown inaddition to the curses arrow key move the select bar up and down.
  1417. X
  1418. X.SH DEFINE NEW MENU
  1419. X.B "popmenu (action, menu_id, row, column, title, helpfile, win_size, sizeof( option_base ), option_base )"
  1420. X.br
  1421. X.B "int    action;"
  1422. X.br
  1423. X.B "int    menu_id;"
  1424. X.br
  1425. X.B "int    row;"
  1426. X.br
  1427. X.B "int    column;"
  1428. X.br
  1429. X.B "char    *title;"
  1430. X.br
  1431. X.B "char    *helpfile;"
  1432. X.br
  1433. X.B "int    win_size;"
  1434. X.br
  1435. X.B "char    *option_base;"
  1436. X.br
  1437. X     or
  1438. X.br
  1439. X.B "char    **option_base;"
  1440. X
  1441. X.SS ARGUMENTS
  1442. X.TP 6
  1443. Xaction
  1444. XNEWMENU - tells popmenu that you want to initialize a new menu.
  1445. XIf one already exists for this menu_id it will be deleted and then recreated
  1446. Xfrom the new list.
  1447. X.br
  1448. X
  1449. XCREATEMENU - If a menu already exists for this menu_id then this flag has
  1450. Xno effect.  Otherwise, it initializes a new menu from the list provided.
  1451. X
  1452. XDIMWINDOW - Dims the reverse video box around the menu.
  1453. X.br
  1454. Xpopmenu (DIMWINDOW, menu_id);
  1455. X.TP 6
  1456. Xmenu_id
  1457. XA unique identifier that you chose to be assiciated with a menu.
  1458. XYou use this identifier to run the menu.
  1459. X.TP 6
  1460. Xrow, column
  1461. XThe upper left corner of where you want the menu box to popup at.
  1462. X.TP 6
  1463. Xtitle
  1464. XTitle to be centered on the first row of the menu.  If title is null no title
  1465. SHAR_EOF
  1466. echo "End of part 10"
  1467. echo "File utilities.d/libgeti.d/popmenu.3 is continued in part 11"
  1468. echo "11" > s2_seq_.tmp
  1469. exit 0
  1470.