home *** CD-ROM | disk | FTP | other *** search
- From: pjc@pcbox.UUCP (Paul J. Condie)
- Newsgroups: alt.sources
- Subject: menu(1) part 11 of 14
- Message-ID: <445@pcbox.UUCP>
- Date: 26 Dec 90 20:14:25 GMT
-
-
- #!/bin/sh
- # this is part 11 of a multipart archive
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file utilities.d/libgeti.d/drawbox.c continued
- #
- CurArch=11
- if test ! -r s2_seq_.tmp
- then echo "Please unpack part 1 first!"
- exit 1; fi
- ( read Scheck
- if test "$Scheck" != $CurArch
- then echo "Please unpack part $Scheck next!"
- exit 1;
- else exit 0; fi
- ) < s2_seq_.tmp || exit 1
- echo "x - Continuing file utilities.d/libgeti.d/drawbox.c"
- sed 's/^X//' << 'SHAR_EOF' >> utilities.d/libgeti.d/drawbox.c
- X break;
- X
- X case StandoutLine:
- X /* draw a standout line */
- X attribute = A_STANDOUT;
- X vchar = ' ';
- X hchar = ' ';
- X tlchar = ' ';
- X trchar = ' ';
- X brchar = ' ';
- X blchar = ' ';
- X break;
- X
- X case SingleLine:
- X /* attempt to draw a graphic single line */
- X vchar = 'x';
- X hchar = 'q';
- X tlchar = 'l';
- X trchar = 'k';
- X brchar = 'j';
- X blchar = 'm';
- X break;
- X
- X case MosaicLine:
- X vchar = 'a';
- X hchar = 'a';
- X tlchar = 'a';
- X trchar = 'a';
- X brchar = 'a';
- X blchar = 'a';
- X break;
- X
- X case DiamondLine:
- X vchar = '`';
- X hchar = '`';
- X tlchar = '`';
- X trchar = '`';
- X brchar = '`';
- X blchar = '`';
- X break;
- X
- X case DotLine:
- X vchar = '~';
- X hchar = '~';
- X tlchar = '~';
- X trchar = '~';
- X brchar = '~';
- X blchar = '~';
- X break;
- X
- X case PlusLine:
- X vchar = 'n';
- X hchar = 'n';
- X tlchar = 'n';
- X trchar = 'n';
- X brchar = 'n';
- X blchar = 'n';
- X break;
- X
- X default:
- X return;
- X }
- X
- X#ifdef BSD
- X standout ();
- X#else
- X wattrset (win, attribute);
- X#endif
- X for (row = frow-1; row <= trow-1; row++)
- X {
- X if (row == frow-1 || row == trow-1)
- X for (col = fcol-1; col <= tcol-1; col++)
- X mvwaddch (win, row, col, hchar);
- X else
- X {
- X mvwaddch (win, row, fcol-1, vchar);
- X mvwaddch (win, row, tcol-1, vchar);
- X }
- X }
- X /* draw the corners */
- X mvwaddch (win, frow-1,fcol-1, tlchar); /* top left */
- X mvwaddch (win, frow-1,tcol-1, trchar); /* top right */
- X mvwaddch (win, trow-1,fcol-1, blchar); /* bottom left */
- X mvwaddch (win, trow-1,tcol-1, brchar); /* bottom right */
- X
- X /* draw vertical scroll bars */
- X if (vscroll)
- X {
- X /*
- X * Make sure we have a good percentage. We'll bottom
- X * the elevator if the percentage is out of range.
- X */
- X if ( percent < 0.0 || percent > 1.0 ) /* < 0 = no elevator */
- X percent = 1.0 ; /* > 1 = undefined */
- X /*
- X * The weird calculation here is because I want to fit the
- X * elevator within the window top and bottom boundary. And
- X * calculating the relative position for the *bottom* of
- X * the elevator. If you still don't get it, don't ask!
- X */
- X mvwaddch (win, frow+(int)((trow-frow-3)*percent) ,tcol-1, '^');
- X mvwaddch (win, frow+(int)((trow-frow-3)*percent)+1,tcol-1, 'v');
- X }
- X if (help)
- X {
- X wattrset (win, A_STANDOUT);
- X if (isprint(KeyHelp))
- X mvwprintw (win, trow-1,tcol-6, "Help %c", KeyHelp);
- X else
- X mvwprintw (win, trow-1,tcol-7, "Help %c", KeyHelp);
- X }
- X
- X#ifdef BSD
- X standend ();
- X#else
- X wattrset (win, A_NORMAL);
- X#endif
- X}
- X/* Paul J. Condie 10/88 */
- SHAR_EOF
- echo "File utilities.d/libgeti.d/drawbox.c is complete"
- chmod 0644 utilities.d/libgeti.d/drawbox.c || echo "restore of utilities.d/libgeti.d/drawbox.c fails"
- echo "x - extracting utilities.d/libgeti.d/findfile.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/findfile.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "%W% DeltaDate %G% ExtrDate %H%";
- X#endif
- X
- X/* Function findfile()
- X** Search through a number of directories looking for a file
- X** RETURNS a pointer to the file with the directory if found
- X** otherwise returns a null pointer.
- X*/
- X
- X#include <stdio.h>
- X#include <varargs.h>
- X#include <sys/types.h>
- X#include <sys/stat.h>
- X
- X/*VARARGS*/
- Xchar *findfile (va_alist)
- X va_dcl
- X{
- X va_list ap;
- X char *filename;
- X char *directory;
- X static char file[200];
- X char *fileptr;
- X struct stat buf;
- X int rc;
- X
- X va_start (ap);
- X fileptr = file;
- X
- X /* get filename to search for */
- X if ((filename = va_arg (ap, char *)) == (char *)0)
- X {
- X va_end (ap);
- X return ((char *)0);
- X }
- X
- X if (strcmp (filename, "") == 0)
- X {
- X va_end (ap);
- X return ("");
- X }
- X
- X /* loop through each directory looking for file */
- X while (1)
- X {
- X directory = va_arg (ap, char *);
- X /* getenv() returns a null */
- X if (directory == (char *)0)
- X continue;
- X if (strcmp (directory, "") == 0)
- X break;
- X sprintf (file, "%s/%s", directory, filename);
- X if (stat (file, &buf) == 0)
- X {
- X va_end (ap);
- X return (fileptr);
- X }
- X }
- X va_end (ap);
- X return ("");
- X}
- X/* Paul J. Condie 10/88 */
- SHAR_EOF
- chmod 0644 utilities.d/libgeti.d/findfile.c || echo "restore of utilities.d/libgeti.d/findfile.c fails"
- echo "x - extracting utilities.d/libgeti.d/getmmddyy.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/getmmddyy.c &&
- X/*
- X** getmmddyy()
- X** Takes a string and a date mask as arguments and returns
- X** the month, day, year using the mask.
- X*/
- X
- X
- X#include <stdio.h>
- X#include <time.h>
- X#include "GetInput.h"
- X
- Xgetmmddyy (str, mask, month, day, year)
- X char *str;
- X char *mask;
- X int *year, *month, *day;
- X{
- X char cmdstr[5] ;
- X static int century = 0 ;
- X long clock;
- X
- X struct tm *localtime(), *Tm ;
- X
- X if (century == 0) {
- X
- X clock = time((long *) 0) ;
- X Tm = localtime (&clock) ;
- X century = 1900 ;
- X if (Tm->tm_year > 100)
- X century += (Tm->tm_year / 100) * 100 ;
- X
- X }
- X
- X if (mask == NULL) {
- X
- X cmdstr[0] = *str++ ;
- X cmdstr[1] = *str++ ;
- X cmdstr[2] = '\0' ;
- X *month = atoi (cmdstr) ;
- X
- X cmdstr[0] = *str++ ;
- X cmdstr[1] = *str++ ;
- X cmdstr[2] = '\0' ;
- X *day = atoi (cmdstr) ;
- X
- X cmdstr[0] = *str++ ;
- X cmdstr[1] = *str++ ;
- X cmdstr[2] = '\0' ;
- X *year = atoi (cmdstr) + century ;
- X
- X } else {
- X
- X while ( *mask != '\0' ) {
- X
- X while ( *mask != 'M' && *mask != 'D' && *mask != 'Y' )
- X mask++ ;
- X
- X switch (*mask) {
- X case 'M':
- X cmdstr[0] = *str++ ;
- X cmdstr[1] = *str++ ;
- X cmdstr[2] = '\0' ;
- X *month = atoi (cmdstr) ;
- X mask += 2 ;
- X break ;
- X case 'D':
- X cmdstr[0] = *str++ ;
- X cmdstr[1] = *str++ ;
- X cmdstr[2] = '\0' ;
- X *day = atoi (cmdstr) ;
- X mask += 2 ;
- X break ;
- X case 'Y':
- X cmdstr[0] = *str++ ;
- X cmdstr[1] = *str++ ;
- X mask += 2 ;
- X if (*mask == 'Y') {
- X cmdstr[2] = *str++ ;
- X cmdstr[3] = *str++ ;
- X cmdstr[4] = '\0' ;
- X *year = atoi (cmdstr) ;
- X mask += 2 ;
- X } else {
- X cmdstr[2] = '\0' ;
- X *year = atoi (cmdstr) + century ;
- X }
- X break ;
- X }
- X }
- X }
- X}
- SHAR_EOF
- chmod 0644 utilities.d/libgeti.d/getmmddyy.c || echo "restore of utilities.d/libgeti.d/getmmddyy.c fails"
- echo "x - extracting utilities.d/libgeti.d/popmenu.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/popmenu.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "%W% DeltaDate %G% ExtrDate %H%";
- X#endif
- X
- X#include <curses.h>
- X#include <term.h>
- X#include <varargs.h>
- X
- X#define MAXMENUS 10
- X#define MAXITEMS 200
- X#define NEWMENU 0
- X#define DIMWINDOW -1
- X#define CREATEMENU -2 /* only if it does not exist */
- X#define WRAPAROUND TRUE
- X#define DumbLine 1 /* A_NORMAL */
- X#define StandoutLine 2 /* A_STANDOUT */
- X#define SingleLine 3 /* A_ALTCHARSET */
- X
- X#ifndef KEY_RETURN
- X# define KEY_RETURN '\r'
- X#endif
- X#ifndef KEY_HELP
- X# define KEY_HELP 0553
- X#endif
- X#ifndef KEY_CANCEL
- X# define KEY_CANCEL 0543
- X#endif
- X#ifndef KEY_DOWN
- X# define KEY_DOWN 0402
- X#endif
- X#ifndef KEY_UP
- X# define KEY_UP 0403
- X#endif
- X#ifndef KEY_REFRESH
- X# define KEY_REFRESH 565
- X#endif
- X
- Xextern int KeyDown;
- Xextern int KeyUp;
- Xextern int KeyHelp;
- Xextern int KeyCancel;
- Xextern int KeyRedraw;
- Xextern int KeyReturn;
- Xextern int KeyBackspace;
- Xextern int KeyIC;
- X
- Xtypedef struct _menu
- X{
- X int MenuId; /* numerical menu identifier */
- X int row;
- X int col;
- X char *title ; /* menu title */
- X char *helpfile; /* helpfile */
- X int winSize ; /* pop up window length */
- X WINDOW *win;
- X int NumItems; /* number of items in menu */
- X int width; /* largest item */
- X char *items[MAXITEMS+1];
- X int ActiveItem; /* last item selected */
- X int FullMatch; /* matching stype
- X TRUE = full string matching
- X FALSE = single 1st char matching */
- X} MENU;
- X
- X
- Xstatic MENU *THEmenu[MAXMENUS+1];
- Xstatic char promptStr[80] ;
- X
- X/*VARARGS*/
- Xpopmenu (va_alist)
- X
- X va_dcl
- X{
- X va_list ap;
- X int action;
- X int MenuId;
- X static int midx = -1; /* defined menus */
- X char *ws; /* base address of table */
- X char **wws; /* base address of table */
- X int wssize; /* size of one element */
- X /* or 0 if **wws is used */
- X register int i, j;
- X int rc; /* return code */
- X int idx; /* tmp menu index */
- X int NewMenu; /* New Menu Flag */
- X static int _runMenu();
- X char *idontknow; /* was a promptStr supplied */
- X
- X
- X va_start (ap);
- X action = va_arg (ap, int);
- X
- X switch (action)
- X {
- X /*
- X ** Initialize a new popup menu
- X */
- X case NEWMENU:
- X case CREATEMENU:
- X MenuId = va_arg (ap, int);
- X
- X /* do we already have this MenuId */
- X NewMenu = TRUE;
- X for (i = 0; i <= midx; i++)
- X if (THEmenu[i]->MenuId == MenuId)
- X {
- X /* Menu already exists */
- X NewMenu = FALSE;
- X if (action == CREATEMENU)
- X break; /* don't re-create it */
- X
- X /* junk old menu */
- X delwin (THEmenu[i]->win);
- X free (THEmenu[i]);
- X idx = i;
- X break;
- X }
- X if (NewMenu == FALSE && action == CREATEMENU)
- X {
- X va_end (ap);
- X break;
- X }
- X if (NewMenu == TRUE)
- X idx = ++midx;
- X
- X
- X /* build the new menu */
- X THEmenu[idx] = (MENU *)malloc (sizeof(MENU));
- X THEmenu[idx]->MenuId = MenuId;
- X THEmenu[idx]->row = va_arg (ap, int); /* upper left corner */
- X THEmenu[idx]->col = va_arg (ap, int);
- X THEmenu[idx]->title = va_arg (ap, char *);
- X THEmenu[idx]->helpfile = va_arg (ap, char *);
- X if (THEmenu[idx]->helpfile != (char *)NULL &&
- X strcmp (THEmenu[idx]->helpfile, "") == 0)
- X THEmenu[idx]->helpfile = (char *)NULL;
- X THEmenu[idx]->winSize = va_arg (ap, int);
- X THEmenu[idx]->NumItems = 0;
- X THEmenu[idx]->width = strlen (THEmenu[idx]->title);
- X wssize = va_arg (ap, int); /* size of one element */
- X /* for char array, ws is used, otherwise, wws is used for
- X ** char *array.
- X */
- X if ( wssize > 0 )
- X {
- X ws = va_arg (ap, char *); /* base address of table */
- X while (*ws != NULL)
- X {
- X THEmenu[idx]->items[THEmenu[idx]->NumItems] = ws ;
- X THEmenu[idx]->NumItems++;
- X if (strlen(ws) > THEmenu[idx]->width)
- X THEmenu[idx]->width = strlen(ws);
- X ws += wssize ;
- X }
- X }
- X else /* this is basically dup code as above */
- X {
- X wws = va_arg (ap, char **); /* base address of table */
- X while (*wws != NULL)
- X {
- X THEmenu[idx]->items[THEmenu[idx]->NumItems] = *wws ;
- X THEmenu[idx]->NumItems++;
- X if (strlen(*wws) > THEmenu[idx]->width)
- X THEmenu[idx]->width = strlen(*wws);
- X wws++ ;
- X }
- X }
- X THEmenu[idx]->FullMatch = va_arg (ap, int); /* matching style */
- X
- X /*
- X * adjust length of popmenu
- X */
- X if (THEmenu[idx]->winSize <= 0) /* default length */
- X THEmenu[idx]->winSize = 6;
- X /* not enough items? */
- X if (THEmenu[idx]->winSize > THEmenu[idx]->NumItems )
- X THEmenu[idx]->winSize = THEmenu[idx]->NumItems ;
- X /* roll off bottom of screen? */
- X if ( THEmenu[idx]->winSize > LINES-THEmenu[idx]->row-2 )
- X THEmenu[idx]->winSize = LINES - THEmenu[idx]->row - 2 ;
- X
- X /*
- X * adjust the starting col of popmenu if the menu
- X * will roll off the right edge of screen
- X * NOTE: col is 0 offset while width is not
- X */
- X if ( THEmenu[idx]->col > COLS-THEmenu[idx]->width-4 )
- X THEmenu[idx]->col = COLS - THEmenu[idx]->width - 4 ;
- X
- X va_end (ap);
- X THEmenu[idx]->ActiveItem = 1;
- X
- X THEmenu[idx]->win = newwin (THEmenu[idx]->winSize+2,
- X THEmenu[idx]->width+4,
- X THEmenu[idx]->row, THEmenu[idx]->col);
- X
- X keypad (THEmenu[idx]->win, TRUE);
- X rc = 0; /* 0 return code */
- X break;
- X
- X case DIMWINDOW:
- X MenuId = va_arg (ap, int);
- X va_end (ap);
- X
- X for (i = 0; i <= midx; i++)
- X if (THEmenu[i]->MenuId == MenuId)
- X {
- X drawbox( THEmenu[i]->win, 1, 1,
- X THEmenu[i]->winSize+2,
- X THEmenu[i]->width+4,
- X SingleLine, DumbLine,
- X (THEmenu[i]->winSize >= 4 &&
- X THEmenu[i]->NumItems >
- X THEmenu[i]->winSize),
- X 0,
- X (float)-1 ) ;
- X mvwprintw (THEmenu[i]->win, 0,
- X ((THEmenu[i]->width+4-
- X strlen(THEmenu[i]->title))/2),
- X "%s", THEmenu[i]->title);
- X wrefresh (THEmenu[i]->win);
- X break;
- X }
- X break;
- X
- X default:
- X /*
- X ** Lets try to run a menu
- X */
- X MenuId = action;
- X
- X /* Find the menu. */
- X for (i = 0; i <= midx; i++)
- X if (MenuId == THEmenu[i]->MenuId)
- X break;
- X if (i > midx) return (-1); /* invalid MenuId */
- X
- X /* get default search string? */
- X idontknow = va_arg( ap, char *);
- X if (idontknow && THEmenu[i]->FullMatch )
- X {
- X strncpy( promptStr, idontknow, THEmenu[i]->width ) ;
- X promptStr[THEmenu[i]->width] = NULL ;
- X }
- X else
- X promptStr[0] = NULL ;
- X va_end (ap);
- X
- X rc = _runMenu (THEmenu[i]);
- X
- X break;
- X } /* end switch (action) */
- X return (rc);
- X}
- X
- X
- X
- X_runMenu (menu)
- X
- X MENU *menu;
- X{
- X register int ch;
- X register int fptr; /* field pointer */
- X register int i;
- X register int top;
- X register int inc;
- X char tmpStr[2] ;
- X register int firstTime = TRUE ;
- X
- X if ( ! menu->FullMatch ) /* turn off cursor? */
- X putp ( cursor_invisible ) ;
- X else
- X putp ( cursor_visible ) ;
- X inc = (int)( menu->winSize / 2 ) ; /* window increment */
- X fptr = menu->ActiveItem; /* set current item */
- X top = fptr - menu->winSize + 1 ; /* set top item of window */
- X if ( top < 1 ) top = 1 ; /* out of bound? */
- X
- X _showWin( menu, top ) ; /* Display the menu */
- X
- X while (1)
- X {
- X wattrset (menu->win, A_REVERSE);
- X mvwprintw (menu->win, fptr-top+1, 2, "%s", menu->items[fptr-1]);
- X wattrset (menu->win, A_NORMAL);
- X if ( strlen( promptStr ) )
- X wmove( menu->win, fptr-top+1, strlen( promptStr )+1 ) ;
- X else
- X wmove( menu->win, menu->winSize+1, menu->width+3 ) ;
- X touchwin (menu->win);
- X wrefresh (menu->win);
- X
- X /*
- X * The first time in, and if promptStr is filled
- X * we'll extract the last char of promptStr, chop
- X * promptStr by 1 char, so that that 1 char can
- X * be strcat()ed back to promptStr later, and we also
- X * skip the first wgetch(). This is to accomplish
- X * the initial search when entering popmenu().
- X */
- X if ( firstTime && strlen( promptStr ) )
- X {
- X ch = promptStr[ strlen( promptStr ) - 1 ] ;
- X promptStr[ strlen( promptStr ) - 1 ] = NULL ;
- X }
- X else
- X ch = wgetch (menu->win);
- X firstTime = FALSE ;
- X
- X mvwprintw (menu->win, fptr-top+1, 2, "%s", menu->items[fptr-1]);
- X
- X if (ch == KeyReturn) ch = KEY_RETURN;
- X if (ch == KeyDown) ch = KEY_DOWN;
- X if (ch == KeyUp) ch = KEY_UP;
- X if (ch == KeyHelp) ch = KEY_HELP;
- X if (ch == KeyCancel) ch = KEY_CANCEL;
- X if (ch == KeyRedraw) ch = KEY_REFRESH;
- X if (ch == KeyBackspace) ch = KEY_BACKSPACE;
- X if (ch == KeyIC) ch = KEY_IC;
- X
- X if ( ch >= 'a' && ch <= 'z' )
- X ch = toupper( ch ) ; /* deals in upper case only */
- X switch ( ch )
- X {
- X case KEY_DOWN:
- X case KEY_RIGHT:
- X promptStr[0] = NULL ;
- X fptr = (fptr >= menu->NumItems) ? 1 : ++fptr;
- X
- X /* stroll off window? */
- X if ( fptr-top+1 > menu->winSize || fptr == 1 )
- X {
- X if ( fptr == 1 )
- X top = 1 ;
- X else
- X top += inc ;
- X _showWin( menu, top ) ;
- X }
- X break;
- X
- X case KEY_UP:
- X case KEY_LEFT:
- X promptStr[0] = NULL ;
- X wrefresh( menu->win ) ;
- X fptr = (fptr <= 1) ? menu->NumItems : --fptr;
- X
- X /* stroll off window? */
- X if ( fptr == menu->NumItems || fptr < top )
- X {
- X if ( fptr == menu->NumItems && inc > 0 )
- X top = menu->NumItems - menu->winSize + 1 ;
- X else
- X top -= inc ;
- X if ( top < 1 ) top = 1 ;
- X _showWin( menu, top ) ;
- X }
- X break;
- X
- X case KEY_BACKSPACE:
- X if ( strlen( promptStr ) )
- X promptStr[ strlen( promptStr ) - 1 ] = NULL ;
- X break ;
- X
- X case KEY_IC: /* toggle between full/1st match */
- X menu->FullMatch = !menu->FullMatch ; /* XOR it */
- X promptStr[0] = NULL ;
- X wattrset (menu->win, A_STANDOUT);
- X mvwprintw( menu->win, menu->winSize+1, 0,
- X menu->FullMatch?"All":"1st" ) ;
- X wattrset (menu->win, A_NORMAL);
- X break ;
- X
- X case KEY_RETURN:
- X case KEY_ENTER:
- X menu->ActiveItem = fptr;
- X wrefresh (menu->win); /* force flush of attributes */
- X putp ( cursor_visible ) ;
- X return (menu->ActiveItem);
- X
- X case KEY_CANCEL:
- X putp ( cursor_visible ) ;
- X return (-1);
- X
- X case KEY_HELP:
- X ShowHelp (menu->helpfile, "popmenu", LINES);
- X break;
- X
- X case KEY_REFRESH:
- X clearok (menu->win, TRUE);
- X wrefresh (menu->win);
- X break;
- X
- X default:
- X /*
- X * build the entered string
- X */
- X if ( menu->FullMatch )
- X {
- X tmpStr[0] = ch ;
- X tmpStr[1] = NULL ;
- X strcat( promptStr, tmpStr ) ;
- X }
- X
- X /*
- X * Now do the matching, have fun
- X */
- X
- X /* look for first match from here on down */
- X for ( i=fptr+(menu->FullMatch?0:1);
- X i<=menu->NumItems &&
- X ( menu->FullMatch?
- X strnicmp( menu->items[i-1], promptStr,
- X strlen( promptStr ) ) :
- X toupper(*menu->items[i-1])!=ch ) ;
- X i++ ) ;
- X
- X /* no match? how about from here on up? */
- X if ( i > menu->NumItems )
- X {
- X for ( i=1; i<fptr &&
- X ( menu->FullMatch?
- X strnicmp( menu->items[i-1], promptStr,
- X strlen( promptStr ) ) :
- X toupper(*menu->items[i-1])!=ch ) ;
- X i++ ) ;
- X
- X if ( fptr == i ) /* beep if no match */
- X beep() ;
- X }
- X
- X if ( fptr != i )
- X {
- X wrefresh( menu->win ) ; /* clear the hilite */
- X fptr = i ;
- X }
- X
- X /*
- X * insure we have a match, otherwise, discard last
- X * char entered from promptStr
- X */
- X if ( menu->FullMatch &&
- X strnicmp( menu->items[fptr-1], promptStr,
- X strlen( promptStr ) ) &&
- X strlen( promptStr ) > 0 )
- X promptStr[ strlen( promptStr ) - 1 ] = NULL ;
- X
- X /* need to display a different window? */
- X if ( fptr >= top+menu->winSize || fptr < top )
- X {
- X top = fptr ;
- X _showWin( menu, top ) ;
- X }
- X break ;
- X } /* end switch (ch) */
- X }
- X}
- X
- X/* pjc 7/87 */
- X
- X_showWin( menu, top )
- X MENU *menu ;
- X int top ;
- X{
- X register int i ;
- X
- X for (i=0; i < menu->winSize && top+i-1 < menu->NumItems; i++)
- X mvwprintw (menu->win, i+1, 2, "%-*s", menu->width, menu->items[top+i-1]);
- X for (; i < menu->winSize ; i++)
- X mvwprintw (menu->win, i+1, 2, "%*s", menu->width, " ");
- X
- X drawbox( menu->win, 1, 1, menu->winSize+2, menu->width+4,
- X StandoutLine, StandoutLine,
- X (menu->winSize >= 4 && menu->NumItems > menu->winSize),
- X (menu->helpfile != (char *)NULL),
- X menu->NumItems ?
- X (float)(top+menu->winSize-1) / (float)menu->NumItems
- X : 0 );
- X
- X /* display title */
- X wattrset (menu->win, A_STANDOUT);
- X mvwprintw (menu->win, 0, ((menu->width+4)/2)-(strlen(menu->title)/2),
- X "%s", menu->title);
- X wattrset (menu->win, A_NORMAL);
- X}
- SHAR_EOF
- chmod 0644 utilities.d/libgeti.d/popmenu.c || echo "restore of utilities.d/libgeti.d/popmenu.c fails"
- echo "x - extracting utilities.d/libgeti.d/stricmp.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/stricmp.c &&
- X/* Like strcmp() [string(3C)] but ignore case */
- X#define makelower(x) (((x) >= 'A' && (x) <= 'Z') ? ((x) + ('a' - 'A')) : (x))
- Xint
- Xstricmp(s1, s2)
- Xregister char *s1, *s2;
- X{
- X register int difference;
- X
- X if(s1 == s2)
- X return(0);
- X
- X while((difference = (makelower(*s1) - makelower(*s2))) == 0) {
- X if(*s1 == '\0')
- X return(0);
- X s1++;
- X s2++;
- X }
- X
- X return(difference);
- X}
- X
- X/* Like strncmp() [string(3C)] but ignore case */
- Xint
- Xstrnicmp(s1, s2, n)
- Xregister char *s1, *s2;
- Xregister unsigned n;
- X{
- X register int difference;
- X
- X if(s1 == s2 || n == 0)
- X return(0);
- X
- X while((difference = (makelower(*s1) - makelower(*s2))) == 0) {
- X if(*s1 == '\0' || --n == 0)
- X return(0);
- X s1++;
- X s2++;
- X }
- X
- X return(difference);
- X}
- X
- X
- X#ifdef TESTMODE
- X#include <stdio.h>
- Xmain()
- X{
- X extern void exit();
- X char string[2][BUFSIZ], number[BUFSIZ];
- X int n;
- X
- X while(1) {
- X fputs("Enter 1st string: ", stdout);
- X if(fgets(string[0], BUFSIZ, stdin) == NULL) {
- X fputs("\nBye.\n", stdout);
- X exit(0);
- X }
- X string[0][strlen(string[0])-1]='\0';
- X fputs("Enter 2nd string: ", stdout);
- X if(fgets(string[1], BUFSIZ, stdin) == NULL)
- X *string[1]='\0';
- X else
- X string[1][strlen(string[1])-1]='\0';
- X fputs("Enter number: ", stdout);
- X if(fgets(number, BUFSIZ, stdin) == NULL)
- X n = 0;
- X else
- X n = atoi(number);
- X printf("strcmp(%s,%s) = %d\n",
- X string[0], string[1], strcmp(string[0], string[1]));
- X printf("stricmp(%s,%s) = %d\n",
- X string[0], string[1], stricmp(string[0], string[1]));
- X printf("strncmp(%s,%s,%d) = %d\n",
- X string[0], string[1], n, strncmp(string[0], string[1], n));
- X printf("strnicmp(%s,%s,%d) = %d\n",
- X string[0], string[1], n, strnicmp(string[0], string[1], n));
- X }
- X}
- X#endif
- X
- X/*
- X######################################################################
- X# This is the confidential, unpublished property of Pacific Bell. #
- X# Receipt or possession of it does not convey any rights to #
- X# divulge, reproduce, use, or allow others to use it without the #
- X# specific written authorization of Pacific Bell and use must #
- X# conform strictly to the license agreement between user and #
- X# Pacific Bell. #
- X# Copyright (C) 1988 Pacific Bell #
- X######################################################################
- X*/
- X#ifndef lint
- Xstatic char sccsid[] = "@(#)stricmp.c UCLID 1.1";
- X#endif
- SHAR_EOF
- chmod 0666 utilities.d/libgeti.d/stricmp.c || echo "restore of utilities.d/libgeti.d/stricmp.c fails"
- echo "x - extracting utilities.d/libgeti.d/substr.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/substr.c &&
- X/* E911 Project
- X * substr()
- X *
- X * Purpose: To find a substring within a given string
- X * Args: s1: The string being searched
- X * s2: the string being searched for
- X * Return: pointer to the where the searched for string resides
- X * within the search string; otherwise NULL
- X */
- X#ifndef lint
- Xchar Sccsid[] = "@(#)substr.c 1.3 6/17/88 10/13/88";
- X#endif
- X
- X
- Xchar *substr(s1, s2)
- X char *s1;
- X char *s2;
- X{
- X char *p1, *p2;
- X
- X for ( ; *s1; s1++) {
- X if (*s1 != *s2)
- X continue;
- X p1 = s1 + 1;
- X p2 = s2 + 1;
- X while (1) {
- X if (*p2 == '\0')
- X return(s1);
- X if (*p1++ != *p2++)
- X break;
- X }
- X }
- X return((char *)0);
- X}
- X
- X
- X#ifdef LTEST
- Xmain()
- X{
- X char *strtok();
- X
- X char *s1, *s2, *s3;
- X char buffer[256];
- X
- X printf("ok\n");
- X while (gets(buffer)) {
- X s1 = strtok(buffer, " \t:\n");
- X s2 = strtok(0, " \t:\n");
- X printf("%s:%s:", s1, s2);
- X if (s1 && s2)
- X if (s3 = substr(s1, s2))
- X printf("%.*s\n", strlen(s2), s3);
- X else
- X printf("no match\n");
- X else
- X printf("invalid input\n");
- X }
- X}
- X#endif
- X
- X
- SHAR_EOF
- chmod 0666 utilities.d/libgeti.d/substr.c || echo "restore of utilities.d/libgeti.d/substr.c fails"
- echo "x - extracting utilities.d/libgeti.d/upper.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/upper.c &&
- Xchar *upper (s)
- X
- X char *s;
- X{
- X register int i;
- X static char *ws;
- X
- X ws = s;
- X while (*s)
- X {
- X if (*s >= 'a' && *s <= 'z')
- X *s = (*s + 'A' - 'a');
- X s++;
- X }
- X return (ws);
- X}
- SHAR_EOF
- chmod 0644 utilities.d/libgeti.d/upper.c || echo "restore of utilities.d/libgeti.d/upper.c fails"
- echo "x - extracting utilities.d/libgeti.d/GetInput.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/GetInput.h &&
- X#ifndef LINT
- Xstatic char ID_GetInput[] = "%W% DeltaDate %G% ExtrDate %H%";
- X#endif
- X
- X#define HOLIDAY_FILE "/usr/lib/acct/holidays"
- X
- X
- X/*
- X** Type of allowable characters
- X*/
- X
- X#define ALPHANUM ' '
- X#define ALPHA 'A'
- X#define NUMERIC '9'
- X#define SET 'E'
- X#define MENU 'M'
- X#define UPPER 'U'
- X#define UPPER_AN 'V'
- X#define HEX 'H'
- X#define STATE 'S'
- X#define ZIP 'Z'
- X#define DATE 'D'
- X#define TIME 'T'
- X#define PROTECT 'P'
- X
- X/*
- X** Adjust/Fill
- X*/
- X
- X#define NOFILL ' '
- X#define RTADJ_ZFILL 'Z'
- X#define RTADJ_BFILL 'B'
- X#define LFADJ_ZFILL 'z'
- X#define LFADJ_BFILL 'b'
- X
- X/*
- X** 'C' field types
- X*/
- X
- X#define CHAR '0'
- X#define INT '1'
- X#define SHORT '2'
- X#define LONG '3'
- X#define DOUBLE '4'
- X#define MONEY 'M'
- X#define FLOAT '5'
- X
- X/*
- X** Union to take care of a field that could be any valid
- X** 'c' field type.
- X*/
- X
- Xtypedef union FldUnion {
- X long *longVal ;
- X double *doubleVal ;
- X float *floatVal ;
- X int *intVal ;
- X short *shortVal ;
- X char *strVal ;
- X} *FldUnPointer ;
- X
- X
- X#define AUTONEXT TRUE
- X#define NOAUTO FALSE
- X
- X#define MUSTENTER TRUE
- X#define NOMUST FALSE
- X
- X#define NOHELP ""
- X#define NORANGE NULL
- X#define NOMSG NULL
- X#define NOMASK NULL
- X#define NOTAG ""
- X#define A_SAME -1 /* same as what's on the screen */
- X
- X
- X#ifndef KEY_RETURN
- X# define KEY_RETURN '\r'
- X#endif
- X#ifndef KEY_BEG
- X# define KEY_BEG 0542
- X#endif
- X#ifndef KEY_END
- X# define KEY_END 0550
- X#endif
- X#ifndef KEY_SAVE
- X# define KEY_SAVE 0571
- X#endif
- X#ifndef KEY_PRINT
- X# define KEY_PRINT 0532
- X#endif
- X#ifndef KEY_HELP
- X# define KEY_HELP 0553
- X#endif
- X#ifndef KEY_REFRESH
- X# define KEY_REFRESH 0565
- X#endif
- X#ifndef KEY_TAB
- X# define KEY_TAB '\t'
- X#endif
- X#ifndef KEY_BTAB
- X# define KEY_BTAB 0541
- X#endif
- X#ifndef KEY_CANCEL
- X# define KEY_CANCEL 0543
- X#endif
- X#ifndef KEY_ACCEPT
- X# define KEY_ACCEPT 1000
- X#endif
- X#ifndef KEY_TOC
- X# define KEY_TOC 1001
- X#endif
- X
- X#define NOKEY '\0'
- X#define KEY_CTLA '\001'
- X#define KEY_CTLB '\002'
- X#define KEY_CTLC '\003'
- X#define KEY_CTLD '\004'
- X#define KEY_CTLE '\005'
- X#define KEY_CTLF '\006'
- X#define KEY_CTLG '\007'
- X#define KEY_CTLH '\010'
- X#define KEY_CTLI '\011'
- X#define KEY_CTLJ '\012'
- X#define KEY_CTLK '\013'
- X#define KEY_CTLL '\014'
- X#define KEY_CTLM '\015'
- X#define KEY_CTLN '\016'
- X#define KEY_CTLO '\017'
- X#define KEY_CTLP '\020'
- X#define KEY_CTLQ '\021'
- X#define KEY_CTLR '\022'
- X#define KEY_CTLS '\023'
- X#define KEY_CTLT '\024'
- X#define KEY_CTLU '\025'
- X#define KEY_CTLV '\026'
- X#define KEY_CTLW '\027'
- X#define KEY_CTLX '\030'
- X#define KEY_CTLY '\031'
- X#define KEY_CTLZ '\032'
- X
- X/*
- X** Macros
- X*/
- X#define wattrOn(a, b) wattrset(a, b)
- X#define wattrOff(a) wattrset(a, 0)
- X#ifndef BELL
- X#define BELL printf ("%c", 7)
- X#endif
- X
- X#define CLEARROW(row) { \
- X int col; \
- X int tmprow; \
- X tmprow = ((row%100) == row) ? row : row/100; \
- X col = ((row%100) == row) ? 0 : row%100; \
- X for (; col<=COLS-2; col++) \
- X mvwaddch (stdscr, tmprow,col, ' '); \
- X }
- SHAR_EOF
- chmod 0644 utilities.d/libgeti.d/GetInput.h || echo "restore of utilities.d/libgeti.d/GetInput.h fails"
- echo "x - extracting utilities.d/libgeti.d/keys.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/keys.h &&
- X#ifndef LINT
- Xstatic char ID_keys[] = "%W% DeltaDate %G% ExtrDate %H%";
- X#endif
- X
- Xextern int KeyReturn;
- Xextern int KeyDown;
- Xextern int KeyUp;
- Xextern int KeyTab;
- Xextern int KeyBTab;
- Xextern int KeyAccept;
- X
- Xextern int KeyBeg;
- Xextern int KeyEnd;
- Xextern int KeyRight;
- Xextern int KeyLeft;
- Xextern int KeyBackspace;
- Xextern int KeyEOL;
- Xextern int KeyDL;
- Xextern int KeyDC;
- Xextern int KeyIC;
- X
- Xextern int KeyHelp;
- Xextern int KeyTOC;
- Xextern int KeyRedraw;
- Xextern int KeySave;
- Xextern int KeyPrint;
- Xextern int KeyCancel;
- SHAR_EOF
- chmod 0644 utilities.d/libgeti.d/keys.h || echo "restore of utilities.d/libgeti.d/keys.h fails"
- echo "x - extracting utilities.d/libgeti.d/makefile (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/makefile &&
- X# %W% DeltaDate %G% ExtrDate %H%
- X
- XTITLE = GETINPUT
- X
- XINSTALLLIB =
- XINSTALLHDR =
- XMANDIR = .
- X
- X### CFLAG settings
- X
- X### Sys5
- XCFLAGS = -O
- X### Xenix
- X#CFLAGS = -O -DM_TERMINFO -LARGE -Ml -Mlt34 -F 4000
- X
- XARFLAGS = rv
- X
- XLIBS = libgeti.a -lcurses -lc
- X
- X
- XCFILES = AdjField.c DateFun.c DisPrmpt.c FindSet.c GetSetLen.c \
- X GetInput.c IsDate.c IsFldOk.c IsMask.c IsRange.c IsState.c IsTime.c \
- X ReDispFld.c ScrnOut.c ShowChar.c ShowSet.c ShowHelp.c \
- X popmenu.c BuildMenu.c checkmask.c doinsert.c InitGetI.c drawbox.c \
- X RingMenu.c findfile.c getmmddyy.c substr.c upper.c stricmp.c
- X
- XHFILES = GetInput.h keys.h
- XMANPAGES = GetInput.3X popmenu.3 drawbox.3 ShowHelp.3
- X
- XOBJECTS =${CFILES:.c=.o}
- X
- Xinstall : libgeti.a
- X -ln libgeti.a ../../libgeti.a
- X -ln GetInput.h ../../GetInput.h
- X
- Xtest : libgeti.a _Main.o
- X $(CC) $(CFLAGS) _Main.o $(LIBS) -o test.out
- X
- Xlibgeti.a : $(OBJECTS)
- X ar $(ARFLAGS) libgeti.a $?
- X
- Xlint:
- X lint -I$(INCDIR) _Main.c $(CFILES) -lcurses > lint.out
- X
- Xprint :
- X PrintPrg $(MANPAGES) makefile $(CFILES) $(HFILES) _Main.c | lp -t$(TITLE)
- X
- Xshar:
- X shar -b GetInput.hlp $(MANPAGES) makefile $(CFILES) $(HFILES) _Main.c > libgeti.shar
- X
- Xclean :
- X rm -f *.o core libgeti.a test.out lint.out libgeti.shar \
- X ../../libgeti.a ../../GetInput.h libgeti.shar.Z
- X
- X#####
- X#####
- X
- X_Main.o: _Main.c GetInput.h keys.h
- XAdjField.o: AdjField.c GetInput.h
- XDisPrmpt.o: DisPrmpt.c GetInput.h
- XFindSet.o: FindSet.c GetInput.h
- XGetSetLen.o: GetSetLen.c GetInput.h
- XGetInput.o: GetInput.c GetInput.h keys.h
- XIsDate.o: IsDate.c GetInput.h
- XIsFldOk.o: IsFldOk.c GetInput.h
- XIsMask.o: IsMask.c GetInput.h
- XIsRange.o: IsRange.c GetInput.h
- XIsTime.o: IsTime.c GetInput.h
- XReDispFld.o: ReDispFld.c GetInput.h
- XScrnOut.o: ScrnOut.c GetInput.h
- XShowChar.o: ShowChar.c GetInput.h
- XShowSet.o: ShowSet.c GetInput.h
- SHAR_EOF
- chmod 0644 utilities.d/libgeti.d/makefile || echo "restore of utilities.d/libgeti.d/makefile fails"
- echo "x - extracting utilities.d/libgeti.d/GetInput.3X (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/GetInput.3X &&
- X. \ %W% DeltaDate %G% ExtrDate %H%
- X.TH GETINPUT 3X "libgeti"
- X.SH NAME
- XGetInput \- manages terminal input using curses
- X.SH SYNOPSIS
- X.LP
- X.nf
- X#include <curses.h>
- X#include "GetInput.h"
- X
- Xint GetInput (win, row, col, &Fld, FldAttribute, FldMask,
- X FldRange, FldLength, FldMin, FldCharType,
- X FldAdjust, FldType, FldExit, MustEnter,
- X ErrRow, MsgRow, PromptMsg, HelpFile, HelpTag)
- X
- XWINDOW *win;
- Xint row, col, FldAttrbute, FldLength, FldMin,
- X FldExit, MustEnter, ErrRow, MsgRow;
- XFldUnPointer Fld;
- Xchar *FldMask, *FldRange, FldCharType, FldAdjust,
- X FldType, *PromptMsg, HelpFile[], HelpTag[];
- X.fi
- X.SH DESCRIPTION
- XGets terminal input using curses(3X).
- XGetInput uses a field by field approach. All
- Xedits and processing are performed for that field as the user
- Xmoves from field to field. It is not a fill form methodology where
- Xall edits and processing are performed after the user has inputed
- Xa number of fields in a form.
- X
- X.SH GETTING STARTED
- XYou need to include GetInput.h in your program.
- X
- XCurses tty modes should be - cbreak(), noecho(), nonl() and
- Xkeypad () if you want to use arrow keys and the like.
- X
- XYou should trap and ignore SIGALRM (see BUGS).
- X
- X.SS Defining Keyboard Keys
- XGetInput uses a number of keyboard keys to tell it what to do.
- XA default value to the various keys is automatically assigned when you use
- Xthis library. Those default values may be changed by declaring the variable
- Xas extern in your program and assigning a new value.
- XIn addition to the default variable values, if the terminal
- Xhas an associated curses key defined (see curses.h) that key may also be used.
- XFor example, ^b (KeyBeg) is the default value to place cursor at beginning
- Xof a field but if there is a key defined for KEY_BEG, in curses, then that
- Xkey may also be used. If the value of KeyBeg and KEY_BEG are different,
- XGetInput will return the value of KEY_BEG not KeyBeg regardless of which
- Xone is pressed.
- XNot all keys may have an associated curses key.
- XThe "^" indicates press and hold the control key. A negative one disables
- Xthe key, although the associated curses key is still active.
- X.br
- XBelow is listed the InitGetI() function with the default value and the
- Xassociated curses key.
- X.nf
- X
- X/*
- X** InitGetI()
- X** Used in GetInput(3) and assign some default values.
- X*/
- X
- X#include <curses.h>
- X#include "GetInput.h"
- X
- X /* ACCEPT INPUT KEYS */
- X /* These are the only keys that will return the data inputted into your variable. */
- Xint KeyReturn = '\\r'; /* ^m KEY_RETURN */
- Xint KeyDown = 10; /* ^j KEY_DOWN */
- Xint KeyUp = 11; /* ^k KEY_UP */
- Xint KeyTab = '\\t'; /* ^i KEY_TAB */
- Xint KeyBTab = -1; /* KEY_BTAB */
- Xint KeyAccept = 1; /* ^a KEY_ACCEPT - Typically this is the key the user presses
- X to signify he/she is finished with this screen. */
- X
- X /* FIELD EDITING KEYS */
- Xint KeyBeg = 2; /* ^b KEY_BEG - Place cursor at beginning of field */
- Xint KeyEnd = 5; /* ^e KEY_END - Place cursor at end of input in field */
- Xint KeyRight = 12; /* ^l KEY_RIGHT - Forward space in field */
- Xint KeyLeft = 8; /* ^h KEY_LEFT - Backspace in field (non-destructive) */
- Xint KeyBackspace = '\\b'; /* \\b KEY_BACKSPACE - Same as KEY_LEFT */
- Xint KeyEOL = 4; /* ^d KEY_EOL - Delete from cursor to end of field */
- Xint KeyDL = 3; /* ^c KEY_DL - Clear field and home cursor */
- Xint KeyDC = 24; /* ^x KEY_DC - Delete a character */
- Xint KeyIC = 20; /* ^t KEY_IC - Toggle between type-over and insert mode */
- X
- X /* OTHER KEYS */
- Xint KeyRedraw = 18; /* ^r KEY_REFRESH - Redraw screen */
- Xint KeySave = 6; /* ^f KEY_SAVE - Save screen to a file */
- Xint KeyPrint = 16; /* ^p KEY_PRINT - Print screen to lp */
- Xint KeyCancel = 27; /* esc KEY_CANCEL - Cancel pop-up menu selection */
- Xint KeyHelp = '?'; /* KEY_HELP - Display help screen */
- X /* If the user needs to input a "?" you will have to change this. */
- Xint KeyTOC = 20; /* ^t KEY_TOC - When in help display Table of Contents */
- X
- Xvoid
- XInitGetI()
- X{
- X /*
- X ** This function sets values for keys used in GetInput. The default
- X ** values above may be changed by specifying a new value in a
- X ** file called ".menuinit". See menu(1) for more info.
- X */
- X}
- X.fi
- X
- X.SH ARGUMENT DESCRIPTION
- X.TP 6
- X*win
- XA pointer to a curses window that this routine will operate under.
- X.TP
- Xrow
- XThe row to position cursor on.
- X.TP
- Xcol
- XThe starting column for field.
- X.TP
- X&Fld
- XA pointer to a union variable where you have loaded the
- Xaddress of your memory variable to accept the input data. Upon
- Xentry to GetInput the value in your memory variable will be
- Xdisplayed as the default value. The type of union you select must be compatible
- Xwith the \fIFldType\fP you've specified.
- X
- X.nf
- XFor example:
- X union FldUnion Fld;
- X double myvar;
- X
- X Fld.doubleVal = &myvar;
- X GetInput (......);
- X
- X /*
- X ** After returning from GetInput() what the user typed in will
- X ** be in \fImyvar\fP;
- X */
- X
- X
- X
- X/*
- X** Structure of Union
- X*/
- Xtypedef union FldUnion
- X{
- X long *longVal;
- X double *doubleVal;
- X float *floatVal;
- X int *intVal;
- X short *shortVal;
- X char *strVal;
- X} *FldUnPointer;
- X.fi
- X.TP
- XFldAttrbute
- XCurses attribute you want your input field to be. For
- Xexample A_REVERSE. Refer to curses(3X) for further
- Xinformation on allowable terminal attributes.
- X.br
- XA_SAME is a special attribute that tells GetInput to use
- Xthe same attributes that is already on the screen in the
- Xfirst column of the field.
- X
- X. \ **********************************
- X.TP
- XFldMask
- XA char pointer to a mask for the field. This permits the user to mix
- Xalpha with numeric while letting GetInput do the edit checking. You can also
- Xuse this to format a field.
- X
- XThe keyword \fBNOMASK\fP may be placed here if no mask is required.
- X
- XValid masks for a field depend upon the type of field
- Xyou specify, see \fIFldCharType\fP.
- X
- XThe \fIFldLength\fP should not include character positions where no input
- Xis allowed in the mask (format characters), because format characters
- Xare not returned into \fIFld\fP. For example, \fIFldCharType = DATE,
- XFldMask = "MM/DD/YY"\fP. The "/" is a format character. The cursor
- Xwill skip over those positions in the field. Only the characters typed in
- Xthe MM DD YY positions will be in your memory variable \fIFld\fP.
- XThe FldLength would be six for this case.
- X
- XBecause the mask is so closely tied to the \fIFldCharType\fP, a complete
- Xdescription of what mask characters are valid with what field types is
- Xdescribed under
- X\fIFldCharType\fP. Any character in the mask that is not listed as a valid
- Xmask character for that field type becomes a format character.
- X. \ **********************************
- X.TP
- XFldRange
- XA char pointer to a set of valid ranges permitted for this field.
- XRanges may be specified as comma separated values ("ONE,TWO,THREE")
- Xor as a inclusive range ("1-5"), or a combination of both ("1-5,M,E").
- XRange values must be compatible with the \fIFldCharType\fP and \fIFldType\fP
- Xthat you
- Xhave selected.
- X.br
- XSome examples:
- X.nf
- X "1-10"
- X "5,10,15,16"
- X "1-10,20,M,E,32-40"
- X "CA,TX,ID"
- X.fi
- X
- XThe keyword \fBNORANGE\fP may be used if no range checking is to be
- Xperformed for this field.
- X. \ **********************************
- X.TP
- XFldLength
- XMaximum length of this field. For field types (FldCharTypes) SET and MENU
- Xthe field length is automatically set to the longest set value in the FldRange.
- X. \ **********************************
- X.TP
- XFldMin
- XIf \fIMUSTENTER\fP is selected in \fIFldExit\fP then this is the minimum
- Xrequired input. Otherwise, it is the minimum required input only if they try
- Xto input something.
- X. \ **********************************
- X.TP
- XFldCharType
- XThis argument defines edit checks to be performed on the
- Xinput characters as they are being typed in. If no mask is provided then
- Xthe field type itself determines the edit checks to be performed on all
- Xcharacters in the field.
- X.RS 6
- X.TP 11
- XALPHANUM
- XAny alpha/numeric character is allowed.
- X.br
- XValid mask characters:
- X.nf
- X space alpha/numeric
- X A alpha
- X 9 numeric
- X U upper alpha
- X V upper alpha/numeric
- X H ???
- X.fi
- X.TP
- XALPHA
- XAlpha only.
- X.br
- XValid mask characters:
- X.nf
- X A alpha
- X.fi
- X.TP
- XNUMERIC
- XNumeric only.
- X.br
- XValid mask characters:
- X.nf
- X 9 numeric
- X.fi
- X.TP
- XUPPER
- XConvert to upper case. Only alpha permitted.
- X.br
- XValid mask characters:
- X.nf
- X U upper alpha
- X.fi
- X.TP
- XUPPER_AN
- XAlpha and numeric permitted. Convert alpha characters to upper-case.
- X.br
- XValid mask characters:
- X.nf
- X V upper alpha/numeric
- X.fi
- X.TP
- XHEX
- XOnly hex characters permitted.
- X.br
- XValid mask characters:
- X.nf
- X H ???
- X space ???
- X.fi
- X.TP
- XSTATE
- XValid two character Post Office abbreviations for the fifty states.
- XA edit check is done for a valid state.
- X.br
- XValid mask characters:
- X.nf
- X SS two character state
- X S ???
- X space ???
- X.fi
- X.TP
- XZIP
- XPost Office zip code.
- X.br
- XValid mask characters:
- X.nf
- X 99999-9999 ???
- X.fi
- X.TP
- XDATE
- XA valid date.
- X.br
- XValid mask characters:
- X.nf
- X MM month (01-12)
- X DD day (01-31)
- X YY year (00-99)
- X YYYY full year with century
- X.fi
- XThe mask must contain at least MM and DD. If no mask is specified for the
- Xfield a default mask of "MMDDYY" is used.
- X.br
- XSome examples:
- X.nf
- X MMDDYY
- X MM/DD/YY
- X YY-MM-DD
- X MM DD YYYY
- X.fi
- X
- XThe \fIFldRange\fP argument may contain any of the following keywords
- X(case insensitive)
- Xand the appropriate edit will be performed (see \fIfield_range\fP for more
- Xinfo).
- X.nf
- X sun,mon,tue,wed,thr,fri,sat - validate date entered against day of week
- X No_Holidays - no holidays allowed.
- SHAR_EOF
- echo "End of part 11"
- echo "File utilities.d/libgeti.d/GetInput.3X is continued in part 12"
- echo "12" > s2_seq_.tmp
- exit 0
-