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

  1. From: pjc@pcbox.UUCP (Paul J. Condie)
  2. Newsgroups: alt.sources
  3. Subject: menu(1)  part 6 of 11
  4. Message-ID: <428@pcbox.UUCP>
  5. Date: 6 Apr 90 17:53:04 GMT
  6.  
  7.  
  8. #!/bin/sh
  9. # this is part 6 of a multipart archive
  10. # do not concatenate these parts, unpack them in order with /bin/sh
  11. # file runscreen.c continued
  12. #
  13. CurArch=6
  14. if test ! -r s2_seq_.tmp
  15. then echo "Please unpack part 1 first!"
  16.      exit 1; fi
  17. ( read Scheck
  18.   if test "$Scheck" != $CurArch
  19.   then echo "Please unpack part $Scheck next!"
  20.        exit 1;
  21.   else exit 0; fi
  22. ) < s2_seq_.tmp || exit 1
  23. echo "x - Continuing file runscreen.c"
  24. sed 's/^X//' << 'SHAR_EOF' >> runscreen.c
  25. X    char            screen_name[];
  26. X    struct MenuInfo        *menu;
  27. X    int            opnumber;
  28. X{
  29. X    FILE            *popen(), *pp;
  30. X    char            *getenv();
  31. X    char            *getval();
  32. X    char            *findfile();
  33. X    WINDOW            *swin;
  34. X    union FldUnion        Fld;
  35. X    int            rc;        /* return code */
  36. X    int            exitkey;
  37. X    int            sidx;
  38. X    int            fidx = 0;
  39. X    char            fieldinput[MAXFIELDS+1][100];
  40. X    int            fieldcount;
  41. X    char            *promptptr;
  42. X    char            *mask;        /* mask pointer */
  43. X    char            fmtdefault[100];/* formated default value */
  44. X    char            *wsptr;        /* working storage pointer */
  45. X    char            *source;    /* default data pointer */
  46. X    int            helpflag = TRUE;
  47. X    char            helpfile[80];
  48. X    char            tmptitle[100];
  49. X    int            toprow;
  50. X    int            leftcol;
  51. X
  52. X
  53. X
  54. X    /* Find the screen definition */
  55. X    for (sidx = 0; menu->srn[sidx] != (struct ScreenInfo *)NULL && 
  56. X        sidx <= MAXSCREENS; sidx++)
  57. X    {
  58. X        if (strcmp (screen_name, menu->srn[sidx]->name) == 0)
  59. X            break;
  60. X    }
  61. X    if (sidx > MAXSCREENS  ||  menu->srn[sidx] == (struct ScreenInfo *)NULL)
  62. X    {
  63. X        BEEP;
  64. X        mvprintw (ErrRow-2,0, "Could not find your screen definition.");
  65. X        shutdown ();
  66. X    }
  67. X
  68. X    wsptr = SRN->toprowvar;
  69. X    if (strcmp (SRN->toprowvar, "") != 0)
  70. X        toprow = atoi (getval (&wsptr, '1'));
  71. X    else
  72. X        toprow = SRN->toprow;
  73. X    wsptr = SRN->leftcolvar;
  74. X    if (strcmp (SRN->leftcolvar, "") != 0)
  75. X        leftcol = atoi (getval (&wsptr, '1'));
  76. X    else
  77. X        leftcol = SRN->leftcol;
  78. X
  79. X    if (toprow == AUTO)
  80. X    {
  81. X        /*
  82. X        ** Figure out where to put the screen 
  83. X        ** try to put screen as close to the option as possible 
  84. X        */
  85. X        toprow = menu->option[opnumber]->row - 2;
  86. X        /*
  87. X        for (rc = 0, leftcol = 0; rc < menu->optioncount ; rc ++)
  88. X            if (strlen (menu->option[rc]->description) > leftcol)
  89. X                leftcol = strlen (menu->option[rc]->description);
  90. X        leftcol = menu->option[opnumber]->col + 
  91. X                  ((leftcol + 4) / 2);
  92. X        */
  93. X        leftcol = menu->option[opnumber]->col +
  94. X                   strlen(menu->option[opnumber]->description) + 4;
  95. X
  96. X        /* make sure it fits on the screen */
  97. X        if ((toprow + SRN->rows) > LINES-1)
  98. X            toprow = LINES - SRN->rows - 1;
  99. X
  100. X        if ((leftcol + SRN->cols + 2) > COLS)
  101. X            leftcol = COLS - SRN->cols - 1;
  102. X    }
  103. X
  104. X
  105. X    /* create the window */
  106. X    swin = newwin (SRN->rows, SRN->cols, toprow, leftcol);
  107. X    keypad (swin, TRUE);
  108. X
  109. X    /* 
  110. X    **    check if recalculation of rows & cols is necessary
  111. X    **    see newwin() for info on why
  112. X    */
  113. X    if (SRN->rows == 0  &&  SRN->cols == 0  &&  
  114. X        toprow == 0  && leftcol == 0)
  115. X    {
  116. X        /* a full-screen was created */
  117. X        SRN->rows = LINES-1;
  118. X        SRN->cols = COLS;
  119. X    }
  120. X    else      if (SRN->rows == 0  ||  SRN->cols == 0)
  121. X        {
  122. X            SRN->rows = LINES - toprow;
  123. X            SRN->cols = COLS - leftcol;
  124. X            if (SRN->rows == LINES)
  125. X                SRN->rows--;
  126. X        }
  127. X
  128. X
  129. X    if (strcmp (SRN->helpfile, "") == 0)
  130. X        helpflag = FALSE;
  131. X    else
  132. X        strcpy (helpfile, findfile (SRN->helpfile, ".",
  133. X            getenv("HELPDIR"), getenv("MENUDIR"), ""));
  134. X    drawbox (swin, 1,1, SRN->rows,SRN->cols, SRN->boxtype & 0777, 
  135. X        StandoutLine, FALSE, helpflag);
  136. X
  137. X    /* display title */
  138. X    wsptr = SRN->title;
  139. X    strcpy (tmptitle, getval (&wsptr, '1'));
  140. X    wattrset (swin, A_STANDOUT);
  141. X    mvwprintw (swin, 0, ((SRN->cols)/2)-(strlen(tmptitle)/2), 
  142. X        "%s", tmptitle);
  143. X    /*
  144. X    if (strcmp (menu->helpfile, "") != 0)
  145. X        mvwprintw (menu->win, menu->NumItems+2,menu->width+3, "?");
  146. X    */
  147. X    wattrset (swin, A_NORMAL);
  148. X
  149. X    /*
  150. X    **  Run fielddefaults if there is one and load results into fieldinput
  151. X    */
  152. X    if (SRN->fielddefaults != (char *)NULL)
  153. X    {
  154. X        if (debug)
  155. X        {
  156. X            fprintf (stderr, "\n[runscreen] <%s> popen=:%s:", 
  157. X                SRN->name, SRN->fielddefaults);
  158. X            fflush (stderr);
  159. X        }
  160. X        move (ErrRow,0);  clrtoeol();
  161. X        mvprintw (ErrRow,1, "Initializing screen fields...");
  162. X        refresh ();
  163. X        if ((pp = popen (SRN->fielddefaults, "r")) == (FILE *)NULL)
  164. X        {
  165. X            BEEP;
  166. X            mvprintw (ErrRow-2,0, "Could not open pipe = %s",
  167. X                SRN->fielddefaults);
  168. X            shutdown ();
  169. X        }
  170. X
  171. X        /* read and set each field until no more input */
  172. X        rc = 99;
  173. X        for (fidx = 0; SRN->field[fidx] != (struct FieldInfo *)NULL && 
  174. X            fidx <= MAXFIELDS; fidx++)
  175. X        {
  176. X            strcpy (fieldinput[fidx], "");
  177. X            if (rc == EOF) 
  178. X            {
  179. X                if (debug)
  180. X                {
  181. X                    fprintf (stderr, 
  182. X                              "\n[runscreen] <%s> read nothing from popen",
  183. X                        SRN->name);
  184. X                    fprintf (stderr, 
  185. X                                "\n[runscreen] <%s> field %d =:%s:",
  186. X                          SRN->name,fidx, fieldinput[fidx]);
  187. X                    fflush (stderr);
  188. X                }
  189. X                continue;
  190. X            }
  191. X
  192. X            /* get a word from the pipe */
  193. X               rc = fscanf (pp, "%s", fmtdefault);
  194. X            if (rc == EOF) continue;
  195. X            if (debug)
  196. X            {
  197. X                fprintf (stderr, 
  198. X                      "\n[runscreen] <%s> read from popen=:%s:",
  199. X                    SRN->name, fmtdefault);
  200. X                fflush (stderr);
  201. X            }
  202. X
  203. X            /* check for NULL value */
  204. X            if (strcmp (fmtdefault, "NULL") == 0)
  205. X            {
  206. X                strcpy (fieldinput[fidx], "");
  207. X                if (debug)
  208. X                {
  209. X                    fprintf (stderr, 
  210. X                                "\n[runscreen] <%s> field %d =:%s:",
  211. X                          SRN->name,fidx, fieldinput[fidx]);
  212. X                    fflush (stderr);
  213. X                }
  214. X                continue;
  215. X            }
  216. X                
  217. X            /* check for a quoted value */
  218. X            if (fmtdefault[0] == '"')
  219. X            {
  220. X                /*
  221. X                ** found a quoted value 
  222. X                ** read until another quote or end of line
  223. X                */
  224. X                strcpy (fieldinput[fidx], fmtdefault+1);
  225. X                if (fmtdefault[strlen(fmtdefault)-1] == '"')
  226. X                {
  227. X                    /* end of quote is on first word */
  228. X                    fieldinput[fidx][strlen(fieldinput[fidx])-1] = '\0';
  229. X                    if (debug)
  230. X                    {
  231. X                        fprintf (stderr, 
  232. X                                        "\n[runscreen] <%s> field %d =:%s:",
  233. X                                  SRN->name, fidx, 
  234. X                            fieldinput[fidx]);
  235. X                        fflush (stderr);
  236. X                    }
  237. X                    continue;
  238. X                }
  239. X                   while ((rc = fscanf (pp, "%s", fmtdefault)) != EOF)
  240. X                {
  241. X                    if (debug)
  242. X                    {
  243. X                        fprintf (stderr, 
  244. X                              "\n[runscreen] <%s> read from popen=:%s:",
  245. X                            SRN->name, fmtdefault);
  246. X                        fflush (stderr);
  247. X                    }
  248. X                    strcat (fieldinput[fidx], " ");
  249. X                    strcat (fieldinput[fidx], fmtdefault);
  250. X                    if (fmtdefault[strlen(fmtdefault)-1] == '"')
  251. X                    {
  252. X                        /* end of quote */
  253. X                        fieldinput[fidx][strlen(fieldinput[fidx])-1] = '\0';
  254. X                        break;
  255. X                    }
  256. X                }
  257. X            }
  258. X            else
  259. X                strcpy (fieldinput[fidx], fmtdefault);
  260. X            if (debug)
  261. X            {
  262. X                fprintf (stderr, 
  263. X                              "\n[runscreen] <%s> field %d =:%s:",
  264. X                        SRN->name, fidx, fieldinput[fidx]);
  265. X                fflush (stderr);
  266. X            }
  267. X        } /* end for each field */
  268. X        pclose(pp);
  269. X    }
  270. X
  271. X    /*
  272. X    **  Initialize the screen
  273. X    **  Loop through each field
  274. X    **    print the label
  275. X    **    for SET and MENU types determine field_length
  276. X    **    put in the field terminators
  277. X    **    get, format and print default value in getenv () or fielddefaults
  278. X    */
  279. X    for (fidx = 0; SRN->field[fidx] != (struct FieldInfo *)NULL && 
  280. X        fidx <= MAXFIELDS;
  281. X        fidx++)
  282. X    {
  283. X        /* print label */
  284. X        if (strlen(FLD->label) > 0)
  285. X            mvwprintw (swin, FLD->row, 
  286. X                FLD->col - strlen(FLD->label) - 2,
  287. X                "%s", FLD->label);
  288. X
  289. X        /* for SET and MENU types get field_length */
  290. X        if (FLD->type == SET  ||  FLD->type == MENU)
  291. X            FLD->length = GetSetLen (FLD->range);
  292. X
  293. X        /* print field terminators */
  294. X        if (strlen(FLD->terminator) > 0)
  295. X        {
  296. X            /* left */
  297. X            mvwprintw (swin, FLD->row, FLD->col - 1,
  298. X                "%c", FLD->terminator[0]);
  299. X            /* right */
  300. X            if (strlen(FLD->mask) > 0)
  301. X                mvwprintw (swin, FLD->row, 
  302. X                    FLD->col + strlen(FLD->mask),
  303. X                    "%c", FLD->terminator[1]);
  304. X            else
  305. X                mvwprintw (swin, FLD->row, 
  306. X                    FLD->col + FLD->length,
  307. X                    "%c", FLD->terminator[1]);
  308. X        }
  309. X
  310. X        /*
  311. X        **  If a fielddefaults command was given
  312. X        **    then the default values are already in fieldinput
  313. X        **    else load from getenv()
  314. X        */
  315. X        if (SRN->fielddefaults == (char *)NULL)
  316. X        {
  317. X            /* get default value from getenv() */
  318. X            if (getenv(FLD->name) != (char *)NULL)
  319. X                strcpy (fieldinput[fidx], getenv (FLD->name));
  320. X            else
  321. X                strcpy (fieldinput[fidx], "");
  322. X            if (strcmp (fieldinput[fidx], "NULL") == 0)
  323. X                strcpy (fieldinput[fidx], "");
  324. X        }
  325. X
  326. X        /* format default value to the mask */
  327. X        strcpy (fmtdefault, fieldinput[fidx]);
  328. X        if (strlen(FLD->mask) > 0)
  329. X        {
  330. X            wsptr = fmtdefault;
  331. X            mask = FLD->mask;
  332. X            source = fieldinput[fidx];
  333. X            for (; *mask != '\0'; mask++, wsptr++)
  334. X            {
  335. X                if (IsMask (FLD->type, *mask))
  336. X                    *wsptr = *mask;    /* format char */
  337. X                else
  338. X                {
  339. X                    if (*source != '\0')
  340. X                    {
  341. X                        *wsptr = *source;
  342. X                        source++;
  343. X                    } 
  344. X                    else
  345. X                        *wsptr = ' ';    /* no data */
  346. X                }
  347. X            }
  348. X            *wsptr = '\0';
  349. X        }
  350. X        /* print default data */
  351. X        if (strlen(fmtdefault) > 0)
  352. X            mvwprintw (swin, FLD->row, FLD->col, "%s", fmtdefault);
  353. X    }
  354. X    fieldcount = fidx-1;                /* save field count */
  355. X
  356. X
  357. X    /*
  358. X    **  GetInput from fields untill KEY_CANCEL || KEY_ACCEPT
  359. X    */
  360. X    move (ErrRow,0);  clrtoeol();
  361. X    fidx = 0;                /* start with first field */
  362. X
  363. X    do
  364. X    {
  365. X           Fld.strVal = fieldinput[fidx];
  366. X
  367. X
  368. X        if (exitkey == 999)
  369. X            /*
  370. X            ** This is so GetInput doesn't overwrite the
  371. X            ** must enter message.
  372. X            */
  373. X            promptptr = NOMSG;
  374. X        else
  375. X            promptptr = FLD->prompt;
  376. X
  377. X        /* if noinput == FALSE prompt for input */
  378. X        if (!FLD->noinput)
  379. X        {
  380. X               exitkey = GetInput (swin, FLD->row, FLD->col, &Fld, 
  381. X                A_REVERSE, FLD->mask, FLD->range, FLD->length, 
  382. X                FLD->min_input, FLD->type, FLD->adjust, CHAR, 
  383. X                NOAUTO, FLD->mustenter, ErrRow, ErrRow, 
  384. X                promptptr, helpfile, FLD->name);
  385. X        }
  386. X        else
  387. X        {
  388. X            /* use the exitkey from the last field */
  389. X            if (exitkey != KEY_UP)
  390. X                exitkey = KEY_DOWN;
  391. X        }
  392. X
  393. X
  394. X        if (exitkey == KeyReturn)    exitkey = KEY_RETURN;
  395. X        if (exitkey == KeyUp)          exitkey = KEY_UP;
  396. X        if (exitkey == KeyDown)      exitkey = KEY_DOWN;
  397. X        if (exitkey == KeyTab)      exitkey = KEY_TAB;
  398. X        if (exitkey == KeyBTab)      exitkey = KEY_BTAB;
  399. X        if (exitkey == KeyCancel)     exitkey = KEY_CANCEL;
  400. X        if (exitkey == KeyAccept)    exitkey = KEY_ACCEPT;
  401. X
  402. X        /* if exitlastfield accept input and exit on last field */
  403. X        if (SRN->exitlastfield && fidx == fieldcount && 
  404. X            exitkey == KEY_RETURN)
  405. X            exitkey = KEY_ACCEPT;
  406. X
  407. X        switch (exitkey)
  408. X        {
  409. X           case KEY_CANCEL:
  410. X            break;
  411. X
  412. X           case KEY_ACCEPT:
  413. X            /* make sure mustenter fields have been entered */
  414. X            for (fidx = 0; fidx <= fieldcount; fidx++)
  415. X                if (FLD->mustenter  &&  
  416. X                    strcmp (fieldinput[fidx], "") == 0)
  417. X                {
  418. X                    mvwprintw (stdscr, ErrRow,1, 
  419. X                       "This is a must enter field.");
  420. X                    BEEP;
  421. X                    wnoutrefresh (stdscr);
  422. X                    exitkey = 999;
  423. X                    break;
  424. X                }
  425. X            /* if mustenter then more input */
  426. X            if (fidx <= fieldcount)
  427. X                break;
  428. X
  429. X            /* set the environment variables */
  430. X            for (fidx = 0; fidx <= fieldcount; fidx++)
  431. X            {
  432. X                if (strcmp (fieldinput[fidx], "") == 0)
  433. X                    strcpy (fieldinput[fidx], "NULL");
  434. X
  435. X                rc = setenv (FLD->name, fieldinput[fidx]);
  436. X                if (rc < 0)
  437. X                {
  438. X                    mvwprintw (stdscr, ErrRow,0, "Unable to allocate environment memory to set variable %s.", fieldinput[fidx]);
  439. X                    BEEP;
  440. X                }
  441. X            }
  442. X            break;
  443. X
  444. X           case KEY_TAB:
  445. X            fidx += 4;
  446. X            fidx = fidx >= fieldcount ? 0 : ++fidx;
  447. X            break;
  448. X
  449. X           case KEY_BTAB:
  450. X            fidx -= 4;
  451. X            fidx = fidx < 0 ? fieldcount : --fidx;
  452. X            break;
  453. X
  454. X           case KEY_UP:
  455. X            fidx = fidx <= 0 ? fieldcount : --fidx;
  456. X            break;
  457. X
  458. X           case KEY_RETURN:
  459. X           case KEY_DOWN:
  460. X           default:
  461. X            fidx = fidx >= fieldcount ? 0 : ++fidx;
  462. X            break;
  463. X        }
  464. X    } while (exitkey != KEY_CANCEL  &&  exitkey != KEY_ACCEPT);
  465. X
  466. X    delwin (swin);                    /* junk screen window */
  467. X    wmove (stdscr,LINES-1,0);
  468. X    clrtoeol ();                    /* clear field prompt */
  469. X    touchwin (stdscr);
  470. X
  471. X    if (exitkey == KEY_CANCEL)
  472. X        return (exitkey);
  473. X    else
  474. X        return (0);
  475. X}
  476. X/* Paul J. Condie  11/88 */
  477. SHAR_EOF
  478. echo "File runscreen.c is complete"
  479. chmod 0644 runscreen.c || echo "restore of runscreen.c fails"
  480. echo "x - extracting getval.c (Text)"
  481. sed 's/^X//' << 'SHAR_EOF' > getval.c &&
  482. X#ifndef LINT
  483. Xstatic char Sccsid[] = "%W%   DeltaDate %G%   ExtrDate %H%";
  484. X#endif
  485. X
  486. X/*
  487. X**  getval()
  488. X**  ARGS:
  489. X**    sptr    - pointer to beginning of value 2b parsed
  490. X**    endch    - $ process only the dollar part of value
  491. X**        - ` process only the single quote part of value
  492. X**        - " process only the double quote part of value
  493. X**        - 0 process until a space or invalid is found
  494. X**        - 1 process entire string until '\0' is found
  495. X**  RETURNS:
  496. X**    sptr    - pointer to end of value 2b parsed
  497. X**    rval    - the resulting value.
  498. X**
  499. X**    var=one
  500. X**    var="one"
  501. X**    var=$var
  502. X**    var="one $var"
  503. X**    var=${var}
  504. X**    var=`ls`
  505. X**    var=one"two three"
  506. X**    var=~/
  507. X**    var=~usr/
  508. X*/
  509. X
  510. X#include    <stdio.h>
  511. X#include    <ctype.h>
  512. X#include    <pwd.h>
  513. X
  514. X#define DQUOTE    '"'
  515. X#define SQUOTE    '`'
  516. X#define LITERAL    '\''
  517. X#define DOLLAR    '$'
  518. X#define ESCAPE    '\\'
  519. X#define BRACE    '{'
  520. X#define COMCHAR '#'
  521. X#define    TILDE    '~'
  522. X#ifndef    TRUE
  523. X#define    TRUE    1
  524. X#define    FALSE    0
  525. X#endif
  526. X
  527. X#ifndef    TEST
  528. Xextern int    debug;
  529. X#endif
  530. X
  531. X
  532. Xchar *getval (sptr, endch)
  533. X    char    **sptr;                    /* pointer to $+1 */
  534. X    char    endch;
  535. X{
  536. X    char        *getenv();
  537. X    struct passwd    *getpwnam();
  538. X    FILE        *popen(), *pp;
  539. X    static char    value[400];
  540. X    char        tmpval[400];
  541. X    static char    *rval;                /* pointer for return */
  542. X    int        i;
  543. X    int        EOV = FALSE;            /* End Of Value */
  544. X    int        dqflag = FALSE;            /* double quote flag */
  545. X    struct passwd    *pw;
  546. X
  547. X
  548. X    strcpy (value, "");
  549. X    rval = value;
  550. X    while (!EOV && **sptr)
  551. X    {
  552. X        switch (**sptr)
  553. X        {
  554. X              case SQUOTE:
  555. X            (*sptr)++;                /* get past ' */
  556. X            for (i = 0; **sptr != '`' && **sptr; i++, (*sptr)++)
  557. X                tmpval[i] = **sptr;
  558. X            if (**sptr)
  559. X                (*sptr)++;        /* get past ' */
  560. X            tmpval[i] = '\0';
  561. X            /* open pipe and read results */
  562. X            if ((pp = popen (tmpval, "r")) != NULL)
  563. X            {
  564. X                for (; ((i = fgetc(pp)) != EOF); rval++)
  565. X                {
  566. X                    *rval = i ;
  567. X                    if (!isprint(*rval))
  568. X                        rval--;
  569. X                }
  570. X                pclose (pp);
  571. X            }
  572. X            if (endch == SQUOTE)
  573. X            {
  574. X                *rval = '\0';
  575. X                rval = value;
  576. X                return (rval);
  577. X            }
  578. X            break;
  579. X
  580. X              case DQUOTE:
  581. X            (*sptr)++;
  582. X            dqflag = dqflag == FALSE ? TRUE : FALSE;
  583. X            if (endch == DQUOTE && dqflag == FALSE)
  584. X            {
  585. X                *rval = '\0';
  586. X                rval = value;
  587. X                return (rval);
  588. X            }
  589. X            break;
  590. X
  591. X              case DOLLAR:
  592. X            /* Substitutable parameter */
  593. X
  594. X            (*sptr)++;                /* get past $ */
  595. X
  596. X            /*
  597. X            **  The braces are required only when parameter is
  598. X            **  followed by a letter, digit, or underscore.
  599. X            */
  600. X            if (**sptr == BRACE)
  601. X            {
  602. X                (*sptr)++;            /* get past { */
  603. X                for (i = 0; **sptr != '}' && **sptr; 
  604. X                     i++, (*sptr)++)
  605. X                    tmpval[i] = **sptr;
  606. X                if (**sptr)
  607. X                    (*sptr)++;        /* get past } */
  608. X            }
  609. X            else
  610. X            {
  611. X                for (i = 0; isalnum(**sptr) || **sptr == '_'; 
  612. X                    i++, (*sptr)++)
  613. X                    tmpval[i] = **sptr;
  614. X            }
  615. X            tmpval[i] = '\0';
  616. X            if (getenv(tmpval) != (char *)NULL)
  617. X                strcpy (rval, getenv(tmpval));
  618. X            rval += strlen (rval);
  619. X            if (endch == DOLLAR)
  620. X            {
  621. X                *rval = '\0';
  622. X                rval = value;
  623. X                return (rval);
  624. X            }
  625. X            break;
  626. X
  627. X           case TILDE:
  628. X            (*sptr)++;                /* get past ~ */
  629. X            /*
  630. X            **  ~/ = $HOME
  631. X            **  ~user/ = home(user)
  632. X            */
  633. X            for (i = 0; **sptr != '/' && **sptr; i++, (*sptr)++)
  634. X                tmpval[i] = **sptr;
  635. X            tmpval[i] = '\0';
  636. X            if (strcmp (tmpval, "") == 0)
  637. X                if (getenv("LOGNAME") != (char *)NULL)
  638. X                    strcpy (tmpval, getenv ("LOGNAME"));
  639. X            /*
  640. X            **  tmpval holds the user name
  641. X            **  now we get the password entry
  642. X            */
  643. X            pw = getpwnam (tmpval);
  644. X            strcpy (rval, pw->pw_dir);
  645. X            rval += strlen (pw->pw_dir);
  646. X            break;
  647. X
  648. X              default:
  649. X            if (dqflag || **sptr != ' ' || endch == '1')
  650. X            {
  651. X                *rval++ = **sptr;
  652. X                (*sptr)++;
  653. X            }
  654. X            else
  655. X                EOV = TRUE;
  656. X            break;
  657. X        } /* end switch */
  658. X    } /* end while */
  659. X
  660. X    *rval = '\0';
  661. X    rval = value;
  662. X#ifndef    TEST
  663. X    if (debug)
  664. X    {
  665. X        fprintf (stderr, "\n[%s] value=:%s:, :%s:",
  666. X            __FILE__, value, *sptr);
  667. X        fflush (stderr);
  668. X    }
  669. X#endif
  670. X    return (rval);
  671. X}
  672. X
  673. X
  674. X
  675. X#ifdef    TEST
  676. Xmain (argc, argv)
  677. X    int    argc;
  678. X    char    *argv[];
  679. X{
  680. X    char        *getval();
  681. X    char        *sptr;
  682. X    char        *rval;
  683. X
  684. X    sptr = argv[1];
  685. X    if (argc == 3)
  686. X        rval = getval (&sptr, argv[2][0]);
  687. X    else
  688. X        rval = getval (&sptr, '1');
  689. X    printf ("\nparameter value :%s:", rval);
  690. X    printf ("\narg pointer :%s:", sptr);
  691. X}
  692. X#endif
  693. X/* Paul J. Condie  5/89 */
  694. SHAR_EOF
  695. chmod 0644 getval.c || echo "restore of getval.c fails"
  696. echo "x - extracting clean_menu.c (Text)"
  697. sed 's/^X//' << 'SHAR_EOF' > clean_menu.c &&
  698. X#ifndef LINT
  699. Xstatic char Sccsid[] = "@(#)clean_menu.c    1.1   DeltaDate 6/14/89   ExtrDate 1/22/90";
  700. X#endif
  701. X
  702. X#include    "menu.h"
  703. X
  704. Xclean_menu (menu)
  705. X    struct MenuInfo    *menu;
  706. X{
  707. X    int        i,j;
  708. X
  709. X
  710. X    /*
  711. X    ** Just to keep things simple, lets start from scratch on the
  712. X    ** next menu selected.
  713. X    */
  714. X
  715. X    /* free options */
  716. X          for (i = 0; i < menu->optioncount; i++)
  717. X               free (menu->option[i]);
  718. X
  719. X          /* free screens */
  720. X    for (i = 0; menu->srn[i] != (struct ScreenInfo *)NULL  &&  
  721. X         i <= MAXSCREENS; i++)
  722. X    {
  723. X        if (menu->srn[i]->fielddefaults != (char *)NULL)
  724. X            free (menu->srn[i]->fielddefaults);
  725. X        /* free screen fields */
  726. X        for (j = 0; 
  727. X             menu->srn[i]->field[j] != (struct FieldInfo *)NULL &&
  728. X             j <= MAXFIELDS; j++)
  729. X            free (menu->srn[i]->field[j]);
  730. X        free (menu->srn[i]);
  731. X        menu->srn[i] = (struct ScreenInfo *)NULL;
  732. X    }
  733. X}
  734. X/* Paul J. Condie  6/89 */
  735. SHAR_EOF
  736. chmod 0444 clean_menu.c || echo "restore of clean_menu.c fails"
  737. echo "x - extracting System.c (Text)"
  738. sed 's/^X//' << 'SHAR_EOF' > System.c &&
  739. X#ifndef LINT
  740. Xstatic char Sccsid[] = "@(#)System.c    1.1   DeltaDate 1/22/90   ExtrDate 1/22/90";
  741. X#endif
  742. X
  743. X/*
  744. X**  System()
  745. X**    Reset the effective uid/gid in case menu has the set uid bit set.
  746. X*/
  747. X
  748. XSystem( cmdStr )
  749. X    char    *cmdStr ;
  750. X{
  751. X    register int    uid, euid, gid, egid ;
  752. X
  753. X    /* who am i */
  754. X    uid = getuid() ;
  755. X    euid = geteuid() ;
  756. X    gid = getgid() ;
  757. X    egid = getegid() ;
  758. X
  759. X    /* reset back to the read id */
  760. X    setuid( uid ) ;
  761. X    setgid( gid ) ;
  762. X
  763. X    system( cmdStr ) ;
  764. X
  765. X    /* reset back to the fake id */
  766. X    setuid( euid ) ;
  767. X    setgid( egid ) ;
  768. X}
  769. X/* Sam S. Lok  11/89 */
  770. SHAR_EOF
  771. chmod 0444 System.c || echo "restore of System.c fails"
  772. echo "x - extracting slength.c (Text)"
  773. sed 's/^X//' << 'SHAR_EOF' > slength.c &&
  774. X#ifndef LINT
  775. Xstatic char Sccsid[] = "@(#)slength.c    1.1   DeltaDate 1/22/90   ExtrDate 1/22/90";
  776. X#endif
  777. X
  778. X/*
  779. X**    How long is a string not counting attributes.
  780. X*/
  781. X
  782. Xslength (s)
  783. X    char        *s;
  784. X{
  785. X    register int    i = 0;
  786. X
  787. X    while (*s)
  788. X    {
  789. X        if (*s == '\\')
  790. X        {
  791. X            s++;
  792. X            s++;
  793. X            continue;
  794. X        }
  795. X        s++;
  796. X        i++;
  797. X    }
  798. X    return (i);
  799. X}
  800. X/* Paul J. Condie  11-89 */
  801. SHAR_EOF
  802. chmod 0444 slength.c || echo "restore of slength.c fails"
  803. echo "x - extracting upper.c (Text)"
  804. sed 's/^X//' << 'SHAR_EOF' > upper.c &&
  805. X#ifndef LINT
  806. Xstatic char Sccsid[] = "@(#)upper.c    1.1   DeltaDate 1/22/90   ExtrDate 1/22/90";
  807. X#endif
  808. X
  809. Xupper (s)
  810. X
  811. X    char        *s;
  812. X{
  813. X    register int    i;
  814. X
  815. X   while (*s)
  816. X   {
  817. X      if (*s >= 'a'  &&  *s <= 'z')
  818. X         *s = (*s + 'A' - 'a');
  819. X      s++;
  820. X   }
  821. X}
  822. SHAR_EOF
  823. chmod 0444 upper.c || echo "restore of upper.c fails"
  824. echo "x - extracting substr.c (Text)"
  825. sed 's/^X//' << 'SHAR_EOF' > substr.c &&
  826. X/*  E911 Project
  827. X *  substr()
  828. X *
  829. X *  Purpose:    To find a substring within a given string
  830. X *  Args:    s1: The string being searched
  831. X *        s2: the string being searched for
  832. X *  Return:    pointer to the where the searched for string resides
  833. X *        within the search string; otherwise NULL
  834. X */
  835. X
  836. X
  837. Xchar    *
  838. Xsubstr(s1, s2)
  839. Xchar    *s1;
  840. Xchar    *s2;
  841. X{
  842. X    char    *p1, *p2;
  843. X
  844. X    for ( ; *s1; s1++) {
  845. X        if (*s1 != *s2)
  846. X            continue;
  847. X        p1 = s1 + 1;
  848. X        p2 = s2 + 1;
  849. X        while (1) {
  850. X            if (*p2 == '\0')
  851. X                return(s1);
  852. X            if (*p1++ != *p2++)
  853. X                break;
  854. X        }
  855. X    }
  856. X    return(0);
  857. X}
  858. X
  859. X
  860. X#ifdef LTEST
  861. Xmain()
  862. X{
  863. X    char    *strtok();
  864. X
  865. X    char    *s1, *s2, *s3;
  866. X    char    buffer[256];
  867. X
  868. X    printf("ok\n");
  869. X    while (gets(buffer)) {
  870. X        s1 = strtok(buffer, " \t:\n");
  871. X        s2 = strtok(0, " \t:\n");
  872. X        printf("%s:%s:", s1, s2);
  873. X        if (s1 && s2)
  874. X            if (s3 = substr(s1, s2))
  875. X                printf("%.*s\n", strlen(s2), s3);
  876. X            else
  877. X                printf("no match\n");
  878. X        else
  879. X            printf("invalid input\n");
  880. X    }
  881. X}
  882. X#endif
  883. X
  884. X
  885. SHAR_EOF
  886. chmod 0666 substr.c || echo "restore of substr.c fails"
  887. echo "x - extracting menu.h (Text)"
  888. sed 's/^X//' << 'SHAR_EOF' > menu.h &&
  889. X#ifndef LINT
  890. Xstatic char ID_menu[] = "%W%   DeltaDate %G%   ExtrDate %H%";
  891. X#endif
  892. X
  893. X#define    VERSION    "3.41"            /* current version */
  894. X
  895. X#ifndef BELL
  896. X#define    BELL    printf ("%c", 7)
  897. X#endif
  898. X#ifndef BEEP
  899. X#define    BEEP    printf ("%c", 7)
  900. X#endif
  901. X#ifndef NULL
  902. X#define    NULL    0
  903. X#endif
  904. X#define    null            0
  905. X#define    MENUINIT    ".menuinit"    /* initialize filename */
  906. X#define    HELPFILE    "menu.hlp"
  907. X#define    BORDERCHAR    ' '
  908. X#define    MAXTITLE    6        /* maximum # of title lines */
  909. X#define    MAXKEYS        25        /* maximum # of keys */
  910. X#define    MAXKEYLENGTH    15        /* maximum length of keyword */
  911. X#define    MAXOPTION    60        /* max # of option 2b displayed */
  912. X#define    MAXMENU        20        /* max nested menus */
  913. X#define    MAXGNAME    20        /* max goto menu names */
  914. X#define    MAXLEN        1024        /* max length of option command */
  915. X#define    MAXSCREENS    10        /* max .DEFINE_SCREEN per menu */
  916. X#define    MAXFIELDS    20        /* max fields per .DEFINE_SCREEN */
  917. X#define    ErrRow        (LINES-1)    /* last line to print error message */
  918. X#define    GNAMEOFFSET    100        /* Offset return code for gnames */
  919. X
  920. X#define    QUIT        -1
  921. X#define    MAINMENU    -2
  922. X#define    PREVIOUSMENU    -3
  923. X#define    NOWAYJOSE    -4        /* not authorized for menu */
  924. X#define    REPARSE        -5        /* reparse & display the current menu */
  925. X#define    SUBMENU        -99        /* a submenu was selected */
  926. X
  927. X#define    BUFSIZE        512
  928. X
  929. X/* Line drawing types */
  930. X#define    DumbLine    1
  931. X#define    StandoutLine    2
  932. X#define    SingleLine    3
  933. X#define    MosaicLine    4
  934. X#define    DiamondLine    5
  935. X#define    DotLine        6
  936. X#define    PlusLine    7
  937. X
  938. X#define    AUTO        999
  939. X
  940. X
  941. X/*
  942. X**  Keys not defined in some curses.h
  943. X*/
  944. X
  945. X#ifndef KEY_HELP
  946. X#   define KEY_HELP    0553
  947. X#endif
  948. X#ifndef KEY_REFRESH
  949. X#   define KEY_REFRESH    0565
  950. X#endif
  951. X#ifndef KEY_CANCEL
  952. X#   define KEY_CANCEL    0543
  953. X#endif
  954. X#ifndef KEY_TAB
  955. X#   define KEY_TAB    '\t'
  956. X#endif
  957. X#ifndef KEY_BTAB
  958. X#   define KEY_BTAB    0541
  959. X#endif
  960. X#ifndef KEY_RETURN
  961. X#   define KEY_RETURN    '\r'
  962. X#endif
  963. X#ifndef KEY_LINEFEED
  964. X#   define KEY_LINEFEED    '\n'
  965. X#endif
  966. X#ifndef KEY_REFRESH
  967. X#   define KEY_REFRESH    0565
  968. X#endif
  969. X#ifndef KEY_BEG
  970. X#   define KEY_BEG    0542
  971. X#endif
  972. X#ifndef KEY_END
  973. X#   define KEY_END    0550
  974. X#endif
  975. X#define KEY_ACCEPT    1000
  976. X#define    KEY_MAINMENU    1001
  977. X#define    KEY_PREVMENU    1002
  978. X#define    KEY_EXITMENU    1003
  979. X#define    KEY_POPGNAME    1004
  980. X#define    KEY_GNAME    1005
  981. X
  982. X/*
  983. X**  MACROS
  984. X*/
  985. X
  986. X#define    SKIPJUNK(s)     /* \
  987. X            **  This macro skips over spaces, tabs, etc. \
  988. X            **  ARGS:  char  *s \
  989. X            */ \
  990. X            for (;*s != '\0' && (isspace(*s)); s++) \
  991. X                ;
  992. X
  993. X
  994. X/*
  995. X**  STRUCTURES
  996. X*/
  997. X
  998. Xstruct MenuInfo
  999. X{
  1000. X    char            name    [15];        /* file name */
  1001. X    int            wfrow;            /* window first row */
  1002. X    int            wlrow;            /* window last row */
  1003. X    int            wfcol;            /* window first col */
  1004. X    int            wlcol;            /* window last col */
  1005. X    int            row_cursor;        /* row for cursor */
  1006. X    int            col_cursor;        /* col for cursor */
  1007. X    unsigned        boxtype;        /* 0 = no box */
  1008. X    unsigned        linetype;        /* same as box */
  1009. X    int            titlecount;
  1010. X    int            optioncount;        /* base 0 */
  1011. X    struct OptionInfo    *option    [MAXOPTION];
  1012. X    struct ScreenInfo    *srn    [MAXSCREENS+1];    /* .DEFINE_SCREEN */
  1013. X                            /* NULL = EOL */
  1014. X};
  1015. X
  1016. X
  1017. Xstruct OptionInfo
  1018. X{
  1019. X    char    keyword        [MAXKEYLENGTH+1];
  1020. X    int    opnumber;                /* option number */
  1021. X    char    description    [200];
  1022. X    char    command        [MAXLEN];
  1023. X    int    row;                    /* row to display */
  1024. X    int    col;                    /* col to display */
  1025. X};
  1026. X
  1027. Xstruct ScreenInfo
  1028. X{
  1029. X    char            name    [30];        /* screen name */
  1030. X    char            title    [100];        /* window title */
  1031. X    int            toprow;            /* upper left corner */
  1032. X    char            toprowvar[40];
  1033. X    int            leftcol;
  1034. X    char            leftcolvar[40];
  1035. X    int            rows;            /* # rows in win */
  1036. X    int            cols;            /* # cols in win */
  1037. X    unsigned        boxtype;        /* 0 = no box */
  1038. X    int            exitlastfield;        /* after last field */
  1039. X    char            helpfile[16];
  1040. X    char            *fielddefaults;        /* init field command */
  1041. X    struct FieldInfo    *field    [MAXFIELDS+1];
  1042. X};
  1043. X
  1044. X
  1045. Xstruct FieldInfo
  1046. X{
  1047. X    char    name    [30];                /* field name */
  1048. X    char    label    [50];                /* field label */
  1049. X    int    row;                    /* start position */
  1050. X    int    col;
  1051. X    int    length;
  1052. X    int    min_input;
  1053. X    char    mask    [100];
  1054. X    char    range    [1025];
  1055. X    char    type;
  1056. X    char    adjust;
  1057. X    int    mustenter;
  1058. X    char    prompt    [100];
  1059. X    char    terminator[3];                /* field terminators */
  1060. X    int    noinput;
  1061. X};
  1062. SHAR_EOF
  1063. chmod 0644 menu.h || echo "restore of menu.h fails"
  1064. echo "x - extracting terminal.h (Text)"
  1065. sed 's/^X//' << 'SHAR_EOF' > terminal.h &&
  1066. X#ifndef LINT
  1067. Xstatic char ID_terminal[] = "@(#)terminal.h    1.7   DeltaDate 1/22/90   ExtrDate 1/22/90";
  1068. X#endif
  1069. X
  1070. X/* Mover Keys */
  1071. Xextern int    KeyReturn;
  1072. Xextern int    KeyDown;
  1073. Xextern int    KeyUp;
  1074. Xextern int    KeyTab;
  1075. Xextern int    KeyBTab;
  1076. X
  1077. X/* Edit Keys */
  1078. Xextern int    KeyBeg;
  1079. Xextern int    KeyEnd;
  1080. Xextern int    KeyRight;
  1081. Xextern int    KeyLeft;
  1082. Xextern int    KeyBackspace;
  1083. Xextern int    KeyEOL;
  1084. Xextern int    KeyDL;
  1085. Xextern int    KeyDC;
  1086. Xextern int    KeyIC;
  1087. X
  1088. X/* Other Keys */
  1089. Xextern int    KeyHelp;
  1090. Xextern int    KeyRedraw;
  1091. Xextern int    KeyCancel;
  1092. Xextern int    KeySave;
  1093. Xextern int    KeyPrint;
  1094. Xextern int    KeyAccept;
  1095. X
  1096. X
  1097. X/* Menu Specific Keys */
  1098. Xextern int    KeyMainMenu;
  1099. Xextern int    KeyPrevMenu;
  1100. Xextern int    KeyExitMenu;
  1101. Xextern int    KeyGname;
  1102. Xextern int    KeyPopGname;
  1103. SHAR_EOF
  1104. chmod 0444 terminal.h || echo "restore of terminal.h fails"
  1105. echo "x - extracting LexDeSrn.l (Text)"
  1106. sed 's/^X//' << 'SHAR_EOF' > LexDeSrn.l &&
  1107. X%{
  1108. X#ifndef LINT
  1109. Xstatic char Sccsid[] = "%W%   DeltaDate %G%   ExtrDate %H%";
  1110. X#endif
  1111. X%}
  1112. X
  1113. X%{
  1114. X#include     "y.tab.h"
  1115. X#include    "menu.h"
  1116. X
  1117. X#undef    YYLMAX
  1118. X#define    YYLMAX    MAXLEN
  1119. X
  1120. Xchar    *malloc();
  1121. X%}
  1122. X%%
  1123. X%{
  1124. X/*
  1125. X**    Operators:
  1126. X**    " \ [ ] ^ - ? . * + | ( ) $ / { } % < >
  1127. X**    -    match a range
  1128. X**    ^    match all except or match begining of line if outside []
  1129. X**    .    match any character except \n
  1130. X**    ?    optional  ab?c matches ac or abc
  1131. X**    |    alternation  ab|cd matches either ab or cd
  1132. X**    $    match end of line
  1133. X**    /    trailing context  ab/cd matches ab only if followed by cd
  1134. X**    <>    start conditions
  1135. X**    {}    repetitions a{1,5}  or definition expansion {abc}
  1136. X**    %    separator for source segments
  1137. X**
  1138. X**    object        match one occurence of object
  1139. X**    object*        matches zero or more occurrences of object
  1140. X**    object+        matches one or more occurrences of object
  1141. X**    object{m,n}    match m through n occurrences of object
  1142. X*/
  1143. X%}
  1144. X
  1145. X%{ /* Screen Stuff
  1146. X%}
  1147. X"window_rows"        return (SCREEN_ROWS);
  1148. X"window_title"        return (SCREEN_TITLE);
  1149. X"window_cols"        return (SCREEN_COLS);
  1150. X"window_border"        return (SCREEN_BORDER);
  1151. X"window_pos"        return (SCREEN_POS);
  1152. X"helpfile"        return (SCREEN_HELP);
  1153. X"exit_last_field"    return (EXIT_LAST_FIELD);
  1154. X
  1155. X%{ /* Field Stuff
  1156. X%}
  1157. X"field_name"        return(FIELD_NAME); 
  1158. X"field_label"         return(FIELD_LABEL); 
  1159. X"field_row"        return (FIELD_ROW);
  1160. X"field_col"        return (FIELD_COL);
  1161. X"field_mask"        return (FIELD_MASK);
  1162. X"field_range"        return (FIELD_RANGE);
  1163. X"field_length"        return (FIELD_LENGTH);
  1164. X"field_min"        return (FIELD_MIN);
  1165. X"field_type"        return (FIELD_TYPE);
  1166. X"field_edits"        return (FIELD_TYPE);
  1167. X"field_adjust"        return (FIELD_ADJUST);
  1168. X"field_mustenter"    return (FIELD_MUSTENTER);
  1169. X"field_prompt"        return (FIELD_PROMPT);
  1170. X"field_terminator"    return (FIELD_TERMINATOR);
  1171. X"field_defaults"    return (FIELD_DEFAULTS);
  1172. X"field_noinput"        return (FIELD_NOINPUT);
  1173. X
  1174. X"ENDSCREEN"        return(0);
  1175. X
  1176. X
  1177. X%{ /* Comment line */
  1178. X%}
  1179. X###            { while (input() != '\n'); }
  1180. X
  1181. X[0-9]+            { 
  1182. X                yylval.number = atoi (yytext);
  1183. X                return (NUMBER); 
  1184. X            }
  1185. X
  1186. X%{ /* Alphanumeric string with a leading $ and alphabetic character. */ 
  1187. X%}
  1188. X[$][A-Za-z][A-Za-z0-9_]* {
  1189. X                            yylval.string = malloc(strlen(yytext)+1);
  1190. X                            strcpy(yylval.string,yytext);
  1191. X                return (EVAR); 
  1192. X            }
  1193. X
  1194. X%{ /* Alphanumeric string with a leading alphabetic character. */ 
  1195. X%}
  1196. X[A-Za-z][A-Za-z0-9_]*    { 
  1197. X                            yylval.string = malloc(strlen(yytext)+1);
  1198. X                            strcpy(yylval.string,yytext);
  1199. X                return (STRING); 
  1200. X            }
  1201. X
  1202. X%{/* Quoted string with a possible " in the string.  ex. "abc\"def" */
  1203. X%}
  1204. X\"[^"]*            {
  1205. X                if (yytext[yyleng-1] == '\\')
  1206. X                {
  1207. X                    yymore ();
  1208. X                }
  1209. X                else
  1210. X                {
  1211. X                    int    i,j;
  1212. X                    /*
  1213. X                    ** need to validate that it is a quote
  1214. X                    ** a core dump will occur if not.
  1215. X                    */
  1216. X                    input ();    /* get last " */
  1217. X                                yylval.string=malloc(strlen(yytext)+1);
  1218. X                    for (j=0,i=1; i < strlen(yytext); i++)
  1219. X                    {
  1220. X                        if (yytext[i] == '\\' && 
  1221. X                            yytext[i+1] == '"')
  1222. X                            continue;
  1223. X                        yylval.string[j++] = yytext[i];
  1224. X                    }
  1225. X                    yylval.string[j] = '\0';
  1226. X                    return (QUOTE_STRING);
  1227. X                }
  1228. X            }
  1229. X
  1230. X","             return (COMMA);
  1231. X"="        return (EQUAL);
  1232. X%{/* Ignore blank, tab, newline */
  1233. X%}
  1234. X[ \t\n]        ;
  1235. X%%
  1236. SHAR_EOF
  1237. chmod 0644 LexDeSrn.l || echo "restore of LexDeSrn.l fails"
  1238. echo "x - extracting menu.hlp (Text)"
  1239. sed 's/^X//' << 'SHAR_EOF' > menu.hlp &&
  1240. XTABLE_OF_CONTENTS
  1241. Xmenu.hlp    menu        Menus      - Help using menus.
  1242. Xmenu.hlp    popmenu        Pop-menus  - Help using popmenus.
  1243. Xmenu.hlp    GETINPUT    Input      - Editing commands.
  1244. Xmenu.hlp    help        Help       - Using help.
  1245. XTABLE_OF_CONTENTS
  1246. X
  1247. X
  1248. Xmenu
  1249. X.TITLE Menu Help
  1250. X
  1251. X  \RMENU COMMANDS:\N
  1252. X          M       \D-  Go directly to main menu.\N
  1253. X          P       \D-  Return to previous menu.\N
  1254. X          G or ^g \D-  Go directly to a specific menu.\N
  1255. X          H or ?  \D-  This help screen.\N
  1256. X          ^r      \D-  Redraw the screen.\N
  1257. X          E       \D-  Exit.\N
  1258. X          !       \D-  Enter a unix command.\N
  1259. X
  1260. X  \RSELECTING OPTIONS:\N
  1261. X          -  Use "up arrow key", "^k", "down arrow key", "^j" or
  1262. X             "tab key" to place bar on option and press "return".    
  1263. X
  1264. X                  or
  1265. X
  1266. X          -  Enter option number and press "return".
  1267. X
  1268. Xmenu
  1269. X
  1270. X
  1271. Xpopmenu
  1272. X.TITLE Pop-Up Menu Help
  1273. XSELECTING OPTIONS:
  1274. X    Use "up arrow key", "^k", "down arrow key", "^j", 
  1275. X    to place bar on option and press "return".
  1276. X
  1277. X    or
  1278. X
  1279. X    Enter the first character of the option you
  1280. X    wish to select and press "return".
  1281. X
  1282. X    KEY_CANCEL (esc)   - Cancel selection.
  1283. Xpopmenu
  1284. X
  1285. X
  1286. XGETINPUT
  1287. X.TITLE GETINPUT Help
  1288. XMover Keys:
  1289. X        KEY_RETURN  (^m)    Traverse forwards through the fields.
  1290. X        KEY_DOWN  (^j)      Traverse forwards through the fields.
  1291. X        KEY_UP  (^k)        Traverse backwards through the fields.
  1292. X        KEY_TAB  (^i)       Fast forward through the fields.
  1293. X        KEY_BTAB            Fast reverse through the fields.
  1294. XField Editing Keys:
  1295. X        KEY_BEG  (^b)       Place cursor at beginning of field.
  1296. X        KEY_END  (^e)       Place cursor at end of input in field.
  1297. X        KEY_RIGHT  (^l)     Forward space within the field.
  1298. X        KEY_LEFT  (^h)      Backspace within the field (non-destructive).
  1299. X        KEY_BACKSPACE  (^h) Same as KEY_LEFT.
  1300. X        KEY_EOL  (^d)       Delete from cursor to end of field.
  1301. X        KEY_DL  (^c)        Clear field and home cursor.
  1302. X        KEY_DC  (^x)        Delete a character.
  1303. X        KEY_IC  (^t)        Toggle between type-over and insert mode.
  1304. XOther Keys:
  1305. X        KEY_HELP  (?)       Display help screen.
  1306. X        KEY_REFRESH  (^r)   Redraw the screen.
  1307. X        KEY_ACCEPT  (^a)    Accept all input and exit screen.
  1308. X        KEY_CANCEL  (esc)   Cancel all input and exit screen.
  1309. X        KEY_SAVE  (^f)      Save screen to a file.
  1310. X        KEY_PRINT  (^p)     Print screen to lp.
  1311. XGETINPUT
  1312. X
  1313. X
  1314. Xhelp
  1315. X.TITLE Using Help
  1316. XHelp displays consist of a description displayed in a window.
  1317. XIf the description doesn't fit in the window, the Up Arrow and
  1318. XDown Arrow keys can be used to view a few more lines of the 
  1319. Xdisplay.  Exiting the help system will return the display to 
  1320. Xthe state it was in when you asked for help.
  1321. X
  1322. X   The following keys are active in help:
  1323. X        KEY_CANCEL  (esc)   Exit help.
  1324. X        KEY_DOWN  (^j)      View a few more lines.
  1325. X        KEY_UP  (^k)        View the previous lines.
  1326. X        KEY_BEG  (^b)       Display first page.
  1327. X        KEY_END  (^e)       Display last page.
  1328. X        KEY_TOC  (^t)       Display help table of contents.
  1329. Xhelp
  1330. SHAR_EOF
  1331. chmod 0644 menu.hlp || echo "restore of menu.hlp fails"
  1332. echo "x - extracting runrealid.c (Text)"
  1333. sed 's/^X//' << 'SHAR_EOF' > runrealid.c &&
  1334. X#ifndef LINT
  1335. Xstatic char Sccsid[] = "@(#)runrealid.c    1.1   DeltaDate 1/22/90   ExtrDate 1/22/90";
  1336. X#endif
  1337. X
  1338. X#include    <stdio.h>
  1339. X
  1340. Xmain ( argc, argv )
  1341. X    int    argc;
  1342. X    char    *argv[];
  1343. X{
  1344. X    register int    uid, euid, gid, egid ;
  1345. X
  1346. X    /* who am i */
  1347. X    uid = getuid() ;
  1348. X    euid = geteuid() ;
  1349. X    gid = getgid() ;
  1350. X    egid = getegid() ;
  1351. X
  1352. X    /* reset back to the read id */
  1353. X    setuid( uid ) ;
  1354. X    setgid( gid ) ;
  1355. X
  1356. X    system( argv[1] ) ;
  1357. X
  1358. X    /* reset back to the fake id */
  1359. X    setuid( euid ) ;
  1360. X    setgid( egid ) ;
  1361. X}
  1362. X/* Sam S. Lok  11/89 */
  1363. SHAR_EOF
  1364. chmod 0444 runrealid.c || echo "restore of runrealid.c fails"
  1365. echo "x - extracting ParseDeSrn.y (Text)"
  1366. sed 's/^X//' << 'SHAR_EOF' > ParseDeSrn.y &&
  1367. X%{
  1368. X#ifndef LINT
  1369. Xstatic char Sccsid[] = "%W%   DeltaDate %G%   ExtrDate %H%";
  1370. X#endif
  1371. X%}
  1372. X
  1373. X%{
  1374. X#include    <curses.h>
  1375. X#include    "GetInput.h"
  1376. X#include    "menu.h"
  1377. X
  1378. X#define    FLD    yyscreen->field[fieldcount-1]
  1379. X
  1380. X#ifdef    _yydebug
  1381. Xextern int        yydebug;
  1382. X#endif
  1383. Xextern int        debug;
  1384. Xstruct ScreenInfo    *yyscreen;
  1385. Xint            fieldcount;
  1386. Xchar            eott[50];        /* error on this token */
  1387. Xchar            *malloc();
  1388. X%}
  1389. X%{
  1390. X/*
  1391. X**    The %union declares yylval and the Yacc value stack as a C language
  1392. X**    union of types specified in the body.
  1393. X**
  1394. X**    The %type assigns member declared in the %union to non-terminals.
  1395. X**    The %token <..> assigns member declared in the %union to terminals.
  1396. X*/
  1397. X%}
  1398. X%union{
  1399. X    int    number;
  1400. X    char    *string;
  1401. X}
  1402. X
  1403. X%token    <number> NUMBER
  1404. X%token    <string> STRING
  1405. X%token    <string> QUOTE_STRING
  1406. X%token    <string> EVAR
  1407. X%token     COMMA EQUAL
  1408. X%token     SCREEN_TITLE SCREEN_ROWS SCREEN_COLS SCREEN_BORDER SCREEN_POS
  1409. X%token     SCREEN_HELP EXIT_LAST_FIELD
  1410. X%token     FIELD_NAME FIELD_LABEL FIELD_ROW FIELD_COL FIELD_MASK FIELD_RANGE
  1411. X%token    FIELD_LENGTH FIELD_MIN FIELD_TYPE FIELD_ADJUST FIELD_MUSTENTER 
  1412. X%token    FIELD_TERMINATOR FIELD_PROMPT FIELD_DEFAULTS FIELD_NOINPUT
  1413. X
  1414. X%%
  1415. X
  1416. X
  1417. Xscreen        : valid_field
  1418. X        | screen valid_field
  1419. X        | screen COMMA valid_field
  1420. X        ;
  1421. X
  1422. Xvalid_field    : screen_pos 
  1423. X        {
  1424. X            strcpy (eott, "window_pos");
  1425. X            if (debug)
  1426. X            {
  1427. X                fprintf (stderr, 
  1428. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> window_pos");
  1429. X                fflush (stderr);
  1430. X            }
  1431. X        }
  1432. X        ;
  1433. X        | screen_rows 
  1434. X        {
  1435. X            strcpy (eott, "window_rows");
  1436. X            if (debug)
  1437. X            {
  1438. X                fprintf (stderr, 
  1439. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> window_rows");
  1440. X                fflush (stderr);
  1441. X            }
  1442. X        }
  1443. X        ;
  1444. X        | screen_cols 
  1445. X        {
  1446. X            strcpy (eott, "window_cols");
  1447. X            if (debug)
  1448. X            {
  1449. X                fprintf (stderr, 
  1450. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> window_cols");
  1451. X                fflush (stderr);
  1452. X            }
  1453. X        }
  1454. X        ;
  1455. X        | screen_border
  1456. X        {
  1457. X            strcpy (eott, "window_border");
  1458. X            if (debug)
  1459. X            {
  1460. X                fprintf (stderr, 
  1461. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> window_border");
  1462. X                fflush (stderr);
  1463. X            }
  1464. X        }
  1465. X        ;
  1466. X        | screen_title
  1467. X        {
  1468. X            strcpy (eott, "window_title");
  1469. X            if (debug)
  1470. X            {
  1471. X                fprintf (stderr, 
  1472. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> window_title");
  1473. X                fflush (stderr);
  1474. X            }
  1475. X        }
  1476. X        ;
  1477. X        | screen_help
  1478. X        {
  1479. X            strcpy (eott, "helpfile");
  1480. X            if (debug)
  1481. X            {
  1482. X                fprintf (stderr, 
  1483. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> helpfile");
  1484. X                fflush (stderr);
  1485. X            }
  1486. X        }
  1487. X        ;
  1488. X        | exit_last_field
  1489. X        {
  1490. X            strcpy (eott, "exit_last_field");
  1491. X            if (debug)
  1492. X            {
  1493. X                fprintf (stderr, 
  1494. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> exit_last_field");
  1495. X                fflush (stderr);
  1496. X            }
  1497. X        }
  1498. X        ;
  1499. X
  1500. X        | field_name 
  1501. X        {
  1502. X            strcpy (eott, "field_name");
  1503. X            if (debug)
  1504. X            {
  1505. X                fprintf (stderr, 
  1506. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_name");
  1507. X                fflush (stderr);
  1508. X            }
  1509. X        }
  1510. X        ;
  1511. X        | field_label 
  1512. X        {
  1513. X            strcpy (eott, "field_label");
  1514. X            if (debug)
  1515. X            {
  1516. X                fprintf (stderr, 
  1517. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_label");
  1518. X                fflush (stderr);
  1519. X            }
  1520. X        }
  1521. X        ;
  1522. X        | field_row 
  1523. X        {
  1524. X            strcpy (eott, "field_row");
  1525. X            if (debug)
  1526. X            {
  1527. X                fprintf (stderr, 
  1528. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_row");
  1529. X                fflush (stderr);
  1530. X            }
  1531. X        }
  1532. X        ;
  1533. X        | field_col 
  1534. X        {
  1535. X            strcpy (eott, "field_col");
  1536. X            if (debug)
  1537. X            {
  1538. X                fprintf (stderr, 
  1539. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_col");
  1540. X                fflush (stderr);
  1541. X            }
  1542. X        }
  1543. X        ;
  1544. X        | field_mask
  1545. X        {
  1546. X            strcpy (eott, "field_mask");
  1547. X            if (debug)
  1548. X            {
  1549. X                fprintf (stderr, 
  1550. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_mask");
  1551. X                fflush (stderr);
  1552. X            }
  1553. X        }
  1554. X        ;
  1555. X        | field_range 
  1556. X        {
  1557. X            strcpy (eott, "field_range");
  1558. X            if (debug)
  1559. X            {
  1560. X                fprintf (stderr, 
  1561. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_range");
  1562. X                fflush (stderr);
  1563. X            }
  1564. X        }
  1565. X        ;
  1566. X        | field_length 
  1567. X        {
  1568. X            strcpy (eott, "field_length");
  1569. X            if (debug)
  1570. X            {
  1571. X                fprintf (stderr, 
  1572. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_length");
  1573. X                fflush (stderr);
  1574. X            }
  1575. X        }
  1576. X        ;
  1577. X        | field_min 
  1578. X        {
  1579. X            strcpy (eott, "field_min");
  1580. X            if (debug)
  1581. X            {
  1582. X                fprintf (stderr, 
  1583. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_min");
  1584. X                fflush (stderr);
  1585. X            }
  1586. X        }
  1587. X        ;
  1588. X        | field_type
  1589. X        {
  1590. X            strcpy (eott, "field_edits");
  1591. X            if (debug)
  1592. X            {
  1593. X                fprintf (stderr, 
  1594. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_edits");
  1595. X                fflush (stderr);
  1596. X            }
  1597. X        }
  1598. X        ;
  1599. X        | field_adjust 
  1600. X        {
  1601. X            strcpy (eott, "field_adjust");
  1602. X            if (debug)
  1603. X            {
  1604. X                fprintf (stderr, 
  1605. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_adjust");
  1606. X                fflush (stderr);
  1607. X            }
  1608. X        }
  1609. X        ;
  1610. X        | field_mustenter 
  1611. X        {
  1612. X            strcpy (eott, "field_mustenter");
  1613. X            if (debug)
  1614. X            {
  1615. X                fprintf (stderr, 
  1616. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_mustenter");
  1617. X                fflush (stderr);
  1618. X            }
  1619. X        }
  1620. X        ;
  1621. X        | field_prompt 
  1622. X        {
  1623. X            strcpy (eott, "field_prompt");
  1624. X            if (debug)
  1625. X            {
  1626. X                fprintf (stderr, 
  1627. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_prompt");
  1628. X                fflush (stderr);
  1629. X            }
  1630. X        }
  1631. X        ;
  1632. X        | field_terminator
  1633. X        {
  1634. X            strcpy (eott, "field_terminator");
  1635. X            if (debug)
  1636. X            {
  1637. X                fprintf (stderr, 
  1638. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_terminator");
  1639. X                fflush (stderr);
  1640. X            }
  1641. X        }
  1642. X        ;
  1643. X        | field_defaults
  1644. X        {
  1645. X            strcpy (eott, "field_defaults");
  1646. X            if (debug)
  1647. X            {
  1648. X                fprintf (stderr, 
  1649. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_defaults");
  1650. X                fflush (stderr);
  1651. X            }
  1652. X        }
  1653. X        ;
  1654. X
  1655. X        | field_noinput 
  1656. X        {
  1657. X            strcpy (eott, "field_noinput");
  1658. X            if (debug)
  1659. X            {
  1660. X                fprintf (stderr, 
  1661. X                "\n[ParseDeSrn]<.DEFINE_SCREEN> field_noinput");
  1662. X                fflush (stderr);
  1663. X            }
  1664. X        }
  1665. X        ;
  1666. X
  1667. X
  1668. Xscreen_title    : SCREEN_TITLE EQUAL STRING
  1669. X        {
  1670. X            strcpy (yyscreen->title, $3);
  1671. X        }
  1672. X        | SCREEN_TITLE EQUAL EVAR
  1673. X        {
  1674. X            strcpy (yyscreen->title, $3);
  1675. X            /*
  1676. X            strcpy (yyscreen->title, (char *)getval (&$3,'1'));
  1677. X            */
  1678. X        }
  1679. X        | SCREEN_TITLE EQUAL QUOTE_STRING
  1680. X        {
  1681. X            strcpy (yyscreen->title, $3);
  1682. X            /*
  1683. X            strcpy (yyscreen->title, (char *)getval (&$3, '1'));
  1684. X            */
  1685. X        }
  1686. X        ;
  1687. X
  1688. Xscreen_help    : SCREEN_HELP EQUAL STRING
  1689. X        {
  1690. X            strcpy (yyscreen->helpfile, $3);
  1691. X        }
  1692. X        | SCREEN_HELP EQUAL QUOTE_STRING
  1693. X        {
  1694. X            strcpy (yyscreen->helpfile, $3);
  1695. X        }
  1696. X        ;
  1697. X
  1698. Xscreen_pos    : SCREEN_POS EQUAL NUMBER NUMBER
  1699. X        {
  1700. X            yyscreen->toprow = $3;
  1701. X            yyscreen->leftcol = $4;
  1702. X        }
  1703. X        | SCREEN_POS EQUAL EVAR EVAR
  1704. X        {
  1705. X            strcpy (yyscreen->toprowvar, $3);
  1706. X            strcpy (yyscreen->leftcolvar, $4);
  1707. X            /*
  1708. X            yyscreen->toprow = atoi ((char *)getval (&$3, '1'));
  1709. X            yyscreen->leftcol = atoi ((char *)getval (&$4, '1'));
  1710. X            */
  1711. X        }
  1712. X        | SCREEN_POS EQUAL NUMBER EVAR
  1713. X        {
  1714. X            yyscreen->toprow = $3;
  1715. X            strcpy (yyscreen->leftcolvar, $4);
  1716. X        }
  1717. X        | SCREEN_POS EQUAL EVAR NUMBER
  1718. X        {
  1719. X            /*
  1720. X            yyscreen->toprow = atoi ((char *)getval (&$3, '1'));
  1721. X            */
  1722. X            strcpy (yyscreen->toprowvar, $3);
  1723. X            yyscreen->leftcol = $4;
  1724. X        }
  1725. X        ;
  1726. X
  1727. Xscreen_rows    : SCREEN_ROWS EQUAL NUMBER
  1728. SHAR_EOF
  1729. echo "End of part 6"
  1730. echo "File ParseDeSrn.y is continued in part 7"
  1731. echo "7" > s2_seq_.tmp
  1732. exit 0
  1733.