home *** CD-ROM | disk | FTP | other *** search
- From: pjc@pcbox.UUCP (Paul J. Condie)
- Newsgroups: alt.sources
- Subject: menu(1) part 5 of 11
- Message-ID: <427@pcbox.UUCP>
- Date: 6 Apr 90 17:39:58 GMT
-
-
- #!/bin/sh
- # this is part 5 of a multipart archive
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file RunPopMenu.c continued
- #
- CurArch=5
- 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 RunPopMenu.c"
- sed 's/^X//' << 'SHAR_EOF' >> RunPopMenu.c
- X for (i = 0; i < pmenu.optioncount; i++)
- X strcpy (PopMenu[i], pmenu.option[i]->description);
- X strcpy (PopMenu[i], "");
- X popmenu (INITMENU, popmid, row, col, poptitle, HELPFILE,
- X LINES-2, sizeof(PopMenu[0]), PopMenu);
- X
- X rc = popmenu (popmid);
- X
- X /* run option selected */
- X if (rc > 0)
- X {
- X for (i = 1; i <= MAXKEYS && strcmp (KeyWord[i], "") != 0; i++)
- X if (strcmp (pmenu.option[rc-1]->keyword,
- X KeyWord[i]) == 0)
- X {
- X if (RunKey[i] != NULL)
- X {
- X /*
- X ** Dim box is option is a .POPMENU or
- X ** a .GETINPUT or a .SYSTEM GETINPUT
- X */
- X comptr = pmenu.option[rc-1]->command;
- X SKIPJUNK(comptr);
- X sscanf (comptr, "%s", command);
- X if (strcmp (pmenu.option[rc-1]->keyword, ".POPMENU") == 0 ||
- X strcmp (pmenu.option[rc-1]->keyword, ".GETINPUT") == 0 ||
- X (strcmp (pmenu.option[rc-1]->keyword, ".SYSTEM") == 0 &&
- X strcmp (command, "GETINPUT") == 0))
- X popmenu (UNHILIGHTBOX, popmid);
- X
- X rc = (*RunKey[i]) (&pmenu, rc-1,
- X KeyWord, ParseKey, ShowKey,
- X RunKey, gnames, gfiles, gindex);
- X }
- X break;
- X }
- X }
- X else
- X rc = 0; /* popmenu was cancelled, continue */
- X
- X popmid--;
- X
- X clean_menu (&pmenu);
- X
- X if (DIMFLAG)
- X {
- X /* hilight .BOX */
- X if (menu->boxtype)
- X drawbox (stdscr, 1,1, LINES-1,COLS,
- X menu->boxtype & 0777, StandoutLine,
- X FALSE, FALSE);
- X
- X /* hilight .LINE */
- X if (menu->linetype)
- X drawline (stdscr, menu->titlecount-1,
- X menu->linetype & 0777, StandoutLine,
- X menu->boxtype);
- X }
- X
- X touchwin (stdscr);
- X
- X if (rc != 0)
- X return (rc);
- X else
- X return (REPARSE);
- X}
- X/* Paul J. Condie 10/88 */
- SHAR_EOF
- echo "File RunPopMenu.c is complete"
- chmod 0444 RunPopMenu.c || echo "restore of RunPopMenu.c fails"
- echo "x - extracting RunGetI.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > RunGetI.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "@(#)RunGetI.c 1.3 DeltaDate 1/22/90 ExtrDate 1/22/90";
- X#endif
- X
- X/* FUNCTION: RunGetInpt()
- X** Runs keyword ".GETINPUT".
- X** ARGS: option option info sturcture
- X** RETURNS: none
- X*/
- X
- X#include <curses.h>
- X#include <term.h>
- X#include "menu.h"
- X
- X
- X
- XRunGetInput (menu, opnumber, KeyWord, ParseKey, ShowKey, RunKey,
- X gnames, gfiles, gindex)
- X struct MenuInfo *menu;
- X int opnumber;
- X int (*ParseKey[MAXKEYS])(),
- X (*ShowKey[MAXKEYS])(),
- X (*RunKey[MAXKEYS])();
- X char KeyWord[MAXKEYS][MAXKEYLENGTH];
- X char gnames[MAXGNAME][15];
- X char gfiles[MAXGNAME][15];
- X int gindex;
- X{
- X char screen_name[50];
- X int rc; /* return code */
- X
- X /*
- X ** The first argument is the screen name
- X */
- X sscanf (menu->option[opnumber]->command, "%s", screen_name);
- X rc = runscreen (screen_name, menu, opnumber);
- X if (rc == KEY_CANCEL)
- X return (0);
- X else
- X return (REPARSE);
- X}
- SHAR_EOF
- chmod 0444 RunGetI.c || echo "restore of RunGetI.c fails"
- echo "x - extracting GetOption.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > GetOption.c &&
- Xstatic char Sccsid[] = "%W% DeltaDate %G% ExtrDate %H%";
- X#include <curses.h>
- X#include <ctype.h>
- X#include "menu.h"
- X#include "terminal.h"
- X
- Xextern int HotKeys;
- X int ch; /* input character */
- X
- X
- XGetOption (row, col, s)
- X
- X int row; /* row to get user input */
- X int col; /* col to get user input */
- X char *s; /* memory string to store input */
- X{
- X char *findfile();
- X char *getenv();
- X char *ws; /* working string */
- X int cc; /* column count */
- X int i; /* work variable */
- X char hlpfile[100];
- X
- X
- X ws = s; /* set to memory string */
- X cc = col;
- X
- X for (i = col; i <= col+3; i++) /* blank out prompt field */
- X mvaddch (row, i, ' ');
- X /* display default text */
- X while (*ws)
- X {
- X move (row, cc++);
- X addch (*ws);
- X ws++;
- X }
- X /* loop until done */
- X for (;;)
- X {
- X move (row, cc);
- X refresh ();
- X ch = getch ();
- X move (ErrRow, 0); clrtoeol ();
- X
- 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 == KeyReturn) ch = KEY_RETURN;
- X if (ch == KeyBackspace) ch = KEY_BACKSPACE;
- X if (ch == KeyRedraw) ch = KEY_REFRESH;
- X if (ch == KeyHelp) ch = KEY_HELP;
- X if (ch == KeyMainMenu) ch = KEY_MAINMENU;
- X if (ch == KeyPrevMenu) ch = KEY_PREVMENU;
- X if (ch == KeyExitMenu) ch = KEY_EXITMENU;
- X if (ch == KeyGname) ch = KEY_GNAME;
- X if (ch == KeyPopGname) ch = KEY_POPGNAME;
- X
- X if (ch >= 'a' && ch <= 'z')
- X ch = toupper (ch);
- X
- X switch (ch)
- X {
- X case KEY_DOWN:
- X case KEY_UP:
- X case KEY_TAB:
- X case KEY_BTAB:
- X *s = '\0'; /* reset select to null */
- X case KEY_RETURN:
- X case KEY_LINEFEED:
- X case '0':
- X case '1':
- X case '2':
- X case '3':
- X case '4':
- X case '5':
- X case '6':
- X case '7':
- X case '8':
- X case '9':
- X return (ch);
- X
- X case '!':
- X if (getenv ("SHELL") != (char *)NULL)
- X return (ch);
- X break;
- X
- X case KEY_HELP:
- X case KEY_EXITMENU:
- X case KEY_MAINMENU:
- X case KEY_PREVMENU:
- X case KEY_GNAME:
- X if (HotKeys)
- X {
- X return (ch);
- X }
- X else
- X {
- X if (ch == KEY_HELP)
- X *ws = KeyHelp;
- X else if (ch == KEY_EXITMENU)
- X *ws = KeyExitMenu;
- X else if (ch == KEY_MAINMENU)
- X *ws = KeyMainMenu;
- X else if (ch == KEY_PREVMENU)
- X *ws = KeyPrevMenu;
- X else if (ch == KEY_GNAME)
- X *ws = KeyGname;
- X move (row, cc);
- X addch (*ws);
- X ws++;
- X *ws = '\0';
- X cc++; /*move over one column*/
- X }
- X break;
- X
- X case KEY_BACKSPACE:
- X if (cc == col)
- X continue;
- X else
- X {
- X move (row, --cc); /* back up one column */
- X addch (' ');
- X ws--;
- X *ws = '\0';
- X }
- X break;
- X
- X case KEY_REFRESH:
- X /* redraw screen */
- X clearok (stdscr, TRUE);
- X refresh ();
- X break;
- X
- X case KEY_POPGNAME:
- X return (KeyPopGname);
- X
- X case ' ':
- X case 'A':
- X case 'B':
- X case 'C':
- X case 'D':
- X case 'E':
- X case 'F':
- X case 'G':
- X case 'H':
- X case 'I':
- X case 'J':
- X case 'K':
- X case 'L':
- X case 'M':
- X case 'N':
- X case 'O':
- X case 'P':
- X case 'Q':
- X case 'R':
- X case 'S':
- X case 'T':
- X case 'U':
- X case 'V':
- X case 'W':
- X case 'X':
- X case 'Y':
- X case 'Z':
- X return (ch);
- X
- X default:
- X if (isprint (ch))
- X {
- X *ws = ch;
- X move (row, cc);
- X addch (*ws);
- X ws++;
- X *ws = '\0';
- X cc++; /*move over one column*/
- X }
- X break;
- X } /* end switch */
- X } /* end for */
- X}
- SHAR_EOF
- chmod 0644 GetOption.c || echo "restore of GetOption.c fails"
- echo "x - extracting EndWindow.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > EndWindow.c &&
- Xstatic char Sccsid[] = "@(#)EndWindow.c 1.1 DeltaDate 9/6/87 ExtrDate 1/22/90";
- X/* FUNCTION: EndWindow()
- X** When a "WINDOW" keyword is found this function
- X** recalculates the row and column to begin
- X** displaying the next subwindow.
- X** ARGS: menu current menu structure
- X*/
- X
- X#include "menu.h"
- X
- Xextern int swin, ewin, longest;
- X
- X
- XEndWindow (menu)
- X
- X struct MenuInfo *menu;
- X{
- X int i;
- X
- X
- X if (swin == ewin) return;
- X
- X longest += 5;
- X
- X/*
- X** Calculate what row and column to display option on.
- X*/
- X
- X for (i = swin; i < ewin; i++)
- X {
- X menu->option[i]->row = ((menu->wlrow - menu->wfrow) / 2 + menu->wfrow) -
- X ((ewin - swin) / 2) + i - swin;
- X menu->option[i]->col = (menu->wlcol - menu->wfcol) / 2 -
- X longest / 2 + menu->wfcol;
- X }
- X}
- SHAR_EOF
- chmod 0444 EndWindow.c || echo "restore of EndWindow.c fails"
- echo "x - extracting displaytxt.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > displaytxt.c &&
- Xstatic char Sccsid[] = "@(#)displaytxt.c 1.2 DeltaDate 1/22/90 ExtrDate 1/22/90";
- X
- X/* FUNCTION: displaytext()
- X** Displays a string to the screen with atributes.
- X** ARGS: row screen row
- X** col screen col
- X** s the string
- X** RETURNS: none
- X*/
- X
- X#include <curses.h>
- X
- Xdisplaytext (row, col, s)
- X
- X int row, col;
- X char s[];
- X{
- X int i;
- X
- X move (row, col);
- X
- X/*
- X** Now display looking for terminal attributes.
- X*/
- X for (i = 0; s[i] != '\0'; i++)
- X {
- X if (s[i] == '\\')
- X {
- X#ifdef BSD
- X if (s[i+1] != 'N') s[i+1] = 'S'; /* Berk only supports standout */
- X#endif
- X switch (s[++i])
- X {
- X case 'S':
- X#ifdef BSD
- X standout ();
- X#else
- X attrset (stdscr->_attrs|A_STANDOUT);
- X#endif
- X break;
- X case 'B':
- X#ifdef SYS5
- X attrset (stdscr->_attrs|A_BOLD);
- X#endif
- X break;
- X case 'U':
- X#ifdef SYS5
- X attrset (stdscr->_attrs|A_UNDERLINE);
- X#endif
- X break;
- X case 'D':
- X#ifdef SYS5
- X attrset (stdscr->_attrs|A_DIM);
- X#endif
- X break;
- X case 'R':
- X#ifdef SYS5
- X attrset (stdscr->_attrs|A_REVERSE);
- X#endif
- X break;
- X case 'L':
- X#ifdef SYS5
- X attrset (stdscr->_attrs|A_BLINK);
- X#endif
- X break;
- X case 'N':
- X#ifdef BSD
- X standend ();
- X#else
- X attrset (A_NORMAL);
- X#endif
- X break;
- X }
- X }
- X else
- X addch (s[i]);
- X }
- X}
- SHAR_EOF
- chmod 0444 displaytxt.c || echo "restore of displaytxt.c fails"
- echo "x - extracting SetTerm.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > SetTerm.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "%W% DeltaDate %G% ExtrDate %H%";
- X#endif
- X
- X#include <curses.h>
- X#include "menu.h"
- X
- X /* default values for dumb terminals */
- X /* a -1 indicates nokey */
- X/* Mover Keys */
- Xint KeyReturn = '\r'; /* \r - menu & GetInput */
- Xint KeyDown = 10; /* \n - menu & GetInput */
- Xint KeyUp = 11; /* ^k - menu & GetInput */
- Xint KeyTab = '\t'; /* \t - menu & GetInput */
- Xint KeyBTab = -1; /* - menu & GetInput */
- X
- X/* Edit Keys */
- Xint KeyBeg = 2; /* ^b - GetInput */
- Xint KeyEnd = 5; /* ^e - GetInput */
- Xint KeyRight = 12; /* ^l - GetInput */
- Xint KeyLeft = 8; /* \b - GetInput */
- Xint KeyBackspace = '\b'; /* \b - GetInput */
- Xint KeyEOL = 4; /* ^d - GetInput clear to end of field */
- Xint KeyDL = 3; /* ^c - GetInput clear field and home cursor */
- Xint KeyDC = 24; /* ^x - GetInput delete character */
- Xint KeyIC = 20; /* ^t - GetInput typeover/insert mode */
- X
- X/* Other Keys */
- Xint KeyHelp = '?'; /* ? - menu & GetInput */
- Xint KeyTOC = 20; /* ^t - ShowHelp */
- Xint KeyRedraw = 18; /* ^r - menu & GetInput */
- Xint KeyCancel = 27; /* ESC - menu & GetInput pop-up menus */
- Xint KeySave = 6; /* ^f - GetInput save screen to a file */
- Xint KeyPrint = 16; /* ^p - GetInput prints screen to lp */
- Xint KeyAccept = 1; /* ^a - GetInput accepts input */
- X
- X
- X/* Menu Specific */
- Xint HotKeys = 0; /* for hot keyboard */
- Xint KeyMainMenu = 'm'; /* goto main menu */
- Xint KeyPrevMenu = 'p'; /* goto previous menu */
- Xint KeyExitMenu = 'e'; /* exit menu */
- Xint KeyGname = 'g'; /* goto a specific menu (dumb) */
- Xint KeyPopGname = 7; /* ^g - goto a specific menu (popmenu) */
- X
- X
- X
- XSetTerm ()
- X{
- X FILE *fopen(), *menuinit;
- X char *getenv();
- X char *findfile();
- X char *strchr();
- X char *ws;
- X char filename[100], line[BUFSIZE];
- X char *s1;
- X
- X
- X char *terminal;
- X
- X /*
- X ** Parse the .menuinit file
- X ** First look in current directory then $HOME then in $MENUDIR
- X */
- X strcpy (filename, findfile (MENUINIT, ".",
- X (char *)getenv("HOME"), (char *)getenv("MENUDIR"), ""));
- X if ((menuinit = fopen (filename, "r")) == NULL)
- X {
- X /* no file found - use the defaults */
- X return (0);
- X }
- X
- X /* set terminal keys */
- X while (fgets (line, BUFSIZE, menuinit) != (char *)NULL)
- X {
- X if (strncmp ("HOTKEYS", line, 7) == 0)
- X HotKeys = 1;
- X
- X /*
- X ** The following keywords require a = sign
- X */
- X
- X if ((s1 = strchr (line, '=')) == (char *)NULL)
- X continue;
- X
- X s1++; /* get past the = */
- X
- X /* Mover Keys */
- X if (strncmp ("KEY_RETURN", line, 10) == 0)
- X sscanf (s1, "%d", &KeyReturn);
- X else if (strncmp ("KEY_DOWN", line, 8) == 0)
- X sscanf (s1, "%d", &KeyDown);
- X else if (strncmp ("KEY_UP", line, 6) == 0)
- X sscanf (s1, "%d", &KeyUp);
- X else if (strncmp ("KEY_TAB", line, 7) == 0)
- X sscanf (s1, "%d", &KeyTab);
- X else if (strncmp ("KEY_BTAB", line, 8) == 0)
- X sscanf (s1, "%d", &KeyBTab);
- X
- X /* Edit Keys */
- X else if (strncmp ("KEY_BEG", line, 7) == 0)
- X sscanf (s1, "%d", &KeyBeg);
- X else if (strncmp ("KEY_END", line, 7) == 0)
- X sscanf (s1, "%d", &KeyEnd);
- X else if (strncmp ("KEY_RIGHT", line, 9) == 0)
- X sscanf (s1, "%d", &KeyRight);
- X else if (strncmp ("KEY_LEFT", line, 8) == 0)
- X sscanf (s1, "%d", &KeyLeft);
- X else if (strncmp ("KEY_BACKSPACE", line, 13) == 0)
- X sscanf (s1, "%d", &KeyBackspace);
- X else if (strncmp ("KEY_EOL", line, 13) == 0)
- X sscanf (s1, "%d", &KeyEOL);
- X else if (strncmp ("KEY_DL", line, 14) == 0)
- X sscanf (s1, "%d", &KeyDL);
- X else if (strncmp ("KEY_DC", line, 6) == 0)
- X sscanf (s1, "%d", &KeyDC);
- X else if (strncmp ("KEY_IC", line, 6) == 0)
- X sscanf (s1, "%d", &KeyIC);
- X
- X /* Other Keys */
- X else if (strncmp ("KEY_HELP", line, 8) == 0)
- X sscanf (s1, "%d", &KeyHelp);
- X else if (strncmp ("KEY_REFRESH", line, 10) == 0)
- X sscanf (s1, "%d", &KeyRedraw);
- X else if (strncmp ("KEY_ACCEPT", line, 10) == 0)
- X sscanf (s1, "%d", &KeyAccept);
- X else if (strncmp ("KEY_CANCEL", line, 10) == 0)
- X sscanf (s1, "%d", &KeyCancel);
- X else if (strncmp ("KEY_SAVE", line, 8) == 0)
- X sscanf (s1, "%d", &KeySave);
- X else if (strncmp ("KEY_PRINT", line, 9) == 0)
- X sscanf (s1, "%d", &KeyPrint);
- X else if (strncmp ("KEY_EXITMENU", line, 12) == 0)
- X sscanf (s1, "%d", &KeyExitMenu);
- X else if (strncmp ("KEY_MAINMENU", line, 12) == 0)
- X sscanf (s1, "%d", &KeyMainMenu);
- X else if (strncmp ("KEY_PREVMENU", line, 12) == 0)
- X sscanf (s1, "%d", &KeyPrevMenu);
- X else if (strncmp ("KEY_GNAME", line, 9) == 0)
- X sscanf (s1, "%d", &KeyGname);
- X else if (strncmp ("KEY_POPGNAME", line, 12) == 0)
- X sscanf (s1, "%d", &KeyPopGname);
- X else if (strncmp ("KEY_TOC", line, 7) == 0)
- X sscanf (s1, "%d", &KeyTOC);
- X }
- X fclose (menuinit);
- X return (0);
- X}
- X/* Paul J. Condie 11/88 */
- SHAR_EOF
- chmod 0644 SetTerm.c || echo "restore of SetTerm.c fails"
- echo "x - extracting systime.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > systime.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "@(#)systime.c 1.2 DeltaDate 5/6/88 ExtrDate 1/22/90";
- X#endif
- X
- X#include <stdio.h>
- X#include <time.h>
- X
- Xsystime (timeStr, mask)
- X
- X char *timeStr, *mask;
- X{
- X long tloc ;
- X struct tm *ltime, *localtime() ;
- X char tmpstr[4] ;
- X int tmpval;
- X
- X tloc = time((long *) 0) ;
- X ltime = localtime(&tloc) ;
- X
- X ltime->tm_mon++;
- X
- X if (mask == NULL)
- X {
- X sprintf (timeStr, "%2d:%02d:%02d", ltime->tm_hour, ltime->tm_min,
- X ltime->tm_sec) ;
- X }
- X else
- X while (*mask != '\0')
- X {
- X switch (*mask)
- X {
- X case 'H':
- X if (ltime->tm_hour > 12)
- X {
- X tmpval = ltime->tm_hour - 12;
- X sprintf (tmpstr, "%2d", tmpval);
- X }
- X else
- X sprintf (tmpstr, "%2d", ltime->tm_hour);
- X break;
- X case 'M':
- X sprintf (tmpstr, "%02d", ltime->tm_min);
- X break;
- X case 'S':
- X sprintf (tmpstr, "%02d", ltime->tm_sec);
- X break;
- X case 'I':
- X sprintf (tmpstr, "%2d", ltime->tm_hour);
- X break;
- X case 'Z':
- X if (ltime->tm_hour >= 12)
- X strcpy (tmpstr, "PM");
- X else
- X strcpy (tmpstr, "AM");
- X break;
- X case 'z':
- X if (ltime->tm_hour >= 12)
- X strcpy (tmpstr, "pm");
- X else
- X strcpy (tmpstr, "am");
- X break;
- X default:
- X *timeStr = *mask;
- X timeStr++;
- X mask++;
- X continue;
- X } /* end switch */
- X *timeStr = tmpstr[0];
- X timeStr++;
- X *timeStr = tmpstr[1];
- X timeStr++;
- X mask += 2;
- X } /* end while */
- X
- X *timeStr = '\0';
- X return (0);
- X}
- SHAR_EOF
- chmod 0444 systime.c || echo "restore of systime.c fails"
- echo "x - extracting sysdate.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > sysdate.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "@(#)sysdate.c 1.1 DeltaDate 9/6/87 ExtrDate 1/22/90";
- X#endif
- X
- X#include <time.h>
- X
- Xsysdate (dateStr, mask)
- X
- X char *dateStr, *mask;
- X{
- X long tloc ;
- X struct tm *ltime, *localtime() ;
- X
- Xstatic char *shortmon[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
- X "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
- X
- Xstatic char *longmon[]=
- X {"January","February","March","April","May","June",
- X "July","August","September","October","November","December"};
- X
- Xstatic char *shortday[]= {"sun","mon","tue","wed","thr","fri","sat"};
- X
- Xstatic char *longday[]= {"Sunday","Monday","Tuesday","Wednessday",
- X "Thursday", "Friday", "Saturday"};
- X
- X
- X tloc = time ((long *) 0) ;
- X ltime = localtime (&tloc) ;
- X
- X while (*mask != '\0')
- X {
- X
- X/*
- X** Process month
- X*/
- X if (strncmp (mask, "mmmmm", 5) == 0)
- X {
- X sprintf (dateStr, "%s", longmon[ltime->tm_mon]);
- X mask += 5;
- X dateStr += strlen (longmon[ltime->tm_mon]);
- X continue;
- X }
- X else
- X if (strncmp (mask, "mmm", 3) == 0)
- X {
- X sprintf (dateStr, "%s", shortmon [ltime->tm_mon]);
- X mask += 3;
- X dateStr += 3;
- X continue;
- X }
- X else
- X if (strncmp (mask, "mm", 2) == 0)
- X {
- X sprintf (dateStr, "%.2d", ltime->tm_mon + 1);
- X mask += 2;
- X dateStr += 2;
- X continue;
- X }
- X
- X/*
- X** Process day
- X*/
- X if (strncmp (mask, "ddddd", 5) == 0)
- X {
- X sprintf (dateStr, "%s", longday [ ltime->tm_wday ]);
- X mask += 5;
- X dateStr += strlen (longday[ltime->tm_wday]);
- X continue;
- X }
- X else
- X if (strncmp (mask, "ddd", 3) == 0)
- X {
- X sprintf (dateStr, "%s", shortday [ltime->tm_wday]);
- X mask += 3;
- X dateStr += 3;
- X continue;
- X }
- X else
- X if (strncmp (mask, "dd", 2) == 0)
- X {
- X sprintf (dateStr, "%.2d", ltime->tm_mday);
- X mask += 2;
- X dateStr += 2;
- X continue;
- X }
- X if (strncmp (mask, "jjj", 3) == 0)
- X {
- X sprintf (dateStr, "%3d", ltime->tm_yday + 1);
- X mask += 3;
- X dateStr += 3;
- X continue;
- X }
- X
- X/*
- X** Process year
- X*/
- X if (strncmp (mask, "yyyy", 4) == 0)
- X {
- X sprintf (dateStr, "19%.2d", ltime->tm_year);
- X mask += 4;
- X dateStr += 4;
- X continue;
- X }
- X else
- X if (strncmp (mask, "yy", 2) == 0)
- X {
- X sprintf (dateStr, "%.2d", ltime->tm_year);
- X mask += 2;
- X dateStr += 2;
- X continue;
- X }
- X
- X/*
- X** Process mask
- X*/
- X *dateStr = *mask;
- X dateStr++;
- X mask++;
- X }
- X
- X *dateStr = '\0';
- X return (0);
- X}
- SHAR_EOF
- chmod 0444 sysdate.c || echo "restore of sysdate.c fails"
- echo "x - extracting TrapSignal.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > TrapSignal.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "@(#)TrapSignal.c 1.2 DeltaDate 5/6/88 ExtrDate 1/22/90";
- X#endif
- X
- X#include <signal.h>
- X
- XTrapSignal (action)
- X
- X int (*action)();
- X{
- X if (signal (SIGINT, SIG_IGN) != SIG_IGN) signal (SIGINT, action);
- X if (signal (SIGQUIT, SIG_IGN) != SIG_IGN) signal (SIGQUIT, action);
- X}
- SHAR_EOF
- chmod 0444 TrapSignal.c || echo "restore of TrapSignal.c fails"
- echo "x - extracting checkmail.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > checkmail.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "@(#)checkmail.c 1.3 DeltaDate 1/22/90 ExtrDate 1/22/90";
- X#endif
- X
- X#include <curses.h>
- X#include <signal.h>
- X
- X#ifndef BELL
- X#define BELL printf ("%c", 7);
- X#endif
- X
- Xextern int mailrow;
- Xextern int mailcol;
- X
- Xcheckmail ()
- X{
- X int rc;
- X static int mailcheck = 30; /* default */
- X
- X#ifdef ALARM
- X alarm (0); /* turn off alarm */
- X#endif
- X if ((rc = anymail()) != FALSE)
- X {
- X /* we got mail */
- X attrset (A_REVERSE);
- X if (rc == 1 || rc == 3)
- X mvprintw (mailrow,mailcol, "MAIL");
- X else
- X mvprintw (mailrow,mailcol, "EMAIL");
- X attrset (A_NORMAL);
- X#ifdef ALARM
- X BELL;
- X#endif
- X }
- X else
- X mvprintw (mailrow,mailcol, " ");
- X
- X#ifdef ALARM
- X signal (SIGALRM, checkmail);
- X if ((char *)getenv("MAILCHECK") != (char *)0)
- X sscanf ((char *)getenv("MAILCHECK"), "%d", &mailcheck);
- X if (mailcheck < 10)
- X mailcheck = 10;
- X alarm (mailcheck); /* set alarm again */
- X#endif
- X}
- X/* Paul J. Condie 4/88 */
- SHAR_EOF
- chmod 0444 checkmail.c || echo "restore of checkmail.c fails"
- echo "x - extracting anymail.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > anymail.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "@(#)anymail.c 1.3 DeltaDate 1/22/90 ExtrDate 1/22/90";
- X#endif
- X
- X/* FUNCTION: anymail()
- X** If the first word in the mail file is Forward it returns
- X** no mail.
- X** RETURNS: FALSE - no unix or email.
- X** 1 - unix mail.
- X** 2 - email
- X** 3 - both unix and email
- X*/
- X#include <stdio.h>
- X#include <sys/types.h>
- X#include <sys/stat.h>
- X
- Xanymail ()
- X{
- X FILE *fopen(), *fp;
- X char *getenv();
- X struct stat Statbuf;
- X int rc = 0; /* return code */
- X char *mailfile;
- X static int FIRST_TIME = 1;
- X static int FORWARDFLAG = 0;
- X char tmpstr[80];
- X
- X
- X if ((mailfile = getenv("MAIL")) != (char *)0)
- X if (stat (mailfile, &Statbuf) == 0)
- X {
- X /* there is a mail file */
- X if (Statbuf.st_size > 0)
- X {
- X /* there is something in the mail file */
- X if (FIRST_TIME)
- X {
- X /* check to see if mail is being Forwarded */
- X FIRST_TIME = 0;
- X if ((fp=fopen (mailfile, "r")) != (FILE *)NULL)
- X {
- X fscanf (fp, "%s", tmpstr);
- X if (strcmp (tmpstr, "Forward") == 0)
- X FORWARDFLAG = 1;
- X fclose (fp);
- X }
- X }
- X if (!FORWARDFLAG)
- X rc = 1;
- X }
- X }
- X if ((mailfile = getenv("EMAIL")) != (char *)0)
- X if (stat (mailfile, &Statbuf) == 0)
- X {
- X if (Statbuf.st_size > 0)
- X rc = rc == 1 ? 3 : 2;
- X }
- X return (rc);
- X}
- SHAR_EOF
- chmod 0444 anymail.c || echo "restore of anymail.c fails"
- echo "x - extracting setenv.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > setenv.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "@(#)setenv.c 1.2 DeltaDate 1/22/90 ExtrDate 1/22/90";
- X#endif
- X
- X/* PROGRAM NAME: @(#)setenv.c 1.2
- X* REVISION DATE:
- X* REVISION LEVEL:
- X* CONTACT PERSON: Library Staff
- X* AUTHOR: Stephen J. Muir
- X* ABSTRACT: setenv/delenv - add, change or delete environment variables
- X* KEYWORDS: environment, shell, getenv
- X* DESCRIPTION: Setenv allows a program to set environment variables.
- X* delenv allows a program to delete environment variables.
- X* PROJECTS:
- X* SOFTWARE CATEGORY: application development tools
- X* COPYRIGHT: Notice
- X This is the confidential, unpublished property of Pacific Bell.
- X Receipt or possession of it does not convey any rights to divulge,
- X reproduce, use, or allow others to use it without the specific written
- X authorization of Pacific Bell and use must conform strictly to
- X the license agreement between user and Pacific Bell.
- X
- X COPYRIGHT (c) 1986 Pacific Bell. All Rights Reserved.
- X
- X* OPERATING ENVIRONMENT: all standard AT&T UNIX machines.
- X* SOFTWARE DEPENDENCIES: none.
- X* HARDWARE DEPENDENCIES:
- X* LIMITATIONS:
- X* DOCUMENTATION: setenv.3 manual page
- X* COMPILE COMMAND: cc setenv.c
- X* SIZE:
- X* SUPPORT LEVEL:
- X* MODULE LIST:
- X*/
- X# include <string.h>
- X
- X/* This is the number of extra array elements to allocate each time it becomes
- X * necessary.
- X */
- X# define INC 10
- X
- Xextern char **environ, *malloc ();
- Xextern int free ();
- X
- Xstatic char **original, **current, **limit;
- X
- X/* This routine should be called only once (when either "setenv" or "delenv" is
- X * called for the first time). It would only be called again if it fails due
- X * to lack of memory. It makes a copy of the original environment because the
- X * original environment array and its elements were not obtained from "malloc"
- X * and the "free" routine cannot, therefore, be called with any of its
- X * elements.
- X *
- X * return values:
- X * 0: success
- X * -1: out of memory - nothing has changed
- X */
- Xstatic /* this is a private routine */
- Xinitialise ()
- X { register char **old, **new_ptr, *tmp, **new_env;
- X
- X /* count number of existing strings */
- X for (old = environ; *old; ++old)
- X ;
- X
- X /* make space for extra strings */
- X if ((new_ptr =
- X new_env =
- X (char **)malloc (sizeof (char **) * ((old - environ) + INC + 1))
- X )
- X == 0
- X )
- X return (-1);
- X
- X /* "limit" points to the last element of the array -- it is used to
- X * decide when to recreate it
- X */
- X limit = new_env + (old - environ) + INC;
- X
- X /* copy across old strings */
- X for (old = environ; *old; ++old)
- X { if ((tmp = malloc (strlen (*old) + 1)) == 0)
- X { /* out of memory -- undo everything */
- X while (new_ptr != new_env)
- X free (*--new_ptr);
- X free ((char *)new_ptr);
- X return (-1);
- X }
- X strcpy (tmp, *old);
- X *new_ptr++ = tmp;
- X }
- X /* "current" points to the null pointer at the end of the array */
- X *(current = new_ptr) = 0;
- X
- X /* this is really just a flag to say it's initialised */
- X original = environ;
- X /* overwrite old environment with new */
- X environ = new_env;
- X return (0);
- X }
- X
- X/* This is a special routine to compare a string "name" of the form "NAME" with
- X * a string "name_value" of the form "NAME=VALUE". It returns zero if the
- X * comparison is successful
- X */
- Xstatic /* this is a private routine */
- Xdiffer (name, name_value)
- X char *name, *name_value;
- X { while (*name && *name_value)
- X if (*name++ != *name_value++)
- X return (1);
- X return (*name_value != '=');
- X }
- X
- X/* This routine deletes an environment variable, e.g. delenv ("SHELL");
- X *
- X * return values:
- X * 0: success
- X * 1: environment variable not found
- X * -1: out of memory - nothing has changed
- X */
- Xdelenv (name)
- X char *name;
- X { register char **ptr;
- X
- X /* initialise if necessary */
- X if (original == 0 && initialise ())
- X return (-1);
- X
- X /* attempt to find it */
- X for (ptr = environ; *ptr && differ (name, *ptr); ++ptr)
- X ;
- X if (*ptr == 0)
- X return (1); /* not found */
- X
- X /* delete it */
- X free (*ptr);
- X *ptr = *--current;
- X *current = 0;
- X return (0);
- X }
- X
- X/* This routine sets a new environment variable, replacing an existing one
- X * where appropriate, e.g. setenv ("SHELL", "/bin/csh");
- X *
- X * return values:
- X * 0: success
- X * -1: out of memory - nothing has changed
- X */
- Xsetenv (name, value)
- X char *name, *value;
- X { register char **old, **new_ptr, *cp, *tmp, **new_env;
- X
- X /* initialise if necessary */
- X if (original == 0 && initialise ())
- X return (-1);
- X
- X /* allocate space for the new string */
- X if ((cp = tmp = malloc (strlen (name) + strlen (value) + 2)) == 0)
- X return (-1);
- X
- X /* find an existing one if we can - we do this now as we will lose
- X * the original "name" pointer in the while loop following
- X */
- X for (old = environ; *old && differ (name, *old); ++old)
- X ;
- X
- X /* make the new entry */
- X while (*name)
- X *cp++ = *name++;
- X *cp++ = '=';
- X while (*value)
- X *cp++ = *value++;
- X *cp = '\0';
- X
- X /* case 1: overwrite previous value */
- X if (*old)
- X { free (*old);
- X *old = tmp;
- X }
- X
- X /* case 2: no previous value and no space left - allocate more */
- X else if (current == limit)
- X { if ((new_ptr =
- X new_env =
- X (char **)malloc (sizeof (char **) *
- X ((old - environ) + INC + 1)
- X )
- X ) == 0
- X )
- X { free (tmp);
- X return (-1);
- X }
- X limit = new_env + (old - environ) + INC;
- X for (old = environ; *old; )
- X *new_ptr++ = *old++;
- X *new_ptr++ = tmp;
- X *(current = new_ptr) = 0;
- X free ((char *)environ);
- X environ = new_env;
- X }
- X
- X /* case 3: no previous value and there is enough space */
- X else
- X { *current++ = tmp;
- X *current = 0;
- X }
- X return (0);
- X }
- SHAR_EOF
- chmod 0444 setenv.c || echo "restore of setenv.c fails"
- echo "x - extracting strmatch.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > strmatch.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "@(#)strmatch.c 1.1 DeltaDate 10/20/88 ExtrDate 1/22/90";
- X#endif
- X
- X#ifndef TRUE
- X#define TRUE 1
- X#endif
- X#ifndef FALSE
- X#define FALSE 0
- X#endif
- X#ifndef BOOL
- X#define BOOL int
- X#endif
- X
- X#define M_ALL '*'
- X#define M_ONE '?'
- X#define M_SET '['
- X#define M_RNG '-'
- X#define M_END ']'
- X
- X
- XBOOL strmatch (name, pat)
- X
- X char *name, *pat;
- X{
- X char c, k;
- X BOOL ok;
- X
- X
- X while ((c = *pat++) != '\0')
- X {
- X switch (c)
- X {
- X case M_ONE:
- X if (*name++ == '\0') return (FALSE);
- X break;
- X
- X case M_ALL:
- X if (*pat == '\0') return (TRUE);
- X for (; *name != '\0'; ++name)
- X if (strmatch (name, pat)) return (TRUE);
- X return (FALSE);
- X
- X case M_SET:
- X ok = FALSE;
- X k = *name++;
- X while ((c = *pat++) != M_END)
- X if (*pat == M_RNG)
- X {
- X if (c <= k && k <= pat[1])
- X ok = TRUE;
- X pat += 2;
- X }
- X else
- X if (c == k) ok = TRUE;
- X if (!ok) return (FALSE);
- X break;
- X
- X default:
- X if (*name++ != c) return (FALSE);
- X break;
- X }
- X }
- X return (*name == '\0');
- X}
- SHAR_EOF
- chmod 0444 strmatch.c || echo "restore of strmatch.c fails"
- echo "x - extracting setvar.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > setvar.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "@(#)setvar.c 1.5 DeltaDate 1/22/90 ExtrDate 1/22/90";
- X#endif
- X
- X#include <curses.h>
- X#include <ctype.h>
- X#include <string.h>
- X#include "menu.h"
- X
- X
- X
- Xsetvariable (cptr)
- X char **cptr; /* command pointer var=value */
- X{
- X char *getenv();
- X char *getval();
- X char command[BUFSIZ];
- X char variable[100];
- X char value[100];
- X int rc; /* return code */
- X int i, j;
- X
- X if (*cptr == (char *)NULL) return (EOF);
- X
- X /* skip junk characters */
- X for (;**cptr != '\0' && (!isalpha(**cptr)) && (!isdigit(**cptr));
- X (*cptr)++)
- X if (**cptr == '!')
- X break;
- X ;
- X if (**cptr == '\0') return (EOF); /* end of line */
- X
- X /* get the enviroment variable */
- X for (i = 0; **cptr != '=' && **cptr != '\0'; i++, (*cptr)++)
- X variable[i] = **cptr;
- X variable[i] = '\0';
- X if (strcmp (variable, "") == 0 || **cptr != '=')
- X {
- X BEEP;
- X mvprintw (ErrRow-2, 0,
- X "Error occured while setting enviroment variable %s",
- X command);
- X shutdown ();
- X }
- X (*cptr)++; /* get past the = */
- X
- X strcpy (value, getval (cptr, '0'));
- X
- X /* set the enviroment variable */
- X if (variable[0] == '!')
- X {
- X /*
- X ** if !
- X ** then only set if not already set
- X */
- X /* junk ! - shift left one */
- X for (i = 0; variable[i] != '\0'; i++)
- X variable[i] = variable[i+1];
- X rc = 0;
- X if (getenv(variable) == (char *)NULL)
- X rc = setenv (variable, value);
- X }
- X else
- X rc = setenv (variable, value);
- X if (rc != 0)
- X {
- X BEEP;
- X mvprintw (ErrRow-2, 0,
- X "Error occured while setting enviroment variable %s",
- X command);
- X shutdown ();
- X }
- X return (0);
- X}
- X/* Paul J. Condie 10/88 */
- SHAR_EOF
- chmod 0444 setvar.c || echo "restore of setvar.c fails"
- echo "x - extracting findfile.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > findfile.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "@(#)findfile.c 1.3 DeltaDate 1/22/90 ExtrDate 1/22/90";
- 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 /* 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 0444 findfile.c || echo "restore of findfile.c fails"
- echo "x - extracting drawline.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > drawline.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "@(#)drawline.c 1.2 DeltaDate 1/22/90 ExtrDate 1/22/90";
- X#endif
- X
- X#include <curses.h>
- X#include <term.h>
- X
- X#define DumbLine 1 /* A_NORMAL */
- X#define StandoutLine 2 /* A_STANDOUT */
- X#define SingleLine 3 /* A_ALTCHARSET */
- X#define MosaicLine 4 /* A_ALTCHARSET */
- X#define DiamondLine 5 /* A_ALTCHARSET */
- X#define DotLine 6 /* A_ALTCHARSET */
- X#define PlusLine 7 /* A_ALTCHARSET */
- X
- X#define CANDRAWGRAPHICS (enter_alt_charset_mode != NULL && \
- X strcmp(enter_alt_charset_mode, "") != 0)
- X
- X
- Xdrawline (win, row, trythis, trythat, box)
- X WINDOW *win;
- X int row;
- X int trythis;
- X int trythat;
- X int box;
- X{
- X int col;
- X int hchar; /* horizonal char */
- X int lchar; /* left char */
- X int rchar; /* right char */
- X int attribute;
- X int boxtype;
- X
- X
- X boxtype = trythis;
- X attribute = (boxtype == DumbLine || boxtype == StandoutLine) ? A_NORMAL : A_ALTCHARSET;
- X if (attribute == A_ALTCHARSET)
- X /* can this terminal do graphics ? */
- X boxtype = CANDRAWGRAPHICS ? trythis : trythat;
- X
- X switch (boxtype)
- X {
- X case DumbLine:
- X /* draw a dumb line */
- X hchar = '-';
- X lchar = '+';
- X rchar = '+';
- X break;
- X
- X case StandoutLine:
- X /* draw a standout line */
- X attribute = A_STANDOUT;
- X hchar = ' ';
- X lchar = ' ';
- X rchar = ' ';
- X break;
- X
- X case SingleLine:
- X /* attempt to draw a graphic single line */
- X hchar = 'q';
- X lchar = 't';
- X rchar = 'u';
- X break;
- X
- X case MosaicLine:
- X hchar = 'a';
- X lchar = 'a';
- X rchar = 'a';
- X break;
- X
- X case DiamondLine:
- X hchar = '`';
- X lchar = '`';
- X rchar = '`';
- X break;
- X
- X case DotLine:
- X hchar = '~';
- X lchar = '~';
- X rchar = '~';
- X break;
- X
- X case PlusLine:
- X hchar = 'n';
- X lchar = 'n';
- X rchar = 'n';
- X break;
- X break;
- X
- X default:
- X return (-1);
- X }
- X
- X#ifdef BSD
- X standout ();
- X#else
- X wattrset (win, attribute);
- X#endif
- X for (col = 0; col <= COLS-1; col++)
- X mvwaddch (win, row, col, hchar);
- X
- X if (box)
- X {
- X mvwaddch (win, row, 0, lchar);
- X mvwaddch (win, row, COLS-1, rchar);
- X }
- X
- X#ifdef BSD
- X standend ();
- X#else
- X wattrset (win, A_NORMAL);
- X#endif
- X return (0);
- X}
- X/* Paul J. Condie 10/88 */
- SHAR_EOF
- chmod 0444 drawline.c || echo "restore of drawline.c fails"
- echo "x - extracting initmenu.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > initmenu.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "@(#)initmenu.c 1.2 DeltaDate 1/22/90 ExtrDate 1/22/90";
- X#endif
- X
- X#include <curses.h>
- X#include "menu.h"
- X
- Xinitmenu (menu)
- X struct MenuInfo *menu;
- X{
- X /* set default menu settings */
- X menu->row_cursor = LINES - 2;
- X menu->col_cursor = COLS - 4;
- X menu->boxtype = 0;
- X menu->linetype = 0;
- X menu->srn[0] = (struct ScreenInfo *)NULL;
- X}
- SHAR_EOF
- chmod 0444 initmenu.c || echo "restore of initmenu.c fails"
- echo "x - extracting keyboard.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > keyboard.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "@(#)keyboard.c 1.3 DeltaDate 1/22/90 ExtrDate 1/22/90";
- X#endif
- X
- X#include <curses.h>
- X#include <term.h>
- X#include "menu.h"
- X
- Xkeyboard ()
- X{
- X char *getenv();
- X int ch;
- X int wrow = 0; /* from row */
- X int wcol = 10; /* from col */
- X int sstart; /* scrool start row */
- X int send; /* scrool end row */
- X int prow; /* print row */
- X int dflag=0;
- X WINDOW *bwin;
- X
- X
- X sstart = wrow + 10;
- X send = wrow + 20;
- X prow = sstart;
- X
- X mvprintw (1,0, "Keyboard");
- X mvprintw (2,4, "Fun");
- X
- X drawbox (stdscr, wrow+1,wcol, wrow+23,wcol+40, StandoutLine,
- X StandoutLine, FALSE, FALSE);
- X mvprintw (2,wcol+40, "StandoutLine");
- X drawbox (stdscr, wrow+2,wcol+1, wrow+22,wcol+39, DumbLine, DumbLine,
- X FALSE, FALSE);
- X mvprintw (3,wcol+39, "DumbLine");
- X
- X /* to get around bug in curses of not turning attributes off */
- X for (ch = 0; ch <= LINES; ch++)
- X {
- X mvprintw (ch,70, "hi");
- X refresh ();
- X mvprintw (ch,70, " ");
- X }
- X
- X /* terminal type */
- X mvprintw (wrow+3, wcol+4, "Terminal = %s", getenv("TERM"));
- X
- X /* DrawLine ? */
- X if (enter_alt_charset_mode == NULL ||
- X strcmp (enter_alt_charset_mode, "") == 0)
- X mvprintw (wrow+4, wcol+4, "Alternate Characters = No");
- X else
- X {
- X dflag++;
- X mvprintw (wrow+4, wcol+4, "Alternate Characters = Yes");
- X
- X mvprintw (5,wcol+44, "Check termcap/terminfo");
- X mvprintw (6,wcol+44, "setting if the alternate");
- X mvprintw (7,wcol+44, "character lines below");
- X mvprintw (8,wcol+44, "don't look right.");
- X
- X bwin = newwin (13, 27, 10, wcol+43);
- X drawbox (bwin, 1,1, 13,27, SingleLine, SingleLine, FALSE,FALSE);
- X drawbox (bwin, 2,2, 12,26, MosaicLine, MosaicLine, FALSE,FALSE);
- X drawbox (bwin, 3,3, 11,25, DiamondLine, DiamondLine, FALSE,FALSE);
- X drawbox (bwin, 4,4, 10,24, DotLine, DotLine, FALSE,FALSE);
- X drawbox (bwin, 5,5, 9,23, PlusLine, PlusLine, FALSE,FALSE);
- X
- X mvwprintw (bwin, 0,7, " SingleLine ");
- X mvwprintw (bwin, 1,7, " MosaicLine ");
- X mvwprintw (bwin, 2,7, " DiamondLine ");
- X mvwprintw (bwin, 3,7, " DotLine ");
- X mvwprintw (bwin, 4,7, " PlusLine ");
- X }
- X
- X /* Show all attributes */
- X mvprintw (11,0, "Curses");
- X mvprintw (12,0, "Attributes");
- X
- X attrset (A_NORMAL);
- X mvprintw (14,0, "NORMAL");
- X attrset (A_STANDOUT);
- X mvprintw (15,0, "STANDOUT");
- X attrset (A_REVERSE);
- X mvprintw (16,0, "REVERSE");
- X attrset (A_UNDERLINE);
- X mvprintw (17,0, "UNDERLINE");
- X attrset (A_BLINK);
- X mvprintw (18,0, "BLINK");
- X attrset (A_DIM);
- X mvprintw (19,0, "DIM");
- X attrset (A_BOLD);
- X mvprintw (20,0, "BOLD");
- X
- X attrset (A_NORMAL);
- X
- X /* key codes */
- X mvprintw (wrow+6,wcol+8, "Press a Key");
- X mvprintw (wrow+7,wcol+8, "Press zero to exit.");
- X
- X /* set up scroll */
- X scrollok (stdscr, TRUE);
- X wsetscrreg (stdscr, sstart, send);
- X
- X mvprintw (sstart-2, wcol+4, " (.menuinit)");
- X attrset (A_BOLD);
- X mvprintw (sstart-1, wcol+4, "char dec hex octal");
- X attrset (A_NORMAL);
- X do
- X {
- X refresh ();
- X if (dflag)
- X {
- X touchwin (bwin);
- X wrefresh (bwin);
- X }
- X move (wrow+6, wcol+8+strlen("Press a Key")+1);
- X refresh ();
- X ch = getch ();
- X
- X /*
- X nodelay (stdscr, TRUE);
- X while ((ch = getch()) != -1)
- X print ch
- X nodelay (stdscr, FALSE);
- X */
- X
- X if (prow > send-2)
- X {
- X scroll (stdscr);
- X attrset (A_STANDOUT);
- X mvprintw (prow+1,wcol-1, " ");
- X mvprintw (prow+1,wcol+39, " ");
- X attrset (A_NORMAL);
- X
- X mvprintw (prow+1,wcol, "|");
- X mvprintw (prow+1,wcol+38, "|");
- X }
- X else
- X prow++;
- X if (ch == '\t')
- X mvprintw (prow,wcol+4, "\t\\t\t%d\t%x\t%o", ch,ch,ch);
- X else if (ch == '\n')
- X mvprintw (prow,wcol+4, "\t\\n\t%d\t%x\t%o",
- X ch,ch,ch);
- X else if (ch == '\r')
- X mvprintw (prow,wcol+4, "\t\\r\t%d\t%x\t%o",
- X ch,ch,ch);
- X else if (ch == '\b')
- X mvprintw (prow,wcol+4, "\t\\b\t%d\t%x\t%o",
- X ch,ch,ch);
- X else
- X mvprintw (prow,wcol+4, "\t%c\t%d\t%x\t%o", ch,ch,ch,ch);
- X
- X } while (ch != '0');
- X if (dflag)
- X {
- X touchwin (bwin);
- X wrefresh (bwin);
- X }
- X}
- X/* Paul J. Condie */
- SHAR_EOF
- chmod 0444 keyboard.c || echo "restore of keyboard.c fails"
- echo "x - extracting runscreen.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > runscreen.c &&
- X#ifndef LINT
- Xstatic char Sccsid[] = "%W% DeltaDate %G% ExtrDate %H%";
- X#endif
- X
- X/* FUNCTION: runscreen()
- X*/
- X
- X#include <curses.h>
- X#include "GetInput.h"
- X#include "menu.h"
- X#include "terminal.h"
- X
- X#define SRN menu->srn[sidx]
- X#define FLD menu->srn[sidx]->field[fidx]
- X
- Xextern int debug;
- X
- X
- Xrunscreen (screen_name, menu, opnumber)
- SHAR_EOF
- echo "End of part 5"
- echo "File runscreen.c is continued in part 6"
- echo "6" > s2_seq_.tmp
- exit 0
-