home *** CD-ROM | disk | FTP | other *** search
- From: pjc@pcbox.UUCP (Paul J. Condie)
- Newsgroups: alt.sources
- Subject: menu(1) part 8 of 14
- Message-ID: <442@pcbox.UUCP>
- Date: 26 Dec 90 20:10:56 GMT
-
-
- #!/bin/sh
- # this is part 8 of a multipart archive
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file ParseDeSrn.y continued
- #
- CurArch=8
- 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 ParseDeSrn.y"
- sed 's/^X//' << 'SHAR_EOF' >> ParseDeSrn.y
- X "\n[ParseDeSrn]<.DEFINE_SCREEN> field_mustenter");
- X fflush (stderr);
- X }
- X }
- X ;
- X | field_prompt
- X {
- X strcpy (eott, "field_prompt");
- X if (debug)
- X {
- X fprintf (stderr,
- X "\n[ParseDeSrn]<.DEFINE_SCREEN> field_prompt");
- X fflush (stderr);
- X }
- X }
- X ;
- X | field_terminator
- X {
- X strcpy (eott, "field_terminator");
- X if (debug)
- X {
- X fprintf (stderr,
- X "\n[ParseDeSrn]<.DEFINE_SCREEN> field_terminator");
- X fflush (stderr);
- X }
- X }
- X ;
- X | field_defaults
- X {
- X strcpy (eott, "field_defaults");
- X if (debug)
- X {
- X fprintf (stderr,
- X "\n[ParseDeSrn]<.DEFINE_SCREEN> field_defaults");
- X fflush (stderr);
- X }
- X }
- X ;
- X
- X | field_noinput
- X {
- X strcpy (eott, "field_noinput");
- X if (debug)
- X {
- X fprintf (stderr,
- X "\n[ParseDeSrn]<.DEFINE_SCREEN> field_noinput");
- X fflush (stderr);
- X }
- X }
- X ;
- X
- X | before_field
- X {
- X strcpy (eott, "before_field");
- X if (debug)
- X {
- X fprintf (stderr,
- X "\n[ParseDeSrn]<.DEFINE_SCREEN> before_field");
- X fflush (stderr);
- X }
- X }
- X ;
- X
- X | after_field
- X {
- X strcpy (eott, "after_field");
- X if (debug)
- X {
- X fprintf (stderr,
- X "\n[ParseDeSrn]<.DEFINE_SCREEN> after_field");
- X fflush (stderr);
- X }
- X }
- X ;
- X
- X
- Xscreen_title : SCREEN_TITLE EQUAL STRING
- X {
- X strcpy (yyscreen->title, $3);
- X }
- X | SCREEN_TITLE EQUAL EVAR
- X {
- X strcpy (yyscreen->title, $3);
- X }
- X | SCREEN_TITLE EQUAL QUOTE_STRING
- X {
- X strcpy (yyscreen->title, $3);
- X }
- X ;
- X
- Xscreen_help : SCREEN_HELP EQUAL STRING
- X {
- X strcpy (yyscreen->helpfile, $3);
- X }
- X | SCREEN_HELP EQUAL QUOTE_STRING
- X {
- X strcpy (yyscreen->helpfile, $3);
- X }
- X ;
- X
- Xscreen_pos : SCREEN_POS EQUAL NUMBER NUMBER
- X {
- X yyscreen->toprow = $3;
- X yyscreen->leftcol = $4;
- X }
- X | SCREEN_POS EQUAL EVAR EVAR
- X {
- X strcpy (yyscreen->toprowvar, $3);
- X strcpy (yyscreen->leftcolvar, $4);
- X /*
- X yyscreen->toprow = atoi ((char *)getval (&$3, '1'));
- X yyscreen->leftcol = atoi ((char *)getval (&$4, '1'));
- X */
- X }
- X | SCREEN_POS EQUAL NUMBER EVAR
- X {
- X yyscreen->toprow = $3;
- X strcpy (yyscreen->leftcolvar, $4);
- X }
- X | SCREEN_POS EQUAL EVAR NUMBER
- X {
- X /*
- X yyscreen->toprow = atoi ((char *)getval (&$3, '1'));
- X */
- X strcpy (yyscreen->toprowvar, $3);
- X yyscreen->leftcol = $4;
- X }
- X ;
- X
- Xscreen_rows : SCREEN_ROWS EQUAL NUMBER
- X {
- X yyscreen->rows = $3;
- X }
- X ;
- Xscreen_cols : SCREEN_COLS EQUAL NUMBER
- X {
- X yyscreen->cols = $3;
- X }
- X ;
- Xscreen_border : SCREEN_BORDER EQUAL STRING
- X {
- X /* get border type for active menu */
- X if (strcmp ($3, "DumbLine") == 0)
- X yyscreen->boxtype = DumbLine;
- X else if (strcmp ($3, "StandoutLine") == 0)
- X yyscreen->boxtype = StandoutLine;
- X else if (strcmp ($3, "SingleLine") == 0 ||
- X strcmp ($3, "DrawLine") == 0)
- X yyscreen->boxtype = SingleLine;
- X else if (strcmp ($3, "MosaicLine") == 0)
- X yyscreen->boxtype = MosaicLine;
- X else if (strcmp ($3, "DiamondLine") == 0)
- X yyscreen->boxtype = DiamondLine;
- X else if (strcmp ($3, "DotLine") == 0)
- X yyscreen->boxtype = DotLine;
- X else if (strcmp ($3, "PlusLine") == 0)
- X yyscreen->boxtype = PlusLine;
- X }
- X |SCREEN_BORDER EQUAL STRING STRING
- X {
- X /* get border type for active menu */
- X if (strcmp ($3, "DumbLine") == 0)
- X yyscreen->boxtype = DumbLine;
- X else if (strcmp ($3, "StandoutLine") == 0)
- X yyscreen->boxtype = StandoutLine;
- X else if (strcmp ($3, "SingleLine") == 0 ||
- X strcmp ($3, "DrawLine") == 0)
- X yyscreen->boxtype = SingleLine;
- X else if (strcmp ($3, "MosaicLine") == 0)
- X yyscreen->boxtype = MosaicLine;
- X else if (strcmp ($3, "DiamondLine") == 0)
- X yyscreen->boxtype = DiamondLine;
- X else if (strcmp ($3, "DotLine") == 0)
- X yyscreen->boxtype = DotLine;
- X else if (strcmp ($3, "PlusLine") == 0)
- X yyscreen->boxtype = PlusLine;
- X
- X /* border type for inactive menu - dim (high 8 bits) */
- X if (strcmp ($4, "DumbLine") == 0)
- X yyscreen->boxtype = yyscreen->boxtype |
- X (DumbLine << 9);
- X else if (strcmp ($4, "StandoutLine") == 0)
- X yyscreen->boxtype = yyscreen->boxtype |
- X (StandoutLine << 9);
- X else if (strcmp ($4, "SingleLine") == 0 ||
- X strcmp ($4, "DrawLine") == 0)
- X yyscreen->boxtype = yyscreen->boxtype |
- X (SingleLine << 9);
- X else if (strcmp ($4, "MosaicLine") == 0)
- X yyscreen->boxtype = yyscreen->boxtype |
- X (MosaicLine << 9);
- X else if (strcmp ($4, "DiamondLine") == 0)
- X yyscreen->boxtype = yyscreen->boxtype |
- X (DiamondLine << 9);
- X else if (strcmp ($4, "DotLine") == 0)
- X yyscreen->boxtype = yyscreen->boxtype |
- X (DotLine << 9);
- X else if (strcmp ($4, "PlusLine") == 0)
- X yyscreen->boxtype = yyscreen->boxtype |
- X (PlusLine << 9);
- X }
- X ;
- Xexit_last_field : EXIT_LAST_FIELD
- X {
- X yyscreen->exitlastfield = TRUE;
- X }
- X ;
- X
- Xexit_on_cancel : EXIT_ON_CANCEL
- X {
- X yyscreen->exitoncancel = TRUE;
- X }
- X ;
- X
- Xscreen_text : SCREEN_TEXT EQUAL NUMBER NUMBER STRING
- X {
- X yyscreen->textinfo[textcount] = (struct TextInfo *)
- X malloc (sizeof (struct TextInfo));
- X yyscreen->textinfo[textcount]->row = $3;
- X yyscreen->textinfo[textcount]->col = $4;
- X yyscreen->textinfo[textcount]->text =
- X (char *)malloc (strlen($5)+5);
- X strcpy (yyscreen->textinfo[textcount]->text, $5);
- X yyscreen->textinfo[++textcount] =
- X (struct TextInfo *)NULL;
- X }
- X | SCREEN_TEXT EQUAL NUMBER NUMBER QUOTE_STRING
- X {
- X yyscreen->textinfo[textcount] = (struct TextInfo *)
- X malloc (sizeof (struct TextInfo));
- X yyscreen->textinfo[textcount]->row = $3;
- X yyscreen->textinfo[textcount]->col = $4;
- X yyscreen->textinfo[textcount]->text =
- X (char *)malloc (strlen($5)+5);
- X strcpy (yyscreen->textinfo[textcount]->text, $5);
- X yyscreen->textinfo[++textcount] =
- X (struct TextInfo *)NULL;
- X }
- X ;
- X
- Xafter_screen : AFTER_SCREEN EQUAL QUOTE_STRING
- X {
- X yyscreen->after_screen = (char *)malloc (strlen($3)+5);
- X strcpy (yyscreen->after_screen, $3);
- X }
- X ;
- X
- X
- X
- X
- Xfield_name : FIELD_NAME EQUAL EVAR
- X {
- X /*
- X ** The field_name token signifes a new field
- X ** we need to malloc the field structure.
- X */
- X if ((++fieldcount) > MAXFIELDS)
- X {
- X BEEP;
- X mvprintw (ErrRow-2, 0,
- X "Exceeded maximum screen fields of %d.",
- X MAXFIELDS);
- X shutdown ();
- X }
- X FLD = (struct FieldInfo *)malloc (sizeof (struct FieldInfo));
- X yyscreen->field[fieldcount] = (struct FieldInfo *)NULL;
- X strcpy (FLD->name, $3+1);
- X
- X /* Set default field values */
- X strcpy (FLD->label, "");
- X FLD->min_input = 0;
- X strcpy (FLD->mask, "");
- X strcpy (FLD->range, "");
- X FLD->type = UPPER_AN;
- X FLD->adjust = NOFILL;
- X FLD->mustenter = FALSE;
- X strcpy (FLD->prompt, "");
- X strcpy (FLD->terminator, "[]");
- X FLD->noinput = FALSE;
- X FLD->before_field = (char *)NULL;
- X FLD->after_field = (char *)NULL;
- X }
- X ;
- X
- Xfield_label : FIELD_LABEL EQUAL STRING
- X {
- X strcpy (FLD->label, $3);
- X }
- X | FIELD_LABEL EQUAL QUOTE_STRING
- X {
- X strcpy (FLD->label, $3);
- X }
- X ;
- X
- Xfield_row : FIELD_ROW EQUAL NUMBER
- X {
- X FLD->row = $3;
- X }
- X ;
- Xfield_col : FIELD_COL EQUAL NUMBER
- X {
- X FLD->col = $3;
- X }
- X ;
- X
- Xfield_mask : FIELD_MASK EQUAL STRING
- X {
- X strcpy (FLD->mask, $3);
- X }
- X | FIELD_MASK EQUAL QUOTE_STRING
- X {
- X strcpy (FLD->mask, $3);
- X }
- X ;
- X
- Xfield_range : FIELD_RANGE EQUAL STRING
- X {
- X strcpy (FLD->range, $3);
- X }
- X | FIELD_RANGE EQUAL QUOTE_STRING
- X {
- X strcpy (FLD->range, $3);
- X }
- X ;
- X
- Xfield_length : FIELD_LENGTH EQUAL NUMBER
- X {
- X FLD->length = $3;
- X }
- X ;
- Xfield_min : FIELD_MIN EQUAL NUMBER
- X {
- X FLD->min_input = $3;
- X }
- X ;
- Xfield_type : FIELD_TYPE EQUAL STRING
- X {
- X if (strcmp ($3, "ALPHANUM") == 0)
- X FLD->type = ALPHANUM;
- X else if (strcmp ($3, "ALPHA") == 0)
- X FLD->type = ALPHA;
- X else if (strcmp ($3, "NUMERIC") == 0)
- X FLD->type = NUMERIC;
- X else if (strcmp ($3, "SET") == 0)
- X FLD->type = SET;
- X else if (strcmp ($3, "UPPER") == 0)
- X FLD->type = UPPER;
- X else if (strcmp ($3, "UPPER_AN") == 0)
- X FLD->type = UPPER_AN;
- X else if (strcmp ($3, "HEX") == 0)
- X FLD->type = HEX;
- X else if (strcmp ($3, "STATE") == 0)
- X FLD->type = STATE;
- X else if (strcmp ($3, "ZIP") == 0)
- X FLD->type = ZIP;
- X else if (strcmp ($3, "DATE") == 0)
- X FLD->type = DATE;
- X else if (strcmp ($3, "TIME") == 0)
- X FLD->type = TIME;
- X else if (strcmp ($3, "MENU") == 0)
- X FLD->type = MENU;
- X else if (strcmp ($3, "PROTECT") == 0)
- X FLD->type = PROTECT;
- X else yyerror ("Invalid field_edits");
- X }
- X ;
- Xfield_adjust : FIELD_ADJUST EQUAL STRING
- X {
- X if (strcmp ($3, "NOFILL") == 0)
- X FLD->adjust = NOFILL;
- X else if (strcmp ($3, "RTADJ_ZFILL") == 0)
- X FLD->adjust = RTADJ_ZFILL;
- X else if (strcmp ($3, "RTADJ_BFILL") == 0)
- X FLD->adjust = RTADJ_BFILL;
- X else if (strcmp ($3, "LFADJ_ZFILL") == 0)
- X FLD->adjust = LFADJ_ZFILL;
- X else if (strcmp ($3, "LFADJ_BFILL") == 0)
- X FLD->adjust = LFADJ_BFILL;
- X }
- X | FIELD_ADJUST EQUAL QUOTE_STRING
- X {
- X if (strcmp ($3, "NOFILL") == 0)
- X FLD->adjust = NOFILL;
- X else if (strcmp ($3, "RTADJ_ZFILL") == 0)
- X FLD->adjust = RTADJ_ZFILL;
- X else if (strcmp ($3, "RTADJ_BFILL") == 0)
- X FLD->adjust = RTADJ_BFILL;
- X else if (strcmp ($3, "LFADJ_ZFILL") == 0)
- X FLD->adjust = LFADJ_ZFILL;
- X else if (strcmp ($3, "LFADJ_BFILL") == 0)
- X FLD->adjust = LFADJ_BFILL;
- X }
- X ;
- X
- Xfield_mustenter : FIELD_MUSTENTER
- X {
- X FLD->mustenter = TRUE;
- X }
- X ;
- X
- Xfield_prompt : FIELD_PROMPT EQUAL STRING
- X {
- X strcpy (FLD->prompt, $3);
- X }
- X | FIELD_PROMPT EQUAL QUOTE_STRING
- X {
- X strcpy (FLD->prompt, $3);
- X }
- X ;
- X
- Xfield_terminator : FIELD_TERMINATOR EQUAL QUOTE_STRING
- X {
- X if (strlen ($3) != 2)
- X yyerror ("Bad field_terminator.");
- X strcpy (FLD->terminator, $3);
- X }
- X ;
- X
- Xfield_defaults : FIELD_DEFAULTS EQUAL QUOTE_STRING
- X {
- X yyscreen->fielddefaults = (char *)malloc (strlen($3)+5);
- X strcpy (yyscreen->fielddefaults, $3);
- X }
- X ;
- X
- Xfield_noinput : FIELD_NOINPUT
- X {
- X FLD->noinput = TRUE;
- X }
- X ;
- X
- Xbefore_field : BEFORE_FIELD EQUAL QUOTE_STRING
- X {
- X FLD->before_field = (char *)malloc (strlen($3)+5);
- X strcpy (FLD->before_field, $3);
- X }
- X ;
- X
- Xafter_field : AFTER_FIELD EQUAL QUOTE_STRING
- X {
- X FLD->after_field = (char *)malloc (strlen($3)+5);
- X strcpy (FLD->after_field, $3);
- X }
- X ;
- X
- X
- X
- X%%
- X
- X/* FUNCTION: ParseDefineScreen()
- X** This function parses .DEFINE_SCREEN
- X** ARGS: keyword the keyword found
- X** menufile the unix menu file
- X** menu menu structure
- X** gnames holder of goto menu names
- X** gfiles holder of goto menu names (menu file)
- X** gindex # of gnames
- X** RETURNS: 0
- X*/
- X
- X
- X#define SRN menu->srn[screencount-1]
- X
- Xextern FILE *yyin;
- Xextern FILE *yyout;
- Xextern int swin, ewin, longest;
- X
- X char ScreenName[50]; /* for yyerror */
- X
- X
- XParseDefineScreen (keyword, menufile, menu, gnames, gfiles, gindex, opnumber)
- X
- X char keyword[];
- X FILE *menufile;
- X struct MenuInfo *menu;
- X char gnames[][15], gfiles[][15];
- X int *gindex;
- X int *opnumber;
- X{
- X char *fgets(), line[BUFSIZE];
- X static int screencount;
- X int i = 0;
- X int j;
- X char *ws;
- X
- X
- X /* check if this is the first screen for this menu */
- X if (menu->srn[0] == (struct ScreenInfo *)NULL)
- X screencount = 0;
- X
- X if ((++screencount) > MAXSCREENS)
- X {
- X BEEP;
- X mvprintw (ErrRow, 0,
- X "Exceeded maximum allowable .DEFINE_SCREEN.");
- X shutdown ();
- X }
- X
- X SRN = (struct ScreenInfo *)malloc (sizeof (struct ScreenInfo));
- X if (SRN == NULL)
- X {
- X BEEP;
- X mvprintw (ErrRow, 0,
- X "Unable to allocate memory for .DEFINE_SCREEN.");
- X shutdown ();
- X }
- X /* terminate the screens list */
- X menu->srn[screencount] = (struct ScreenInfo *)NULL;
- X SRN->field[0] = (struct FieldInfo *)NULL; /* no fields yet */
- X
- X
- X /* get screen name */
- X fgets (line, BUFSIZE, menufile);
- X sscanf (line, "%s", SRN->name); /* screen name */
- X strcpy (ScreenName, SRN->name); /* for yyerror */
- X
- X yyin = menufile;
- X yyscreen = SRN;
- X fieldcount = 0;
- X textcount = 0;
- X
- X /*
- X ** Set default screen values.
- X */
- X sprintf (SRN->title, "%d", AUTO);
- X SRN->rows = AUTO;
- X SRN->cols = AUTO;
- X SRN->toprow = AUTO;
- X SRN->leftcol = AUTO;
- X strcpy (SRN->toprowvar, "");
- X strcpy (SRN->leftcolvar, "");
- X SRN->boxtype = StandoutLine;
- X SRN->fielddefaults = (char *)NULL;
- X strcpy (SRN->helpfile, "menu.hlp");
- X SRN->exitlastfield = FALSE;
- X SRN->exitoncancel = FALSE;
- X SRN->textinfo[textcount] = (struct TextInfo *)NULL;
- X SRN->after_screen = (char *)NULL;
- X
- X#ifdef _yydebug
- X if (debug)
- X yydebug = 1;
- X#endif
- X
- X yyparse ();
- X
- X return (0);
- X}
- X
- X
- Xyyerror (s)
- X char *s;
- X{
- X mvprintw (ErrRow-5,0, "Unable to process .DEFINE_SCREEN %s",
- X ScreenName);
- X mvprintw (ErrRow-4,0, "Field Number %d", fieldcount);
- X mvprintw (ErrRow-3,0, "%s", s);
- X mvprintw (ErrRow-2,0, "The error occured on token = \"%s\"", eott);
- X mvprintw (ErrRow-1,0, "Look ahead token number %d <tokens.h>", yychar);
- X shutdown ();
- X}
- SHAR_EOF
- echo "File ParseDeSrn.y is complete"
- chmod 0644 ParseDeSrn.y || echo "restore of ParseDeSrn.y fails"
- echo "x - extracting utilities.d/libgeti.d/AdjField.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/AdjField.c &&
- Xstatic char Sccsid[] = "@(#)AdjField.c 1.1 DeltaDate 8/30/87 ExtrDate 1/22/90";
- X#include <curses.h>
- X#include "GetInput.h"
- X#include <ctype.h>
- X
- XAdjField(win, rowStart, colStart, fldAttrib, fldAdjust, colEnd, charKeyed)
- X WINDOW *win ; /* Window */
- X int rowStart ;
- X int colStart ;
- X int fldAttrib ; /* Curses attribute */
- X char fldAdjust ; /* adjust/fill field */
- X int colEnd ; /* column where field ends */
- X char charKeyed[] ; /* characters keyed */
- X{
- X int col ; /* working column field */
- X int row ; /* working row field */
- X int colMove ; /* working column field for adjusting
- X routines */
- X int ch ; /* contains character keyed or being
- X moved */
- X
- X char *wrkKeyed ; /* working pointer for charKeyed */
- X char fillChar ;
- X
- X
- X getyx (win, row, col) ;
- X
- X if (fldAdjust == RTADJ_BFILL || fldAdjust == LFADJ_BFILL)
- X fillChar = ' ' ;
- X else if (fldAdjust == RTADJ_ZFILL || fldAdjust == LFADJ_ZFILL)
- X fillChar = '0' ;
- X
- X if (fldAdjust == RTADJ_BFILL || fldAdjust == RTADJ_ZFILL) {
- X
- X col-- ;
- X
- X wrkKeyed = charKeyed + (col - colStart) ;
- X
- X colMove = colEnd - 1 ;
- X
- X while (col >= colStart) {
- X
- X while ( *wrkKeyed != 'Y') {
- X wrkKeyed-- ;
- X col-- ;
- X }
- X
- X if (col < colStart)
- X break ;
- X
- X ch = mvwinch(win, rowStart, col--) & A_CHARTEXT ;
- X *wrkKeyed-- = 'N' ;
- X
- X while ( colMove > colStart &&
- X charKeyed [colMove - colStart] != 'N')
- X colMove-- ;
- X
- X charKeyed [colMove - colStart] = 'Y' ;
- X
- X wattrset (win, fldAttrib) ;
- X mvwaddch (win, rowStart, colMove--, ch) ;
- X wattrset (win, 0) ;
- X }
- X
- X wattrset (win, fldAttrib) ;
- X
- X while (colMove >= colStart) {
- X
- X if ( charKeyed [colMove - colStart] != 'N')
- X colMove-- ;
- X else {
- X charKeyed [colMove - colStart] = 'Y' ;
- X mvwaddch(win, rowStart, colMove--, fillChar) ;
- X }
- X }
- X
- X wattrset (win, 0) ;
- X wmove (win, rowStart, colEnd) ;
- X
- X } else if (fldAdjust == LFADJ_BFILL || fldAdjust == LFADJ_ZFILL) {
- X
- X if (col < colStart)
- X col = colStart;
- X
- X wattrset (win, fldAttrib) ;
- X
- X while (col < colEnd) {
- X
- X if ( charKeyed [col - colStart] != 'N')
- X col++ ;
- X else {
- X charKeyed [col - colStart] = 'Y' ;
- X mvwaddch (win, rowStart, col++, fillChar) ;
- X }
- X }
- X
- X wattrset (win, 0) ;
- X wmove (win, rowStart, colEnd) ;
- X }
- X
- X wrefresh (win) ;
- X
- X return(0) ;
- X
- X}
- SHAR_EOF
- chmod 0444 utilities.d/libgeti.d/AdjField.c || echo "restore of utilities.d/libgeti.d/AdjField.c fails"
- echo "x - extracting utilities.d/libgeti.d/BuildMenu.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/BuildMenu.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "@(#)BuildMenu.c 1.1 DeltaDate 1/22/90 ExtrDate 1/22/90";
- X#endif
- X
- X#include <curses.h>
- X
- XBuildMenu (menu, fldRange)
- X char menu[][80];
- X char *fldRange;
- X{
- X int eidx = 0; /* element index */
- X char *rptr; /* range pointer */
- X char *eptr; /* element pointer */
- X
- X rptr = fldRange;
- X
- X while (*rptr != '\0')
- X {
- X /* get range element eidx */
- X eptr = menu[eidx];
- X while (*rptr != ',' && *rptr != '\0')
- X *eptr++ = *rptr++;
- X *eptr = '\0';
- X
- X /* skip junk */
- X while (*rptr == ',' || *rptr == ' ' || *rptr == '\t')
- X *rptr++;
- X eidx++;
- X }
- X strcpy (menu[eidx], "");
- X}
- X/* Paul J. Condie 11/88 */
- SHAR_EOF
- chmod 0444 utilities.d/libgeti.d/BuildMenu.c || echo "restore of utilities.d/libgeti.d/BuildMenu.c fails"
- echo "x - extracting utilities.d/libgeti.d/DateFun.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/DateFun.c &&
- Xstatic char Sccsid[] = "%W% DeltaDate %G% ExtrDate %H%";
- X
- X#define BASEYEAR 1900
- X
- X/*
- X * is_leap - returns 1 if year is a leap year, 0 if not
- X */
- Xint is_leap(y)
- Xint y;
- X{
- X return(y % 4 == 0 && y % 100 != 0 || y % 400 == 0);
- X}
- X
- X/*
- X**
- X** maxdays, returns maximum number of days for 'year'
- X**
- X*/
- Xint maxdays(y)
- Xregister int y;
- X{
- X return(is_leap(y) ? 366 : 365);
- X}
- X
- Xstatic int day_tab[2][13] = {
- X {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
- X {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
- X};
- X
- X
- X/*
- X * julian - converts year month and day to julian date and returns it
- X */
- Xint julian(year, month, day)
- Xint year, month, day;
- X{
- X int i, leap;
- X
- X leap = is_leap(year);
- X for (i = 1; i < month; i++)
- X day += day_tab[leap][i];
- X return(day);
- X}
- X
- X
- X
- X/*
- X**
- X** week_day - returns the day of the week given the Year,
- X** Month and Day. Year must be >= 1973.
- X** If not, -1 is returned.
- X** day of the week:
- X** Sunday = 0, Monday = 1, ..., Saturday = 6.
- X*/
- Xint week_day( year, month, day )
- X int year, month, day ;
- X{
- X int century ;
- X
- X month -= 2 ;
- X if ( month < 1 )
- X {
- X month += 12 ;
- X year-- ;
- X }
- X century = (int)( year / 100 ) ;
- X year %= 100 ;
- X return(((int)( (13 * month - 1) / 5 ) + day + year + (int)( year / 4 ) +
- X (int)( century / 4 ) - ( 2 * century ) + 77) % 7 ) ;
- X}
- X
- X
- X/*
- X * month_day - Converts julian date to month and day. Month and day must be passed as addresses of ints.
- X */
- Xvoid
- Xmonth_day(year, yearday, pmonth, pday)
- Xint year, yearday, *pmonth, *pday;
- X{
- X int i, leap;
- X
- X leap = is_leap(year);
- X for (i = 1; yearday > day_tab[leap][i]; i++) {
- X yearday -= day_tab[leap][i];
- X }
- X if(i > 12)
- X i = 1;
- X
- X if(yearday <= 0) { /* special kludge for julian day 0 = Dec. 31st */
- X *pmonth = 12;
- X *pday = 31 + yearday;
- X } else {
- X *pmonth = i;
- X *pday = yearday;
- X }
- X}
- X
- X
- X/* back up (if necessary) month and date to nearest sunday */
- X/* return julian date of new date as well */
- X
- X/*
- X * weekstart - returns julian data of Sunday start date of given YY/MM/DD.
- X */
- Xint weekstart(year, month, date)
- Xregister int year, *month, *date;
- X{
- X int mp, dp, i, t;
- X
- X if ((i = week_day(year, *month, *date)) != 0) {
- X t = julian(year, *month, *date);
- X month_day(year, t - i, &mp, &dp);
- X if(mp > *month)
- X year--;
- X *month = mp;
- X *date = dp;
- X }
- X return(julian(year, *month, *date));
- X}
- X
- X
- X/* verifies the integrity of a date, returns 1 if good, 0 if bad */
- Xint valid_date(yr, mo, day)
- Xint yr, mo, day;
- X{
- X int days, leap;
- X
- X leap = is_leap(yr);
- X if (mo > 0 && mo < 13) {
- X days = day_tab[leap][mo];
- X if (day > 0 && day <= days && yr > 0)
- X return(1);
- X }
- X return(0);
- X}
- X
- X
- X/*
- X** datedays - returns the # of days from 1/1/BASEYEAR
- X** 01/01/BASEYEAR = 1 days
- X** Year must be >= BASEYEAR. If not, -1 is returned.
- X*/
- Xlong datedays(year, month, day)
- X int year, month, day;
- X{
- X year -= BASEYEAR ;
- X if(year < 0)
- X return(-1);
- X else
- X return((long) ((year*365)+julian(year, month, day)+
- X ((year-1)/4)));
- X}
- SHAR_EOF
- chmod 0644 utilities.d/libgeti.d/DateFun.c || echo "restore of utilities.d/libgeti.d/DateFun.c fails"
- echo "x - extracting utilities.d/libgeti.d/DisPrmpt.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/DisPrmpt.c &&
- Xstatic char Sccsid[] = "%W% DeltaDate %G% ExtrDate %H%";
- X#include <curses.h>
- X#include "GetInput.h"
- X
- XDisPrmpt(win, Fld, fldAttrib, fldMask, fldLength, fldCharType, fldAdjust, fldType, colStart, colEnd, fldStr, charKeyed)
- X WINDOW *win ; /* Window */
- X FldUnPointer Fld ; /* Pointer to union for field */
- X int fldAttrib ; /* Curses attribute */
- X char *fldMask ; /* mask for character string */
- X unsigned fldLength ; /* Maximum length of output */
- X char fldCharType ; /* type of character */
- X char fldAdjust ; /* Type of adjustment */
- X char fldType ; /* type of field */
- X int colStart ; /* column start of field */
- X int colEnd ; /* column end of field */
- X char *fldStr ; /* buffer that will contain output */
- X char *charKeyed ; /* characters keyed */
- X{
- X char *wrk, *fldWrk, *malloc();
- X
- X int ch ;
- X int col ;
- X int initFld ;
- X int i, j ;
- X
- X *fldStr = '\0' ;
- X
- X /*
- X if (((fldType == HEX || fldType == CHAR) && *Fld->strVal == '\0') ||
- X (fldType == INT && *Fld->intVal == 0) ||
- X (fldType == SHORT && *Fld->shortVal == 0) ||
- X (fldType == LONG && *Fld->longVal == 0L) ||
- X (fldType == FLOAT && *Fld->floatVal == 0.0) ||
- X (fldType == DOUBLE && *Fld->doubleVal == 0.0) ||
- X (fldType == MONEY && *Fld->doubleVal == 0.0) ) {
- X */
- X if (((fldType == HEX || fldType == CHAR) && *Fld->strVal == '\0')) {
- X
- X initFld = FALSE ;
- X fldWrk = fldStr ;
- X while (fldLength--)
- X *fldWrk++ = ' ' ;
- X *fldWrk = '\0' ;
- X } else {
- X
- X initFld = TRUE ;
- X
- X fldWrk = malloc(fldLength + 10);
- X
- X if (fldType == HEX || fldType == CHAR)
- X strcpy (fldWrk, Fld->strVal) ;
- X else if (fldType == INT)
- X sprintf (fldWrk, "%d", *Fld->intVal) ;
- X else if (fldType == SHORT)
- X sprintf (fldWrk, "%d", *Fld->shortVal) ;
- X else if (fldType == LONG)
- X sprintf (fldWrk, "%ld", *Fld->longVal) ;
- X else if (fldType == FLOAT)
- X sprintf (fldWrk, "%f", *Fld->floatVal) ;
- X else if (fldType == DOUBLE)
- X sprintf (fldWrk, "%g", *Fld->doubleVal) ;
- X else if (fldType == MONEY) {
- X sprintf (fldWrk, "%g", *Fld->doubleVal) ;
- X i = strlen(fldWrk) - 1 ;
- X wrk = fldWrk ;
- X while(*wrk != '.' && *wrk != '\0')
- X wrk++ ;
- X if(*wrk == '\0')
- X strcat(fldWrk, ".00") ;
- X else {
- X wrk++ ;
- X j = 0 ;
- X while(*wrk++ != '\0')
- X j++ ;
- X
- X if(j == 0)
- X strcat(fldWrk, "00") ;
- X else if(j == 1)
- X strcat(fldWrk, "0") ;
- X }
- X }
- X
- X if (fldAdjust == NOFILL)
- X strcpy (fldStr, fldWrk) ;
- X else if (fldAdjust == LFADJ_BFILL || fldAdjust == LFADJ_ZFILL){
- X strcpy (fldStr, fldWrk) ;
- X
- X for (i = strlen(fldStr) ; i < fldLength ; i++)
- X fldStr[i] = (fldAdjust == LFADJ_ZFILL) ? '0' : ' ' ;
- X fldStr[fldLength] = '\0' ;
- X } else if (fldAdjust == RTADJ_BFILL || fldAdjust == RTADJ_ZFILL) {
- X
- X for (i = 0 ; i < fldLength - strlen(fldWrk) ; i++)
- X fldStr[i] = (fldAdjust == RTADJ_ZFILL) ? '0' : ' ' ;
- X fldStr[fldLength - strlen(fldWrk)] = '\0' ;
- X strcat (fldStr, fldWrk) ;
- X }
- X
- X free (fldWrk) ;
- X
- X }
- X wattrset (win, fldAttrib) ;
- X
- X col = colStart ;
- X
- X do {
- X if (fldMask == NULL) {
- X *charKeyed++ = (initFld) ? 'Y' : 'N' ;
- X waddch(win, *fldStr++) ;
- X } else if (fldCharType != DATE && fldCharType != TIME) {
- X /*
- X if(*(fldMask + col - colStart) == ' ')
- X *(fldMask + col - colStart) = fldCharType ;
- X */
- X if(IsMask(fldCharType, *(fldMask + col - colStart))) {
- X *charKeyed++ = 'M' ;
- X waddch(win, *(fldMask + col - colStart) );
- X } else {
- X *charKeyed++ = (initFld) ? 'Y' : 'N' ;
- X waddch(win, *fldStr++) ;
- X }
- X } else {
- X if( (fldCharType == DATE &&
- X (ch = *(fldMask + col - colStart)) == 'M' ||
- X ch == 'D' || ch == 'Y') ||
- X (fldCharType == TIME &&
- X (ch = *(fldMask + col - colStart)) == 'I' ||
- X ch == 'H' || ch == 'M' ||
- X ch == 'S' || ch == 'T')) {
- X *charKeyed++ = (initFld) ? 'Y' : 'N' ;
- X waddch(win, *fldStr++) ;
- X } else {
- X *charKeyed++ = 'M' ;
- X waddch(win, *(fldMask + col - colStart) );
- X }
- X }
- X col++ ;
- X } while (*fldStr != '\0' && col < colEnd) ;
- X
- X while(col < colEnd) {
- X if (fldMask == NULL) {
- X *charKeyed++ = 'N' ;
- X waddch(win, ' ') ;
- X } else if (fldCharType != DATE && fldCharType != TIME) {
- X if(*(fldMask + col - colStart) == ' ')
- X *(fldMask + col - colStart) = fldCharType ;
- X if(IsMask(fldCharType, *(fldMask + col - colStart))) {
- X *charKeyed++ = 'M' ;
- X waddch(win, *(fldMask + col - colStart) );
- X } else {
- X *charKeyed++ = 'N' ;
- X waddch(win, ' ') ;
- X }
- X } else {
- X if( (fldCharType == DATE &&
- X (ch = *(fldMask + col - colStart)) == 'M' ||
- X ch == 'D' || ch == 'Y') ||
- X (fldCharType == TIME &&
- X (ch = *(fldMask + col - colStart)) == 'I' ||
- X ch == 'H' || ch == 'M' ||
- X ch == 'S' || ch == 'T')) {
- X *charKeyed++ = 'N' ;
- X waddch(win, ' ') ;
- X } else {
- X *charKeyed++ = 'M' ;
- X waddch(win, *(fldMask + col - colStart) );
- X }
- X }
- X col++ ;
- X }
- X
- X wattrset (win, 0) ;
- X
- X return(initFld) ;
- X
- X}
- SHAR_EOF
- chmod 0644 utilities.d/libgeti.d/DisPrmpt.c || echo "restore of utilities.d/libgeti.d/DisPrmpt.c fails"
- echo "x - extracting utilities.d/libgeti.d/FindSet.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/FindSet.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "%W% DeltaDate %G% ExtrDate %H%";
- X#endif
- X
- X#include <stdio.h>
- X
- X/*
- X** FindSet()
- X** Determines if the value loaded into Fld is a member of the set.
- X** RETURNS:
- X** -1 not a element of the set
- X** eNum otherwise returns the element number (base 0)
- X*/
- X
- X#include "GetInput.h"
- X
- X
- XFindSet(Fld, fldRange, fldLength, fldType)
- X FldUnPointer Fld ;
- X char *fldRange ;
- X int fldLength ;
- X char fldType ;
- X{
- X char *upper();
- X char *a,
- X *b,
- X *fldCmp ;
- X
- X char *malloc();
- X
- X int eNum, /* element number matched */
- X gotAmatch ;
- X
- X gotAmatch = 0 ;
- X
- X eNum = 0 ;
- X
- X fldCmp = malloc(fldLength+10);
- X
- X a = fldRange ;
- X
- X while(*a != '\0') {
- X
- X b = fldCmp ;
- X
- X while(*a != ',' && *a != '\0')
- X /* load the next element into fldCmp */
- X *b++ = *a++ ;
- X
- X *b = '\0' ;
- X
- X switch(fldType) {
- X case CHAR:
- X case DATE:
- X case TIME:
- X if(strncmp(upper(fldCmp), upper(Fld->strVal), strlen(Fld->strVal)) == 0)
- X gotAmatch = 1 ;
- X break ;
- X case INT:
- X if(*Fld->intVal == atoi(fldCmp))
- X gotAmatch = 1 ;
- X break ;
- X case SHORT:
- X if(*Fld->shortVal == atoi(fldCmp))
- X gotAmatch = 1 ;
- X break ;
- X case LONG:
- X if(*Fld->longVal == atoi(fldCmp))
- X gotAmatch = 1 ;
- X break ;
- X case FLOAT:
- X if(*Fld->floatVal == atof(fldCmp))
- X gotAmatch = 1 ;
- X break ;
- X case DOUBLE:
- X if(*Fld->doubleVal == atof(fldCmp))
- X gotAmatch = 1 ;
- X break ;
- X }
- X
- X if(gotAmatch)
- X break ;
- X
- X eNum++ ;
- X
- X while(*a == ',' || *a == ' ' || *a == '\t')
- X a++ ;
- X }
- X
- X free(fldCmp) ;
- X
- X if(gotAmatch)
- X return(eNum) ;
- X else
- X return (-1) ;
- X}
- SHAR_EOF
- chmod 0644 utilities.d/libgeti.d/FindSet.c || echo "restore of utilities.d/libgeti.d/FindSet.c fails"
- echo "x - extracting utilities.d/libgeti.d/GetInput.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > utilities.d/libgeti.d/GetInput.c &&
- Xstatic char Sccsid[] = "%W% DeltaDate %G% ExtrDate %H%";
- X
- X#include <curses.h>
- X#include <ctype.h>
- X#include "keys.h"
- X#include "GetInput.h"
- X
- X#define MAXITEMS 200
- X#define NEWMENU 0
- X
- Xint insertmode = FALSE;
- X
- X
- XGetInput (win, rowStart, colStart, Fld, fldAttrib, fldMask, fldRange, fldLength,
- X fldMin, fldCharType, fldAdjust, fldType, keyStream, mustEnter,
- X fldErrRow, fldDispRow, helpMsg, helpFile, helpTag)
- X
- X WINDOW *win ; /* Window */
- X int rowStart ;
- X int colStart ;
- X FldUnPointer Fld ; /* Pointer to union for field */
- X int fldAttrib ; /* Curses attribute */
- X char *fldMask ; /* mask for character string */
- X char *fldRange ; /* range of valid values for output */
- X int fldLength; /* Maximum length of output */
- X int fldMin; /* Minimum length of output */
- X char fldCharType; /* type of character */
- X char fldAdjust ; /* adjust/fill field */
- X char fldType ; /* type of field */
- X int keyStream ; /* if TRUE then the function will
- X exit when the last character is
- X keyed */
- X int mustEnter ; /* boolean */
- X int fldErrRow ; /* where to display error message */
- X int fldDispRow ; /* where to display help message */
- X char *helpMsg ; /* help message */
- X char helpFile[] ; /* help file name */
- X char helpTag[] ; /* tag where help begins */
- X{
- X int colEnd ; /* column end of field */
- X int row ; /* working row field */
- X int col ; /* working column field */
- X int colSave ; /* working column field */
- X int colMove ; /* working col field for adjusting routines */
- X int colBegInput; /* column where input begins */
- X int ch ; /* contains character keyed or being moved */
- X int notFinished ; /* bool indicator that indicates when the user
- X is finished with keying in data */
- X int setNumb ; /* number to be returned showing which
- X selection the user chose */
- X int controlKey ; /* if not 0 then the user hit a control key */
- X int bytesKeyed ; /* how many bytes were keyed */
- X int initFld ; /* indicate if field was initialized going into
- X this routine */
- X char *fldStr ; /* buffer that will contain output */
- X char *charKeyed ; /* characters keyed by the user Y/N */
- X /*
- X ** charKeyd indicates how many characters
- X ** has been keyed in. A "Y" in the position
- X ** indicates that the user has keyed a char
- X ** at that position, otherwise it will be "N"
- X ** or a "M" for a mask format character.
- X */
- X char *fldWrk ; /* working field */
- X int origAttr[80] ; /* original field attributes */
- X char *malloc();
- X int i;
- X int junk; /* use for anything */
- X char menu[MAXITEMS+2][80]; /* popmenu items */
- X int menuid;
- X
- X
- X
- X
- X
- X if (fldCharType == PROTECT)
- X {
- X /* X out the field */
- X for (i = 0; i < fldLength; i++)
- X Fld->strVal[i] = 'X';
- X Fld->strVal[i] = '\0';
- X }
- X
- X /*
- X ** bug fix - pjc 08/26/86
- X ** bytesKeyed = 0
- X */
- X setNumb = controlKey = bytesKeyed = 0;
- X
- X /* find length of field from the values in fldRange */
- X if (fldCharType == SET || fldCharType == MENU)
- X fldLength = GetSetLen(fldRange);
- X
- X /*
- X ** pjc - 11/88
- X ** This allows you to pass ""
- X */
- X if (fldRange != NORANGE && strcmp(fldRange, "") == 0)
- X fldRange = NORANGE;
- X
- X if (fldMask != NOMASK && strcmp(fldMask, "") == 0)
- X fldMask = NOMASK;
- X if (fldMask == NOMASK)
- X {
- X colEnd = colStart + fldLength ;
- X fldStr = malloc(fldLength + 10);
- X charKeyed = malloc(fldLength + 10);
- X }
- X else
- X {
- X colEnd = colStart + strlen(fldMask) ;
- X fldStr = malloc(strlen(fldMask) + 10);
- X charKeyed = malloc(strlen(fldMask) + 10);
- X }
- X
- X /*
- X ** Save original terminal attributes.
- X */
- X for (col = colStart; col < colEnd; col++)
- X origAttr[col - colStart] = mvwinch(win, rowStart, col) &
- X A_ATTRIBUTES ;
- X
- X /* so a message you put on that line doesn't get erased */
- X if (helpMsg == NOMSG || strcmp (helpMsg, "DONT_CLEAR") == 0)
- X helpMsg = NOMSG;
- X else
- X CLEARROW (fldDispRow);
- X
- X /*
- X ** bug fix pjc 8/22/86
- X ** test for NOMSG
- X ** Display help message.
- X */
- X if (helpMsg != NOMSG)
- X {
- X /* pjc 7/87 - clrtoeol for new message
- X */
- X /* pjc 11/88 -
- X ** change helpMsg to always display to standard screen.
- X ** That way popup screens will work right.
- X ** Display message between col 1 to COLS-1 ... so that
- X ** it will work with a box border.
- X */
- X
- X mvwaddstr (stdscr,
- X ((fldDispRow%100) == fldDispRow) ? fldDispRow : fldDispRow/100,
- X ((fldDispRow%100) == fldDispRow) ? 0 : fldDispRow%100,
- X helpMsg) ;
- X wnoutrefresh (stdscr);
- X }
- X
- X /*
- X ** pjc 9/87
- X ** Added new attributes
- X ** If A_SAME then use the attributes that is showing
- X ** on the screen in that position.
- X ** As you see it is determined from first column.
- X */
- X if (fldAttrib == A_SAME)
- X fldAttrib = origAttr[0];
- X
- X wmove(win, rowStart, colStart) ;
- X if (fldCharType == SET || fldCharType == MENU)
- X {
- X setNumb = FindSet(Fld, fldRange, fldLength, fldType) ;
- X ShowSet(win, rowStart, colStart, fldAttrib, fldRange,
- X fldLength, &setNumb, colEnd, charKeyed, origAttr) ;
- X if (fldCharType == MENU)
- X {
- X char menustrid[10];
- X int mrow;
- X int mcol;
- X int numitems;
- X
- X /* make a unique menuid from the row & column */
- X sprintf (menustrid, "%2d%2d", rowStart, colStart);
- X menuid = atoi (menustrid);
- X
- X numitems = BuildMenu (menu, fldRange);
- X if (numitems == 0)
- X return (0);
- X
- X /* try to put menu as close to the field as possible */
- X if ((rowStart + win->_begy) > 0)
- X mrow = rowStart + win->_begy - 1;
- X else
- X mrow = 0;
- X /* off the edge of the screen ? */
- X if ((colEnd + fldLength + 4) + win->_begx > COLS)
- X {
- X mcol = COLS - fldLength + 4;
- X mrow += 2;
- X }
- X else
- X mcol = colEnd + win->_begx;
- X
- X if (mrow > 0 && numitems > (LINES - mrow - 2))
- X {
- X mrow = ((mrow-(numitems-(LINES-mrow-2))) > 0)
- X ? (mrow-(numitems-(LINES-mrow-2))) : 0;
- X }
- X
- X popmenu (NEWMENU, menuid, mrow, mcol, "",
- X helpFile, LINES-mrow-2, sizeof(menu[0]), menu);
- X }
- X }
- X else
- X /*
- X ** FALSE if Fld->strval == '\0'
- X ** TRUE if Fld contained a default value.
- X */
- X initFld = DisPrmpt(win, Fld, fldAttrib, fldMask, fldLength,
- X fldCharType, fldAdjust, fldType, colStart,
- X colEnd, fldStr, charKeyed) ;
- X
- X
- X
- X /*
- X ** find the first column where there is not a mask(M) character
- X ** This is the column where we begin the input.
- X */
- X col = colStart ;
- X fldWrk = charKeyed ;
- X /*
- X ** fldWrk - M = mask character, N = no mask character
- X */
- X while (col != colEnd && *fldWrk++ == 'M')
- X col++;
- X
- X colBegInput = col ;
- X wmove(win, rowStart, col) ;
- X notFinished = TRUE ;
- X
- X
- X if (fldCharType == PROTECT)
- X {
- X /* Password entry field */
- X wattrset (win, A_REVERSE);
- X strcpy (Fld->strVal, "");
- X free (fldStr);
- X free (charKeyed);
- X row = rowStart;
- X col = colStart;
- X fldStr = Fld->strVal;
- X *fldStr = '\0';
- X do
- X {
- X wmove (win, row, col);
- X wnoutrefresh (win);
- X doupdate ();
- X ch = wgetch (win);
- X if (ch == KeyHelp || ch == KEY_HELP)
- X {
- X ShowHelp (helpFile, helpTag, fldErrRow);
- X touchwin (win);
- X wnoutrefresh (win);
- X }
- X } while (ch == KeyHelp || ch == KEY_HELP);
- X *fldStr = (char)ch;
- X while (*fldStr != '\r')
- X {
- X if (col > colStart + fldLength - 1)
- X beep ();
- X else
- X {
- X addch ('X');
- X fldStr++;
- X col++;
- X }
- X wmove (win, row, col);
- X wnoutrefresh (win);
- X doupdate ();
- X ch = wgetch (win);
- X if (ch == KeyHelp || ch == KEY_HELP)
- X {
- X ShowHelp (helpFile, helpTag, fldErrRow);
- X touchwin (win);
- X wnoutrefresh (win);
- X }
- X else
- X *fldStr = (char)ch;
- X }
- X *fldStr = '\0';
- X wattrset (win, A_NORMAL);
- X return ((int)'\r');
- X }
- X
- X
- X while (TRUE)
- X {
- X do
- X {
- X /* pjc 11/88 for message and errors to stdscr */
- X wnoutrefresh (stdscr);
- X wnoutrefresh(win) ;
- X doupdate ();
- X
- X getyx(win, row, col) ;
- X
- X controlKey = 0;
- X ch = wgetch(win);
- X
- X CLEARROW (fldErrRow);
- X if (helpMsg != NOMSG)
- X {
- X mvwaddstr (stdscr,
- X ((fldDispRow%100) == fldDispRow) ? fldDispRow : fldDispRow/100,
- X ((fldDispRow%100) == fldDispRow) ? 0 : fldDispRow%100,
- X helpMsg) ;
- X }
- X
- X wmove(win, row, col) ;
- X
- X /* these keys accept the input before returning */
- X if (ch == KeyReturn) ch = KEY_RETURN;
- X if (ch == KeyDown) ch = KEY_DOWN;
- X if (ch == KeyUp) ch = KEY_UP;
- X if (ch == KeyTab) ch = KEY_TAB;
- X if (ch == KeyBTab) ch = KEY_BTAB;
- X if (ch == KeyAccept) ch = KEY_ACCEPT;
- X
- X /* other keys */
- X if (ch == KeyHelp) ch = KEY_HELP;
- X if (ch == KeyRedraw) ch = KEY_REFRESH;
- X if (ch == KeyLeft) ch = KEY_LEFT;
- X if (ch == KeyRight) ch = KEY_RIGHT;
- X if (ch == KeyEOL) ch = KEY_EOL;
- X if (ch == KeyDL) ch = KEY_DL;
- X if (ch == KeyDC) ch = KEY_DC;
- X if (ch == KeyIC) ch = KEY_IC;
- X if (ch == KeySave) ch = KEY_SAVE;
- X if (ch == KeyPrint) ch = KEY_PRINT;
- X if (ch == KeyBeg) ch = KEY_BEG;
- X if (ch == KeyEnd) ch = KEY_END;
- X if (ch == KeyCancel) ch = KEY_CANCEL;
- X
- X switch (ch)
- X {
- X case KEY_BEG:
- X /* place cursor at beg of field */
- X col = colStart;
- X wmove(win, rowStart, col) ;
- X break;
- X
- X case KEY_END:
- X /* place cursor at end of input */
- X col = colEnd;
- X junk = colEnd;
- X while (col >= colStart)
- X {
- X if (*(charKeyed+col-colStart) == 'N')
- X junk = col;
- X if (*(charKeyed+col-colStart) == 'Y')
- X break;
- X col--;
- X }
- X col = junk;
- X wmove(win, rowStart, col) ;
- X break;
- X
- X case KEY_HELP:
- X ShowHelp (helpFile, helpTag, fldErrRow);
- X touchwin (win);
- X wnoutrefresh (win);
- X continue;
- X
- X case KEY_REFRESH:
- X clearok (win, TRUE);
- X continue;
- X
- X case KEY_LEFT:
- X /* fixme
- X if (col > colBegInput)
- X */
- X if (col > colStart)
- X col--;
- X else
- X BELL;
- X while (col > colStart &&
- X *(charKeyed + col - colStart) == 'M')
- X --col ;
- X while (*(charKeyed + col - colStart) == 'M')
- X col++;
- X wmove(win, rowStart, col) ;
- X continue;
- X
- X case KEY_RIGHT:
- X if (col < colEnd - 1 &&
- X (*(charKeyed + col - colStart) == 'Y' ||
- X *(charKeyed + col - colStart) == 'M' ) )
- X col++;
- X else
- X BELL;
- X while (col < colEnd &&
- X *(charKeyed + col - colStart) == 'M')
- X col++;
- X while (*(charKeyed + col - colStart) == 'M')
- X col--;
- X wmove(win, rowStart, col) ;
- SHAR_EOF
- echo "End of part 8"
- echo "File utilities.d/libgeti.d/GetInput.c is continued in part 9"
- echo "9" > s2_seq_.tmp
- exit 0
-