home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume2 / usc / Part2 < prev    next >
Encoding:
Internet Message Format  |  1991-08-07  |  60.8 KB

  1. From: allbery@ncoast.UUCP (Brandon S. Allbery)
  2. Newsgroups: comp.sources.misc
  3. Subject: v02i034: UNIFY(r) Screens with Curses, Part 2 of 4
  4. Message-ID: <7161@ncoast.UUCP>
  5. Date: 31 Jan 88 04:11:32 GMT
  6. Approved: allbery@ncoast.UUCP
  7.  
  8. Comp.sources.misc: Volume 2, Issue 34
  9. Suvbmitted-By: The Moderator<allbery@ncoast.UUCP>
  10. Archive-Name: usc/Part2
  11.  
  12. I've received so many requests for my Unify(r) screen routines that I am
  13. posting them.  The USC library is in four parts; unshar them and type "make".
  14. The curses used is System V; BSDers will want to tweak the usual stuff, such
  15. as beep() and cbreak().
  16.  
  17. I also have a simple screen program using this; if demand warrants, I will
  18. post it -- but in terms of features, you're probably better off with ENTER.
  19.  
  20. #--------------------------------CUT HERE-------------------------------------
  21. #! /bin/sh
  22. #
  23. # This is a shell archive.  Save this into a file, edit it
  24. # and delete all lines above this comment.  Then give this
  25. # file to sh by executing the command "sh file".  The files
  26. # will be extracted into the current directory owned by
  27. # you with default permissions.
  28. #
  29. # The files contained herein are:
  30. #
  31. # -r--r--r--  1 allbery users      2117 Jan 30 18:01 inbuf.c
  32. # -r--r--r--  1 allbery users      1919 Jan 30 18:01 inc.c
  33. # -r--r--r--  1 allbery users      2521 Jan 30 18:01 incs.c
  34. # -r--r--r--  1 allbery users      5846 Jan 30 18:01 inl.c
  35. # -r--r--r--  1 allbery users      1155 Jan 30 18:01 input.c
  36. # -r--r--r--  1 allbery users      2604 Jan 30 18:01 inscrf.c
  37. # -r--r--r--  1 allbery users      1735 Jan 30 18:01 ishort.c
  38. # -r--r--r--  1 allbery users       667 Jan 30 18:01 istr.c
  39. # -r--r--r--  1 allbery users      2009 Jan 30 18:01 itime.c
  40. # -r--r--r--  1 allbery users       800 Jan 30 18:01 keybrd.c
  41. # -r--r--r--  1 allbery users      4049 Jan 30 18:01 loadscr.c
  42. # -r--r--r--  1 allbery users       953 Jan 30 18:01 mv_cur.c
  43. # -r--r--r--  1 allbery users      1160 Jan 30 18:01 outbuf.c
  44. # -r--r--r--  1 allbery users      1371 Jan 30 18:01 output.c
  45. # -r--r--r--  1 allbery users      1516 Jan 30 18:01 outscrf.c
  46. # -r--r--r--  1 allbery users      2679 Jan 30 18:01 pageout.c
  47. # -r--r--r--  1 allbery users       659 Jan 30 18:01 pamt.c
  48. # -r--r--r--  1 allbery users       894 Jan 30 18:01 pdata.c
  49. # -r--r--r--  1 allbery users      1018 Jan 30 18:01 pdate.c
  50. # -r--r--r--  1 allbery users      1382 Jan 30 18:01 pflt.c
  51. # -r--r--r--  1 allbery users       608 Jan 30 18:01 pflush.c
  52. # -r--r--r--  1 allbery users       619 Jan 30 18:01 phamt.c
  53. # -r--r--r--  1 allbery users       610 Jan 30 18:01 plong.c
  54. # -r--r--r--  1 allbery users      2557 Jan 30 18:01 priamd.c
  55. # -r--r--r--  1 allbery users       668 Jan 30 18:01 prmp.c
  56. # -r--r--r--  1 allbery users       807 Jan 30 18:01 prmpf.c
  57. # -r--r--r--  1 allbery users       667 Jan 30 18:01 prmprv.c
  58. # -r--r--r--  1 allbery users       976 Jan 30 18:01 prtmsg.c
  59. # -r--r--r--  1 allbery users       612 Jan 30 18:01 pshort.c
  60. # -r--r--r--  1 allbery users      1018 Jan 30 18:01 pstr.c
  61. # -r--r--r--  1 allbery users       735 Jan 30 18:01 ptct_crt.c
  62. #
  63. echo 'x - inbuf.c'
  64. if test -f inbuf.c; then echo 'shar: not overwriting inbuf.c'; else
  65. sed 's/^X//' << '________This_Is_The_END________' > inbuf.c
  66. X/*
  67. X * $Header: inbuf.c,v 1.5 87/04/29 14:19:12 brandon Exp $
  68. X *
  69. X * ``USC'' -- UNIFY(r) Screens using Curses
  70. X * UNIFY(r) is a registered trademark of Unify Corporation.
  71. X *
  72. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  73. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  74. X *
  75. X * $Log:    inbuf.c,v $
  76. X * Revision 1.5  87/04/29  14:19:12  brandon
  77. X * FLT display length is sfield length / 10
  78. X * 
  79. X * Revision 1.4  87/04/29  13:17:22  brandon
  80. X * The code to convert internal to display lengths was in gtube(); it belonged
  81. X * in here, so here it is.
  82. X * 
  83. X * Revision 1.3  87/04/29  11:40:50  brandon
  84. X * Added ability to OR an upshift flag with a screen field type to get auto
  85. X * upshifting on certain screen fields.  See also gdata.c.
  86. X * 
  87. X * Revision 1.2  87/04/29  11:30:40  brandon
  88. X * Added RCS header information
  89. X * 
  90. X */
  91. X
  92. X/*LINTLIBRARY*/
  93. X
  94. X#include "usc.h"
  95. X
  96. X/*
  97. X * ENTRY POINT:  inbuf() -- Input from a screen field to a buffer
  98. X *
  99. X * DIFFERENCE FROM UNIFY:  See inscrf().  The stuff about NULLDATEs on -3
  100. X * returns from gtube() is done, iff -DCOMPATIBILITY is given.  (There's no
  101. X * real need for it, and this implementation doesn't *have* that side effect
  102. X * unless extra code is added to force the issue.)
  103. X */
  104. X
  105. Xinbuf(sfld, buf)
  106. Xchar *buf; {
  107. X    int rc, oucf, len;
  108. X
  109. X    setraw();
  110. X    if (sfld < 0 || sfld > __nsf)
  111. X        xerror(-1, "inbuf", "Invalid screen field %d", sfld);
  112. X    oucf = _sh_up;
  113. X    _sh_up = __scf[sfld].q_type & _UCF;
  114. X    /* This code was in gtube(), because I screwed up! */
  115. X    len = __scf[sfld].q_len;
  116. X    switch (__scf[sfld].q_type) {
  117. X    case INT:
  118. X    case LONG:
  119. X    case STRNG:
  120. X        break;
  121. X    case AMT:
  122. X    case HAMT:
  123. X        len += 3;
  124. X        break;
  125. X    case DATE:
  126. X        len = 8;
  127. X        break;
  128. X    case HR:
  129. X        len = 5;
  130. X        break;
  131. X    case FLT:
  132. X        len /= 10;
  133. X        break;
  134. X    case COMB:
  135. X        xerror(-2, "inbuf", "COMB field %d illegal", sfld);
  136. X    }
  137. X    if (__scf[sfld].q_fld != 0)
  138. X        rc = gtube(__scf[sfld].q_fx, __scf[sfld].q_fy, __scf[sfld].q_fld, buf);
  139. X    else
  140. X        rc = inscrf(__scf[sfld].q_fx, __scf[sfld].q_fy, __scf[sfld].q_type & ~_UCF, len, buf);
  141. X#ifdef COMPATIBILITY
  142. X    if (rc == FWD && __scf[sfld].q_type == DATE)
  143. X        (short *) buf = NULLDATE;
  144. X#endif
  145. X    _sh_up = oucf;
  146. X    return rc;
  147. X}
  148. ________This_Is_The_END________
  149. if test `wc -l < inbuf.c` -ne 82; then
  150.     echo 'shar: inbuf.c was damaged during transit (should have been 82 bytes)'
  151. fi
  152. fi        ; : end of overwriting check
  153. echo 'x - inc.c'
  154. if test -f inc.c; then echo 'shar: not overwriting inc.c'; else
  155. sed 's/^X//' << '________This_Is_The_END________' > inc.c
  156. X/*
  157. X * $Header: inc.c,v 1.1 87/06/02 11:01:55 brandon Exp $
  158. X *
  159. X * ``USC'' -- UNIFY(r) Screens using Curses
  160. X * UNIFY(r) is a registered trademark of Unify Corporation.
  161. X *
  162. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  163. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  164. X *
  165. X * $Log:    inc.c,v $
  166. X * Revision 1.1  87/06/02  11:01:55  brandon
  167. X * Initial revision
  168. X * 
  169. X */
  170. X
  171. X/*LINTLIBRARY*/
  172. X
  173. X#include "usc.h"
  174. X
  175. X/*
  176. X * Input primitive.  Get a single input character.  If _sh_up is nonzero, shift
  177. X * to uppercase.  Underline is used (when available) in place of foreground/
  178. X * background stuff that curses doesn't grok anyway.
  179. X *
  180. X * The `clrf' flag specifies whether the buffer is cleared or not prior to
  181. X * input.  This is of doubtful utility, but....
  182. X */
  183. X
  184. Xint inc(buf, clrf)
  185. Xchar *buf;
  186. Xint clrf; {
  187. X    setraw();
  188. X    (void) attron(A_UNDERLINE);
  189. X    if (clrf)
  190. X        *buf = ' ';
  191. X    for (;;) {
  192. X        (void) printw("%c\b", *buf);
  193. X        (void) refresh();
  194. X        *buf = getchar() & 0x7f;
  195. X        switch (*buf) {
  196. X        case '\033':
  197. X        case '\005':
  198. X            (void) attroff(A_UNDERLINE);
  199. X            return GO;
  200. X        case '\t':
  201. X        case '\025':
  202. X            (void) attroff(A_UNDERLINE);
  203. X            return BACK;
  204. X        case '\n':
  205. X        case '\r':
  206. X        case ' ':
  207. X            (void) attroff(A_UNDERLINE);
  208. X            return (!clrf || *buf == ' '? FWD: FWD_OK);
  209. X        case '\b':
  210. X            (void) attroff(A_UNDERLINE);
  211. X            return BKSP;
  212. X        case '\006':
  213. X            (void) attroff(A_UNDERLINE);
  214. X            return CFWD;
  215. X        case '\002':
  216. X            (void) attroff(A_UNDERLINE);
  217. X            return CBACK;
  218. X        case '\026':
  219. X            (void) attroff(A_UNDERLINE);
  220. X            return LOOK;
  221. X        case '\030':
  222. X            (void) move(LINES - 1, 0);
  223. X            (void) clrtoeol();
  224. X            (void) refresh();
  225. X            (void) endwin();
  226. X            exit(0);
  227. X        case '\020':
  228. X            _inlsusp();
  229. X            break;
  230. X        case '\f':
  231. X        case '\022':
  232. X            (void) clearok(curscr);
  233. X            (void) wrefresh(curscr);
  234. X            break;
  235. X        default:
  236. X            if (*buf < ' ' || *buf == '\177') {
  237. X                (void) beep();
  238. X                break;
  239. X            }
  240. X            if (_sh_up && islower(*buf))
  241. X                *buf = toupper(*buf);
  242. X            return FWD_OK;
  243. X        }
  244. X    }
  245. X}
  246. ________This_Is_The_END________
  247. if test `wc -l < inc.c` -ne 90; then
  248.     echo 'shar: inc.c was damaged during transit (should have been 90 bytes)'
  249. fi
  250. fi        ; : end of overwriting check
  251. echo 'x - incs.c'
  252. if test -f incs.c; then echo 'shar: not overwriting incs.c'; else
  253. sed 's/^X//' << '________This_Is_The_END________' > incs.c
  254. X/*
  255. X * $Header: incs.c,v 1.5 87/06/03 11:39:50 brandon Exp $
  256. X *
  257. X * ``USC'' -- UNIFY(r) Screens using Curses
  258. X * UNIFY(r) is a registered trademark of Unify Corporation.
  259. X *
  260. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  261. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  262. X *
  263. X * $Log:    incs.c,v $
  264. X * Revision 1.5  87/06/03  11:39:50  brandon
  265. X * Added XRC_NOFLSH so incs() can be used by functions which build temporary
  266. X * windows; otherwise, the main window might be refresh()ed over the temp
  267. X * window, destroying it.
  268. X * 
  269. X * Revision 1.4  87/06/02  18:40:09  brandon
  270. X * Added XRC_FWDGO:  RETURN normally is interpreted as FWD, if XRC_FWDGO then
  271. X * RETURN is interpreted as GO.
  272. X * 
  273. X * Revision 1.3  87/06/02  14:22:37  brandon
  274. X * Added XRC_CHAR to return normal characters; this contradicts the original
  275. X * reason for incs(), but makes it more useful.  This effectively renders
  276. X * inc() unused; it is retained as a character-input-with-echo primitive.
  277. X * 
  278. X * Revision 1.2  87/06/02  12:16:24  brandon
  279. X * Forgot to change shellout() to _inlsusp().
  280. X * 
  281. X * Revision 1.1  87/06/01  16:48:39  brandon
  282. X * Initial revision
  283. X * 
  284. X */
  285. X
  286. X/*LINTLIBRARY*/
  287. X
  288. X#include "usc.h"
  289. X
  290. X/*
  291. X * Input primitive.  Get a single input character, accepting status returns
  292. X * only.  This is used when only the control characters are wanted, not any
  293. X * real input.  The argument is an XRC flag, valid only for the duration of
  294. X * the function.
  295. X */
  296. X
  297. Xint incs(xrc)
  298. Xint xrc; {
  299. X    int ch;
  300. X
  301. X    setraw();
  302. X    if ((xrc & XRC_NOFLSH) == 0)
  303. X        (void) refresh();
  304. X    for (;;) {
  305. X        ch = getchar() & 0x7f;
  306. X        switch (ch) {
  307. X        case '\033':
  308. X        case '\005':
  309. X            if (xrc & XRC_GO)
  310. X                return GO;
  311. X            (void) beep();
  312. X            break;
  313. X        case '\t':
  314. X        case '\025':
  315. X            return BACK;
  316. X        case '\n':
  317. X        case '\r':
  318. X            if (xrc & XRC_FWDGO)
  319. X                return GO;
  320. X            /*FALLTHROUGH*/
  321. X        case ' ':
  322. X            return FWD;
  323. X        case '\b':
  324. X            if (xrc & XRC_BKSP)
  325. X                return BKSP;
  326. X            (void) beep();
  327. X            break;
  328. X        case '\006':
  329. X            if (xrc & XRC_CFB)
  330. X                return CFWD;
  331. X            (void) beep();
  332. X            break;
  333. X        case '\002':
  334. X            if (xrc & XRC_CFB)
  335. X                return CBACK;
  336. X            (void) beep();
  337. X            break;
  338. X        case '\026':
  339. X            if (xrc & XRC_LOOK)
  340. X                return LOOK;
  341. X            (void) beep();
  342. X            break;
  343. X        case '\030':
  344. X            (void) move(LINES - 1, 0);
  345. X            (void) clrtoeol();
  346. X            (void) refresh();
  347. X            (void) endwin();
  348. X            exit(0);
  349. X        case '\020':
  350. X            _inlsusp();
  351. X            break;
  352. X        case '\f':
  353. X        case '\022':
  354. X            (void) clearok(curscr);
  355. X            (void) wrefresh(curscr);
  356. X            break;
  357. X        default:
  358. X            if ((xrc & XRC_CHAR) && ch > '!' && ch < '\177')
  359. X                return ch;
  360. X            (void) beep();
  361. X            break;
  362. X        }
  363. X    }
  364. X}
  365. ________This_Is_The_END________
  366. if test `wc -l < incs.c` -ne 111; then
  367.     echo 'shar: incs.c was damaged during transit (should have been 111 bytes)'
  368. fi
  369. fi        ; : end of overwriting check
  370. echo 'x - inl.c'
  371. if test -f inl.c; then echo 'shar: not overwriting inl.c'; else
  372. sed 's/^X//' << '________This_Is_The_END________' > inl.c
  373. X/*
  374. X * $Header: inl.c,v 1.15 87/06/09 11:37:10 brandon Exp $
  375. X *
  376. X * ``USC'' -- UNIFY(r) Screens using Curses
  377. X * UNIFY(r) is a registered trademark of Unify Corporation.
  378. X *
  379. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  380. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  381. X *
  382. X * $Log:    inl.c,v $
  383. X * Revision 1.15  87/06/09  11:37:10  brandon
  384. X * New interpretation of clrf flag:  val 0 = clear if first char typed is text,
  385. X * val 1 == clear on entry, val 2 = clear never.
  386. X * 
  387. X * Revision 1.14  87/06/01  16:29:24  brandon
  388. X * Moved shellout() to shellout.c with a new name, so as not to duplicate code
  389. X * in inc.c.
  390. X * 
  391. X * Revision 1.13  87/06/01  15:57:34  brandon
  392. X * Cleaned up ^X; added underline-disable to ^V.
  393. X * 
  394. X * Revision 1.12  87/06/01  08:30:14  brandon
  395. X * Added ^V (view) capability for related records.
  396. X * 
  397. X * Revision 1.11  87/05/28  14:03:17  brandon
  398. X * Added ^V (view aka LOOK) for automatic explicit relationship chaining.
  399. X * 
  400. X * Revision 1.10  87/05/28  13:36:13  brandon
  401. X * Logic of new-vs.-update and ^M input was wrong.
  402. X * 
  403. X * Revision 1.9  87/05/26  14:28:44  brandon
  404. X * Added (void) casts for tty mode changes.
  405. X * 
  406. X * Revision 1.8  87/05/26  13:31:55  brandon
  407. X * Added flag so that all updates return action code (*_OK).
  408. X * 
  409. X * Revision 1.7  87/05/26  11:18:59  brandon
  410. X * Added clrf flag for update functions.
  411. X * 
  412. X * Revision 1.6  87/05/12  14:27:04  brandon
  413. X * fixed final (!) insert bug
  414. X * 
  415. X * Revision 1.5  87/05/12  11:53:23  brandon
  416. X * Now keeps original screen contents until the first modifying character is
  417. X * typed, so the screen result of an initial BACK makes sense.
  418. X * Changed code to determine whether a key is an action or an entry action
  419. X * based on whether the buffer is empty or not AND the current cursor position;
  420. X * this is now roughly compatible with ENTER.
  421. X * 
  422. X * Revision 1.4  87/05/12  11:38:24  brandon
  423. X * Fixed job-control terminal settings.
  424. X * Fixed "open" bug.
  425. X * 
  426. X * Revision 1.3  87/05/12  11:27:31  brandon
  427. X * The "insert" and "delete" keys were swapped (!)
  428. X * The shellout wasn't restoring line mode.  (It still doesn't, for job control
  429. X * shells.)
  430. X * 
  431. X * Revision 1.2  87/04/29  11:30:42  brandon
  432. X * Added RCS header information
  433. X * 
  434. X */
  435. X
  436. X/*LINTLIBRARY*/
  437. X
  438. X#include "usc.h"
  439. X#include <signal.h>
  440. X
  441. X/* setxrc() changes this, if nonzero then extended returns are enabled */
  442. Xint __ext_rcodes = 0;
  443. X
  444. X/*
  445. X * Move to a specified location.  Wrap to the next line if necessary.
  446. X */
  447. X
  448. Xstatic void moveto(y, x) {
  449. X    while (x >= COLS) {
  450. X        x -= COLS;
  451. X        if (++y == LINES)
  452. X            y--;
  453. X    }
  454. X    (void) move(y, x);
  455. X}
  456. X
  457. X/*
  458. X * Check to see if the input buffer is all spaces.  If so and the cursor is
  459. X * at position zero, the action is a no-check (FWD, BACK, or GO) and the
  460. X * returned buffer will not be processed.
  461. X */
  462. X
  463. Xstatic int allspace(b, l)
  464. Xregister char *b;
  465. Xregister int l; {
  466. X    while (l-- > 0)
  467. X        if (*b++ != ' ')
  468. X            return 0;
  469. X    return 1;
  470. X}
  471. X
  472. X/*
  473. X * Input primitive.  Get a line of input.  If _sh_up is nonzero, shift to
  474. X * uppercase.  Underline is used (when available) in place of foreground/
  475. X * background stuff that curses doesn't grok anyway.
  476. X *
  477. X * Note that this is FAR smarter than the UNIFY version, including line editing
  478. X * commands (insert/delete character, cursor motion, etc.).  This falls into
  479. X * the category of ``why curses is better''.
  480. X *
  481. X * The `clrf' flag specifies whether the buffer is cleared or not prior to
  482. X * input.  This is used by the USC-specific u* functions (update buffer).
  483. X * If it is a value of 2, the buffer is never cleared except by ^K; otherwise
  484. X * if it is 0, it is cleared if the first character typed is a text character.
  485. X * If it is 1, the buffer is always cleared on entry.
  486. X */
  487. X
  488. Xint inl(buf, len, clrf)
  489. Xchar *buf;
  490. Xint len, clrf; {
  491. X    int y, x, cnt, ch, tmp, firsttime;
  492. X
  493. X    setraw();
  494. X    (void) attron(A_UNDERLINE);
  495. X    if (clrf == 1)
  496. X        cfill(' ', buf, len);
  497. X    getyx(stdscr, y, x);
  498. X    cnt = 0;
  499. X    firsttime = 1;
  500. X    for (;;) {
  501. X        (void) move(y, x);
  502. X        if (!firsttime || clrf != 1) {
  503. X            (void) printw("%.*s", len, buf);
  504. X            moveto(y, x + cnt);
  505. X        }
  506. X        (void) refresh();
  507. X        ch = getchar() & 0x7f;
  508. X        switch (ch) {
  509. X        case '\033':
  510. X        case '\005':
  511. X            if (!(__ext_rcodes & XRC_GO)) {
  512. X                (void) beep();
  513. X                break;
  514. X            }
  515. X            (void) attroff(A_UNDERLINE);
  516. X            return ((__ext_rcodes & XRC_XOK) && (clrf != 1 || !allspace(buf, len) || cnt != 0)? GO_OK: GO);
  517. X        case '\t':
  518. X        case '\025':
  519. X            (void) attroff(A_UNDERLINE);
  520. X            return ((__ext_rcodes & XRC_XOK) && (clrf != 1 || !allspace(buf, len) || cnt != 0)? BACK_OK: BACK);
  521. X        case '\n':
  522. X        case '\r':
  523. X            (void) attroff(A_UNDERLINE);
  524. X            return (clrf == 1 && (allspace(buf, len) && cnt == 0)? FWD: FWD_OK);
  525. X        case '\b':
  526. X            if (cnt == 0)
  527. X                (void) beep();
  528. X            else {
  529. X                for (tmp = --cnt; tmp < len - 1; tmp++)
  530. X                    buf[tmp] = buf[tmp + 1];
  531. X                buf[len - 1] = ' ';
  532. X            }
  533. X            break;
  534. X        case '\006':
  535. X            if (++cnt > len)
  536. X                cnt = 0;
  537. X            break;
  538. X        case '\002':
  539. X            if (--cnt < 0)
  540. X                cnt = len;
  541. X            break;
  542. X        case '\001':
  543. X            cnt = 0;
  544. X            break;
  545. X        case '\016':
  546. X            cnt = len;
  547. X            break;
  548. X        case '\017':
  549. X            for (tmp = len - 1; tmp > cnt; tmp--)
  550. X                buf[tmp] = buf[tmp - 1];
  551. X            buf[cnt] = ' ';
  552. X            break;
  553. X        case '\004':
  554. X            for (tmp = cnt; tmp < len - 1; tmp++)
  555. X                buf[tmp] = buf[tmp + 1];
  556. X            buf[len - 1] = ' ';
  557. X            break;
  558. X        case '\026':
  559. X            if (__ext_rcodes & XRC_LOOK) {
  560. X                (void) attroff(A_UNDERLINE);
  561. X                return LOOK;
  562. X            }
  563. X            (void) beep();
  564. X            break;
  565. X        case '\030':
  566. X            (void) move(LINES - 1, 0);
  567. X            (void) clrtoeol();
  568. X            (void) refresh();
  569. X            (void) endwin();
  570. X            exit(0);
  571. X        case '\013':
  572. X            cfill(' ', buf + cnt, len - cnt);
  573. X            break;
  574. X        case '\020':
  575. X            _inlsusp();
  576. X            break;
  577. X        case '\f':
  578. X        case '\022':
  579. X            (void) clearok(curscr);
  580. X            (void) wrefresh(curscr);
  581. X            break;
  582. X        default:
  583. X            if (cnt == len || ch < ' ' || ch == '\177') {
  584. X                (void) beep();
  585. X                break;
  586. X            }
  587. X            if (firsttime && clrf == 0)
  588. X                cfill(' ', buf, len);
  589. X            buf[cnt++] = (_sh_up? toupper(ch): ch);
  590. X        }
  591. X        firsttime = 0;
  592. X    }
  593. X}
  594. ________This_Is_The_END________
  595. if test `wc -l < inl.c` -ne 221; then
  596.     echo 'shar: inl.c was damaged during transit (should have been 221 bytes)'
  597. fi
  598. fi        ; : end of overwriting check
  599. echo 'x - input.c'
  600. if test -f input.c; then echo 'shar: not overwriting input.c'; else
  601. sed 's/^X//' << '________This_Is_The_END________' > input.c
  602. X/*
  603. X * $Header: input.c,v 1.3 87/04/29 11:44:40 brandon Exp $
  604. X *
  605. X * ``USC'' -- UNIFY(r) Screens using Curses
  606. X * UNIFY(r) is a registered trademark of Unify Corporation.
  607. X *
  608. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  609. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  610. X *
  611. X * $Log:    input.c,v $
  612. X * Revision 1.3  87/04/29  11:44:40  brandon
  613. X * Added _UCF upshifting.  See also inbuf.c, xsfldesc.c.  (The comment in
  614. X * inbuf.c is WRONG!)
  615. X * Also caused error on screen field w/o database field.
  616. X * 
  617. X * Revision 1.2  87/04/29  11:30:44  brandon
  618. X * Added RCS header information
  619. X * 
  620. X */
  621. X
  622. X/*LINTLIBRARY*/
  623. X
  624. X#include "usc.h"
  625. X
  626. X/*
  627. X * ENTRY POINT:  input() -- Get data from a screen field and store it in
  628. X * the database.
  629. X *
  630. X * DIFFERENCE FROM UNIFY:  See gdata().
  631. X */
  632. X
  633. Xinput(sfld) {
  634. X    int rc, ousf;
  635. X
  636. X    if (sfld < 0 || sfld >= __nsf)
  637. X        xerror(-1, "input", "Invalid screen field %d", sfld);
  638. X    if (__scf[sfld].q_fld == 0)
  639. X        xerror(-2, "input", "Screen field %d has no associated database field", sfld);
  640. X    ousf = _sh_up;
  641. X    _sh_up = __scf[sfld].q_type & _UCF;
  642. X    rc = gdata(__scf[sfld].q_fx, __scf[sfld].q_fy, __scf[sfld].q_fld);
  643. X    _sh_up = ousf;
  644. X    return rc;
  645. X}
  646. ________This_Is_The_END________
  647. if test `wc -l < input.c` -ne 44; then
  648.     echo 'shar: input.c was damaged during transit (should have been 44 bytes)'
  649. fi
  650. fi        ; : end of overwriting check
  651. echo 'x - inscrf.c'
  652. if test -f inscrf.c; then echo 'shar: not overwriting inscrf.c'; else
  653. sed 's/^X//' << '________This_Is_The_END________' > inscrf.c
  654. X/*
  655. X * $Header: inscrf.c,v 1.7 87/06/01 10:55:37 brandon Exp $
  656. X *
  657. X * ``USC'' -- UNIFY(r) Screens using Curses
  658. X * UNIFY(r) is a registered trademark of Unify Corporation.
  659. X *
  660. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  661. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  662. X *
  663. X * $Log:    inscrf.c,v $
  664. X * Revision 1.7  87/06/01  10:55:37  brandon
  665. X * _sh_up only forced up; left as is if type doesn't have _UCF.
  666. X * 
  667. X * Revision 1.6  87/06/01  08:30:20  brandon
  668. X * Added ^V (view) capability for related records.
  669. X * 
  670. X * Revision 1.5  87/05/22  15:39:06  brandon
  671. X * whoops!  It doesn't help to leave off the "break"'s in a switch().
  672. X * 
  673. X * Revision 1.4  87/05/12  17:19:19  brandon
  674. X * Forgot to get rid of _UCF temporarily during type check
  675. X * 
  676. X * Revision 1.3  87/05/12  17:00:28  brandon
  677. X * Enabled _UCF flag for type.
  678. X * 
  679. X * Revision 1.2  87/04/29  11:30:46  brandon
  680. X * Added RCS header information
  681. X * 
  682. X */
  683. X
  684. X/*LINTLIBRARY*/
  685. X
  686. X#include "usc.h"
  687. X
  688. X/*
  689. X * ENTRY POINT: inscrf() -- Take a type and (character) length, and call the
  690. X * correct input routine for the type.
  691. X *
  692. X * DIFFERENCE FROM UNIFY:  In addition to the standard return codes, there are
  693. X * a number of new ones.  If you want to use them, call setxrc() with a non-
  694. X * zero argument.  The new codes are:
  695. X *
  696. X *        -5    ESC or ^E
  697. X *        -6    ESC or ^E, returns buffer
  698. X *        -7    ^U or TAB, returns buffer
  699. X *
  700. X * Also, the following line-editing characters are supported:
  701. X *
  702. X *        ^H        delete last charater
  703. X *        ^F        move forward (wraps to beginning)
  704. X *        ^B        move backward (wraps to end)
  705. X *        ^A        move to start of field
  706. X *        ^N        move to end of field
  707. X *        ^O        insert a space
  708. X *        ^D        delete a character
  709. X *        ^K        clear to end of field
  710. X *        ^X        exit program
  711. X *        ^R, ^L        redraw screen
  712. X *        ^P        shell out
  713. X *        ^V        view related records
  714. X *
  715. X * I would have used ^Z for end-of-field, but I see no reason to get the
  716. X * people with job control or sxt's upset at me...
  717. X */
  718. X
  719. Xint inscrf(x, y, type, len, buf)
  720. Xchar *buf; {
  721. X    int rc, oucf;
  722. X
  723. X    setraw();
  724. X    mv_cur(1, x, y);
  725. X    oucf = _sh_up;
  726. X    if (type & _UCF)
  727. X        _sh_up = type & _UCF;
  728. X    type &= ~_UCF;
  729. X    switch (type) {
  730. X    case INT:
  731. X        rc = ishort(len, (short *) buf);
  732. X        break;
  733. X    case LONG:
  734. X        rc = ilong(len, (long *) buf);
  735. X        break;
  736. X    case AMT:
  737. X        rc = iamt(len, (long *) buf);
  738. X        break;
  739. X    case HAMT:
  740. X        rc = ihamt(len, (double *) buf);
  741. X        break;
  742. X    case STRNG:
  743. X        rc = istr(len, buf);
  744. X        break;
  745. X    case DATE:
  746. X        rc = idate((short *) buf);
  747. X        break;
  748. X    case HR:
  749. X        rc = itime((short *) buf);
  750. X        break;
  751. X    case FLT:
  752. X        rc = iflt(len, (double *) buf);
  753. X        break;
  754. X    default:
  755. X        xerror(-1, "inscrf", "Unknown type %d", type);
  756. X        /*NOTREACHED*/
  757. X    }
  758. X    _sh_up = oucf;
  759. X    return rc;
  760. X}
  761. ________This_Is_The_END________
  762. if test `wc -l < inscrf.c` -ne 107; then
  763.     echo 'shar: inscrf.c was damaged during transit (should have been 107 bytes)'
  764. fi
  765. fi        ; : end of overwriting check
  766. echo 'x - ishort.c'
  767. if test -f ishort.c; then echo 'shar: not overwriting ishort.c'; else
  768. sed 's/^X//' << '________This_Is_The_END________' > ishort.c
  769. X/*
  770. X * $Header: ishort.c,v 1.6 87/06/09 11:45:35 brandon Exp $
  771. X *
  772. X * ``USC'' -- UNIFY(r) Screens using Curses
  773. X * UNIFY(r) is a registered trademark of Unify Corporation.
  774. X *
  775. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  776. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  777. X *
  778. X * $Log:    ishort.c,v $
  779. X * Revision 1.6  87/06/09  11:45:35  brandon
  780. X * Added code to relocate cursor after conversion error message.
  781. X * 
  782. X * Revision 1.5  87/06/01  08:30:29  brandon
  783. X * Added ^V (view) capability for related records.
  784. X * 
  785. X * Revision 1.4  87/05/26  13:32:29  brandon
  786. X * Changed for new inl() (forces no-update mode).
  787. X * 
  788. X * Revision 1.3  87/05/12  12:03:40  brandon
  789. X * Changed to pass FWD, BACK, GO without checking the data buffer
  790. X * 
  791. X * Revision 1.2  87/04/29  11:30:48  brandon
  792. X * Added RCS header information
  793. X * 
  794. X */
  795. X
  796. X/*LINTLIBRARY*/
  797. X
  798. X#include "usc.h"
  799. X
  800. X/*
  801. X * Input an item of type (short).
  802. X */
  803. X
  804. Xint ishort(len, buf)
  805. Xshort *buf; {
  806. X    char ibuf[4];
  807. X    int rc, cnt, sign, y, x;
  808. X
  809. X    setraw();
  810. X    if (len > 4)
  811. X        len = 4;    /* (short)'s are max len = 4 */
  812. X    getyx(stdscr, y, x);
  813. X    for (;;) {
  814. X        (void) move(y, x);
  815. X        if ((rc = inl(ibuf, len, 1)) == BACK || rc == FWD || rc == GO || rc == LOOK)
  816. X            return rc;
  817. X        for (cnt = 0; cnt < len && ibuf[cnt] == ' '; cnt++)
  818. X            ;
  819. X        if (cnt == len) {
  820. X            prtmsg(1, 23, "Invalid number");
  821. X            continue;
  822. X        }
  823. X        *buf = 0;
  824. X        sign = 0;
  825. X        if (ibuf[cnt] == '-') {
  826. X            sign = 1;
  827. X            if (++cnt == len) {
  828. X                prtmsg(1, 23, "Invalid number");
  829. X                continue;
  830. X            }
  831. X        }
  832. X        for (; cnt < len && isdigit(ibuf[cnt]); cnt++) {
  833. X            *buf *= 10;
  834. X            *buf += ibuf[cnt] - '0';
  835. X        }
  836. X        for (; cnt < len && ibuf[cnt] == ' '; cnt++)
  837. X            ;
  838. X        if (cnt == len)
  839. X             break;
  840. X        prtmsg(1, 23, "Invalid number");
  841. X    }
  842. X    if (sign)
  843. X        *buf = - *buf;
  844. X    return rc;
  845. X}
  846. ________This_Is_The_END________
  847. if test `wc -l < ishort.c` -ne 77; then
  848.     echo 'shar: ishort.c was damaged during transit (should have been 77 bytes)'
  849. fi
  850. fi        ; : end of overwriting check
  851. echo 'x - istr.c'
  852. if test -f istr.c; then echo 'shar: not overwriting istr.c'; else
  853. sed 's/^X//' << '________This_Is_The_END________' > istr.c
  854. X/*
  855. X * $Header: istr.c,v 1.3 87/05/26 13:32:49 brandon Exp $
  856. X *
  857. X * ``USC'' -- UNIFY(r) Screens using Curses
  858. X * UNIFY(r) is a registered trademark of Unify Corporation.
  859. X *
  860. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  861. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  862. X *
  863. X * $Log:    istr.c,v $
  864. X * Revision 1.3  87/05/26  13:32:49  brandon
  865. X * Changed for new inl() (forces no-update mode).
  866. X * 
  867. X * Revision 1.2  87/04/29  11:30:50  brandon
  868. X * Added RCS header information
  869. X * 
  870. X */
  871. X
  872. X/*LINTLIBRARY*/
  873. X
  874. X#include "usc.h"
  875. X
  876. X/*
  877. X * Get a string.  Very easy, since no checking is needed.
  878. X */
  879. X
  880. Xint istr(len, buf)
  881. Xchar *buf; {
  882. X    setraw();
  883. X    return inl(buf, len, 1);
  884. X}
  885. ________This_Is_The_END________
  886. if test `wc -l < istr.c` -ne 31; then
  887.     echo 'shar: istr.c was damaged during transit (should have been 31 bytes)'
  888. fi
  889. fi        ; : end of overwriting check
  890. echo 'x - itime.c'
  891. if test -f itime.c; then echo 'shar: not overwriting itime.c'; else
  892. sed 's/^X//' << '________This_Is_The_END________' > itime.c
  893. X/*
  894. X * $Header: itime.c,v 1.7 87/06/09 11:45:37 brandon Exp $
  895. X *
  896. X * ``USC'' -- UNIFY(r) Screens using Curses
  897. X * UNIFY(r) is a registered trademark of Unify Corporation.
  898. X *
  899. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  900. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  901. X *
  902. X * $Log:    itime.c,v $
  903. X * Revision 1.7  87/06/09  11:45:37  brandon
  904. X * Added code to relocate cursor after conversion error message.
  905. X * 
  906. X * Revision 1.6  87/06/01  08:30:44  brandon
  907. X * Added ^V (view) capability for related records.
  908. X * 
  909. X * Revision 1.5  87/05/26  13:32:53  brandon
  910. X * Changed for new inl() (forces no-update mode).
  911. X * 
  912. X * Revision 1.4  87/05/12  13:26:31  brandon
  913. X * Dumb bug in : parsing.
  914. X * 
  915. X * Revision 1.3  87/05/12  12:04:10  brandon
  916. X * Changed to pass FWD, BACK, GO without checking the data buffer
  917. X * 
  918. X * Revision 1.2  87/04/29  11:30:53  brandon
  919. X * Added RCS header information
  920. X * 
  921. X */
  922. X
  923. X/*LINTLIBRARY*/
  924. X
  925. X#include "usc.h"
  926. X
  927. X/*
  928. X * Get a time.  H:M only.
  929. X */
  930. X
  931. Xint itime(buf)
  932. Xshort *buf; {
  933. X    int cnt, rc, hr, min, y, x;
  934. X    char ibuf[5];
  935. X
  936. X    setraw();
  937. X    getyx(stdscr, y, x);
  938. X    for (;;) {
  939. X        (void) move(y, x);
  940. X        if ((rc = inl(ibuf, 5, 1)) == BACK || rc == FWD || rc == GO || rc == LOOK)
  941. X            return rc;
  942. X        for (cnt = 0; cnt < 5 && ibuf[cnt] == ' '; cnt++)
  943. X            ;
  944. X        if (cnt == 5) {
  945. X            prtmsg(1, 23, "Invalid time");
  946. X            continue;
  947. X        }
  948. X        if (!isdigit(cnt)) {
  949. X            prtmsg(1, 23, "Invalid time");
  950. X            continue;
  951. X        }
  952. X        hr = 0;
  953. X        min = 0;
  954. X        while (cnt < 5 && isdigit(ibuf[cnt])) {
  955. X            hr *= 10;
  956. X            hr += ibuf[cnt++] - '0';
  957. X        }
  958. X        if (cnt > 2 || ibuf[cnt++] != ':') {
  959. X            prtmsg(1, 23, "Invalid time");
  960. X            continue;
  961. X        }
  962. X        if (!isdigit(ibuf[cnt])) {
  963. X            prtmsg(1, 23, "Invalid time");
  964. X            continue;
  965. X        }
  966. X        min = 10 * (ibuf[cnt++] - '0');
  967. X        if (!isdigit(ibuf[cnt])) {
  968. X            prtmsg(1, 23, "Invalid time");
  969. X            continue;
  970. X        }
  971. X        min += ibuf[cnt++] - '0';
  972. X        while (cnt < 5)
  973. X            if (ibuf[cnt++] != ' ') {
  974. X                prtmsg(1, 23, "Invalid time");
  975. X                continue;
  976. X            }
  977. X        if (hr < 23 && min < 59)
  978. X            break;
  979. X        prtmsg(1, 23, "Invalid time");
  980. X    }
  981. X    return rc;
  982. X}
  983. ________This_Is_The_END________
  984. if test `wc -l < itime.c` -ne 90; then
  985.     echo 'shar: itime.c was damaged during transit (should have been 90 bytes)'
  986. fi
  987. fi        ; : end of overwriting check
  988. echo 'x - keybrd.c'
  989. if test -f keybrd.c; then echo 'shar: not overwriting keybrd.c'; else
  990. sed 's/^X//' << '________This_Is_The_END________' > keybrd.c
  991. X/*
  992. X * $Header: keybrd.c,v 1.2 87/04/29 11:30:55 brandon Exp $
  993. X *
  994. X * ``USC'' -- UNIFY(r) Screens using Curses
  995. X * UNIFY(r) is a registered trademark of Unify Corporation.
  996. X *
  997. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  998. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  999. X *
  1000. X * $Log:    keybrd.c,v $
  1001. X * Revision 1.2  87/04/29  11:30:55  brandon
  1002. X * Added RCS header information
  1003. X * 
  1004. X */
  1005. X
  1006. X/*LINTLIBRARY*/
  1007. X
  1008. X#include "usc.h"
  1009. X
  1010. X/*
  1011. X * ENTRY POINT:  keybrd() -- lock or unlock the terminal keyboard
  1012. X *
  1013. X * DIFFERENCE FROM UNIFY:  I don't know if UNIFY uses this (it doesn't mention
  1014. X * termcap support for it), but here it's a no-op except for checking fd = 1
  1015. X * as usual.
  1016. X */
  1017. X
  1018. Xvoid keybrd(fd, flg) {
  1019. X    if (fd != 1)
  1020. X        xerror(-1, "eras_ln", "Multi-terminal operation on fd %d not supported", fd);
  1021. X}
  1022. ________This_Is_The_END________
  1023. if test `wc -l < keybrd.c` -ne 31; then
  1024.     echo 'shar: keybrd.c was damaged during transit (should have been 31 bytes)'
  1025. fi
  1026. fi        ; : end of overwriting check
  1027. echo 'x - loadscr.c'
  1028. if test -f loadscr.c; then echo 'shar: not overwriting loadscr.c'; else
  1029. sed 's/^X//' << '________This_Is_The_END________' > loadscr.c
  1030. X/*
  1031. X * $Header: loadscr.c,v 1.8 87/06/11 15:21:36 brandon Exp $
  1032. X *
  1033. X * ``USC'' -- UNIFY(r) Screens using Curses
  1034. X * UNIFY(r) is a registered trademark of Unify Corporation.
  1035. X *
  1036. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  1037. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  1038. X *
  1039. X * $Log:    loadscr.c,v $
  1040. X * Revision 1.8  87/06/11  15:21:36  brandon
  1041. X * Wasn't checking the display length against the actual length of fields.
  1042. X * 
  1043. X * Revision 1.7  87/05/12  11:22:52  brandon
  1044. X * Forgot to move to the screen field position before underlining!
  1045. X * 
  1046. X * Revision 1.6  87/05/11  17:01:36  brandon
  1047. X * dumb bug (sf_type???)
  1048. X * 
  1049. X * Revision 1.5  87/05/11  16:54:57  brandon
  1050. X * added code to underline screen fields initially
  1051. X * 
  1052. X * Revision 1.4  87/05/11  15:30:09  brandon
  1053. X * chekcs removed, loadscr() works
  1054. X * 
  1055. X * Revision 1.3  87/05/11  15:26:34  brandon
  1056. X * added a hook to find a bug in sfield handling
  1057. X * 
  1058. X * Revision 1.2  87/04/29  11:30:57  brandon
  1059. X * Added RCS header information
  1060. X * 
  1061. X */
  1062. X
  1063. X/*LINTLIBRARY*/
  1064. X
  1065. X#include "usc.h"
  1066. X
  1067. Xstruct q *__scf = (struct q *) 0;
  1068. Xint __nsf = 0;
  1069. Xint _sh_up = 0;
  1070. X
  1071. X/*
  1072. X * Display a string, handling ~-escapes and null-terminating.
  1073. X */
  1074. X
  1075. Xstatic void mvspit(y, x, s, l)
  1076. Xchar *s; {
  1077. X    int c;
  1078. X
  1079. X#ifdef UNIFY32
  1080. X    _sdbrt();    /* get bracket & date information */
  1081. X#endif
  1082. X    for (c = l - 1; s[c] == ' '; c--)
  1083. X        if (c == 0)
  1084. X            return;
  1085. X    s[++c] = '\0';
  1086. X    (void) move(y, x);
  1087. X    for (c = 0; s[c] != '\0'; c++)
  1088. X        if (s[c] != '~') {
  1089. X#ifdef UNIFY32
  1090. X            if (_ldbrt & UNITED_STATES)
  1091. X                (void) addch(s[c]);
  1092. X            else
  1093. X                switch (s[c]) {
  1094. X                case '[':
  1095. X                    (void) addch('(');
  1096. X                    break;
  1097. X                case '(':
  1098. X                    (void) addch('[');
  1099. X                    break;
  1100. X                case ')':
  1101. X                    (void) addch(']');
  1102. X                    break;
  1103. X                case ']':
  1104. X                    (void) addch(')');
  1105. X                    break;
  1106. X                default:
  1107. X                    (void) addch(s[c]);
  1108. X                }
  1109. X#else
  1110. X            (void) addch(s[c]);
  1111. X#endif
  1112. X        } else
  1113. X            switch (s[++c]) {
  1114. X            case 'r':
  1115. X                (void) attron(A_REVERSE);
  1116. X                break;
  1117. X            case 's':
  1118. X                (void) attroff(A_REVERSE);
  1119. X                break;
  1120. X            case 'u':
  1121. X                (void) attron(A_UNDERLINE);
  1122. X                break;
  1123. X            case 'v':
  1124. X                (void) attroff(A_UNDERLINE);
  1125. X                break;
  1126. X            case 'w':
  1127. X                (void) attron(A_REVERSE|A_UNDERLINE);
  1128. X                break;
  1129. X            case 'x':
  1130. X                (void) attroff(A_REVERSE|A_UNDERLINE);
  1131. X                break;
  1132. X            case '\0':
  1133. X                c--;
  1134. X                break;
  1135. X            default:
  1136. X                break;
  1137. X            }
  1138. X}
  1139. X
  1140. X/*
  1141. X * ENTRY POINT:  loadscr() -- Load and display a screen .q file.
  1142. X *
  1143. X * DIFFERENCE FROM UNIFY:  None.
  1144. X */
  1145. X
  1146. Xvoid loadscr(s)
  1147. Xchar *s; {
  1148. X    FLDESC fd;
  1149. X    FILE *fp;
  1150. X    char *sf;
  1151. X    int cnt;
  1152. X
  1153. X    setraw();
  1154. X    if (__scf != (struct q *) 0)
  1155. X        free((char *) __scf);
  1156. X    __nsf = 0;
  1157. X    if ((sf = dbfile(s, "q")) == (char *) 0)
  1158. X        xerror(-1, "loadscr", "Cannot find screen %s", s);
  1159. X    if ((fp = fopen(sf, "r")) == (FILE *) 0)
  1160. X        xerror(-2, "loadscr", "Cannot open screen %s", s);
  1161. X    (void) fseek(fp, 0L, 2);
  1162. X    if (ftell(fp) == 0L)
  1163. X        return;    /* empty??? */
  1164. X    if ((__scf = (struct q *) malloc((unsigned int) (__nsf = (int) ftell(fp)))) == (struct q *) 0)
  1165. X        xerror(-3, "loadscr", "Out of memory");
  1166. X    rewind(fp);
  1167. X    __nsf /= sizeof *__scf;
  1168. X    if (fread((char *) __scf, (int) sizeof *__scf, __nsf, fp) != __nsf)
  1169. X        xerror(-4, "loadscr", "Read error on screen %s", s);
  1170. X    for (cnt = 0; cnt < __nsf; cnt++) {
  1171. X        if (__scf[cnt].q_fld == 0)
  1172. X            continue;
  1173. X        if (!fldesc(__scf[cnt].q_fld, &fd))
  1174. X            xerror(-5, "loadscr", "Invalid database field %.*s", sizeof __scf[cnt].q_dbfld, __scf[cnt].q_dbfld);
  1175. X        if (fd.f_typ != __scf[cnt].q_type)
  1176. X            xerror(-6, "loadscr", "Database field %.*s type has changed -- recompile screen", sizeof __scf[cnt].q_dbfld, __scf[cnt].q_dbfld);
  1177. X        if (fd.f_len != xsize(__scf[cnt].q_type, __scf[cnt].q_len))
  1178. X            xerror(-7, "loadscr", "Database field %.*s length has changed -- recompile screen", sizeof __scf[cnt].q_dbfld, __scf[cnt].q_dbfld);
  1179. X    }
  1180. X    (void) erase();
  1181. X    for (cnt = 0; cnt < __nsf; cnt++) {
  1182. X        mvspit(__scf[cnt].q_py, __scf[cnt].q_px, __scf[cnt].q_prmp, sizeof __scf[cnt].q_prmp);
  1183. X        if (__scf[cnt].q_type != 0) {
  1184. X            (void) move(__scf[cnt].q_fy, __scf[cnt].q_fx);
  1185. X            (void) attron(A_UNDERLINE);
  1186. X            (void) printw("%*s", xsize(__scf[cnt].q_type, __scf[cnt].q_len), "");
  1187. X            (void) attroff(A_UNDERLINE);
  1188. X        }
  1189. X    }
  1190. X}
  1191. ________This_Is_The_END________
  1192. if test `wc -l < loadscr.c` -ne 161; then
  1193.     echo 'shar: loadscr.c was damaged during transit (should have been 161 bytes)'
  1194. fi
  1195. fi        ; : end of overwriting check
  1196. echo 'x - mv_cur.c'
  1197. if test -f mv_cur.c; then echo 'shar: not overwriting mv_cur.c'; else
  1198. sed 's/^X//' << '________This_Is_The_END________' > mv_cur.c
  1199. X/*
  1200. X * $Header: mv_cur.c,v 1.2 87/04/29 11:31:01 brandon Exp $
  1201. X *
  1202. X * ``USC'' -- UNIFY(r) Screens using Curses
  1203. X * UNIFY(r) is a registered trademark of Unify Corporation.
  1204. X *
  1205. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  1206. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  1207. X *
  1208. X * $Log:    mv_cur.c,v $
  1209. X * Revision 1.2  87/04/29  11:31:01  brandon
  1210. X * Added RCS header information
  1211. X * 
  1212. X */
  1213. X
  1214. X/*LINTLIBRARY*/
  1215. X
  1216. X#include "usc.h"
  1217. X
  1218. X/*
  1219. X * ENTRY POINT:  mv_cur() -- move cursor on a given fd
  1220. X *
  1221. X * DIFFERENCE FROM UNIFY:  If fd isn't 1, you get a run-time error; use the
  1222. X * old library if you want funny terminal stuff, or else hook into terminfo-
  1223. X * based curses and call newterm().  I daresay nobody uses the fd hook anyway.
  1224. X */
  1225. X
  1226. Xvoid mv_cur(fd, x, y) {
  1227. X    if (fd != 1)
  1228. X        xerror(-1, "eras_ln", "Multi-terminal operation on fd %d not supported", fd);
  1229. X    if (move(y, x) == ERR)
  1230. X        xerror(-1, "mv_cur", "(%d, %d) cursor position is off the screen", x, y);
  1231. X}
  1232. ________This_Is_The_END________
  1233. if test `wc -l < mv_cur.c` -ne 33; then
  1234.     echo 'shar: mv_cur.c was damaged during transit (should have been 33 bytes)'
  1235. fi
  1236. fi        ; : end of overwriting check
  1237. echo 'x - outbuf.c'
  1238. if test -f outbuf.c; then echo 'shar: not overwriting outbuf.c'; else
  1239. sed 's/^X//' << '________This_Is_The_END________' > outbuf.c
  1240. X/*
  1241. X * $Header: outbuf.c,v 1.1 87/04/29 14:17:40 brandon Exp $
  1242. X *
  1243. X * ``USC'' -- UNIFY(r) Screens using Curses
  1244. X * UNIFY(r) is a registered trademark of Unify Corporation.
  1245. X *
  1246. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  1247. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  1248. X *
  1249. X * $Log:    outbuf.c,v $
  1250. X * Revision 1.1  87/04/29  14:17:40  brandon
  1251. X * Initial revision
  1252. X * 
  1253. X */
  1254. X
  1255. X/*LINTLIBRARY*/
  1256. X
  1257. X#include "usc.h"
  1258. X
  1259. X/*
  1260. X * ENTRY POINT:  outbuf() -- Display data from a buffer to a screen field.
  1261. X *
  1262. X * DIFFERENCE FROM UNIFY:  None, since screen fields retain decimal info.
  1263. X */
  1264. X
  1265. Xvoid outbuf(sfld, buf)
  1266. Xchar *buf; {
  1267. X    int len;
  1268. X
  1269. X    if (sfld < 0 || sfld >= __nsf)
  1270. X        xerror(-1, "outbuf", "Unknown screen field %d", sfld);
  1271. X    len = __scf[sfld].q_len;
  1272. X    switch (__scf[sfld].q_type) {
  1273. X    case INT:
  1274. X    case LONG:
  1275. X    case STRNG:
  1276. X        break;
  1277. X    case AMT:
  1278. X    case HAMT:
  1279. X        len += 3;
  1280. X        break;
  1281. X    case DATE:
  1282. X        len = 8;
  1283. X        break;
  1284. X    case HR:
  1285. X        len = 5;
  1286. X        break;
  1287. X    case FLT:
  1288. X        (void) move(__scf[sfld].q_fy, __scf[sfld].q_fx);
  1289. X        pflt(__scf[sfld].q_len / 10, (double *) buf, __scf[sfld].q_len % 10);
  1290. X        return;
  1291. X    }
  1292. X    outscrf(__scf[sfld].q_fx, __scf[sfld].q_fy, __scf[sfld].q_type & ~_UCF, len, buf);
  1293. X}
  1294. ________This_Is_The_END________
  1295. if test `wc -l < outbuf.c` -ne 54; then
  1296.     echo 'shar: outbuf.c was damaged during transit (should have been 54 bytes)'
  1297. fi
  1298. fi        ; : end of overwriting check
  1299. echo 'x - output.c'
  1300. if test -f output.c; then echo 'shar: not overwriting output.c'; else
  1301. sed 's/^X//' << '________This_Is_The_END________' > output.c
  1302. X/*
  1303. X * $Header: output.c,v 1.1 87/04/29 14:23:38 brandon Exp $
  1304. X *
  1305. X * ``USC'' -- UNIFY(r) Screens using Curses
  1306. X * UNIFY(r) is a registered trademark of Unify Corporation.
  1307. X *
  1308. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  1309. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  1310. X *
  1311. X * $Log:    output.c,v $
  1312. X * Revision 1.1  87/04/29  14:23:38  brandon
  1313. X * Initial revision
  1314. X * 
  1315. X */
  1316. X
  1317. X/*LINTLIBRARY*/
  1318. X
  1319. X#include "usc.h"
  1320. X
  1321. X/*
  1322. X * ENTRY POINT:  output() -- Output data from the database to a screen field
  1323. X *
  1324. X * DIFFERENCE FROM UNIFY:  See outbuf() and pflt().
  1325. X */
  1326. X
  1327. Xvoid output(sfld) {
  1328. X    int len;
  1329. X    char buf[256];
  1330. X
  1331. X    if (sfld < 0 || sfld >= __nsf)
  1332. X        xerror(-1, "output", "Unknown screen field %d", sfld);
  1333. X    if (__scf[sfld].q_fld == 0)
  1334. X        xerror(-2, "output", "Screen field %d has no associated database field", sfld);
  1335. X    if (gfield(__scf[sfld].q_fld, buf) != 0)
  1336. X        xerror(-3, "output", "Read access for field %d denied", __scf[sfld].q_fld);
  1337. X    len = __scf[sfld].q_len;
  1338. X    switch (__scf[sfld].q_type) {
  1339. X    case INT:
  1340. X    case LONG:
  1341. X    case STRNG:
  1342. X        break;
  1343. X    case AMT:
  1344. X    case HAMT:
  1345. X        len += 3;
  1346. X        break;
  1347. X    case DATE:
  1348. X        len = 8;
  1349. X        break;
  1350. X    case HR:
  1351. X        len = 5;
  1352. X        break;
  1353. X    case FLT:
  1354. X        (void) move(__scf[sfld].q_fy, __scf[sfld].q_fx);
  1355. X        pflt(__scf[sfld].q_len / 10, (double *) buf, __scf[sfld].q_len % 10);
  1356. X        return;
  1357. X    }
  1358. X    outscrf(__scf[sfld].q_fx, __scf[sfld].q_fy, __scf[sfld].q_type & ~_UCF, len, buf);
  1359. X}
  1360. ________This_Is_The_END________
  1361. if test `wc -l < output.c` -ne 58; then
  1362.     echo 'shar: output.c was damaged during transit (should have been 58 bytes)'
  1363. fi
  1364. fi        ; : end of overwriting check
  1365. echo 'x - outscrf.c'
  1366. if test -f outscrf.c; then echo 'shar: not overwriting outscrf.c'; else
  1367. sed 's/^X//' << '________This_Is_The_END________' > outscrf.c
  1368. X/*
  1369. X * $Header: outscrf.c,v 1.4 87/05/22 18:01:22 brandon Exp $
  1370. X *
  1371. X * ``USC'' -- UNIFY(r) Screens using Curses
  1372. X * UNIFY(r) is a registered trademark of Unify Corporation.
  1373. X *
  1374. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  1375. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  1376. X *
  1377. X * $Log:    outscrf.c,v $
  1378. X * Revision 1.4  87/05/22  18:01:22  brandon
  1379. X * another dumb bug (`(vid)'?)
  1380. X * 
  1381. X * Revision 1.3  87/05/22  17:58:48  brandon
  1382. X * Forgot to move() to the right place before doing output! :-(
  1383. X * 
  1384. X * Revision 1.2  87/04/29  14:43:24  brandon
  1385. X * Added cast to (double *) for pflt() call
  1386. X * 
  1387. X * Revision 1.1  87/04/29  13:18:44  brandon
  1388. X * Initial revision
  1389. X * 
  1390. X */
  1391. X
  1392. X/*LINTLIBRARY*/
  1393. X
  1394. X#include "usc.h"
  1395. X
  1396. X/*
  1397. X * ENTRY POINT:  outscrf() -- Display a value on the screen
  1398. X *
  1399. X * DIFFERENCE FROM UNIFY:  Screen fields with type FLT are handled specially.
  1400. X * See pflt.c for the reason; quick summary is that Unify Corp. blew it.
  1401. X */
  1402. X
  1403. Xvoid outscrf(x, y, type, len, buf)
  1404. Xchar *buf; {
  1405. X    (void) setraw();
  1406. X    (void) move(y, x);
  1407. X    switch (type) {
  1408. X    case INT:
  1409. X        pshort(len, (short *) buf);
  1410. X        break;
  1411. X    case LONG:
  1412. X        plong(len, (long *) buf);
  1413. X        break;
  1414. X    case AMT:
  1415. X        pamt(len, (long *) buf);
  1416. X        break;
  1417. X    case HAMT:
  1418. X        phamt(len, (double *) buf);
  1419. X        break;
  1420. X    case STRNG:
  1421. X        pstr(len, buf);
  1422. X        break;
  1423. X    case DATE:
  1424. X        pdate((short *) buf);
  1425. X        break;
  1426. X    case HR:
  1427. X        ptime((short *) buf);
  1428. X        break;
  1429. X    case FLT:
  1430. X        pflt(len, (double *) buf, -1);    /* use %g, we don't know the #dec */
  1431. X        break;
  1432. X    default:
  1433. X        xerror(-1, "outscrf", "Unknown type %d", type);
  1434. X    }
  1435. X}
  1436. ________This_Is_The_END________
  1437. if test `wc -l < outscrf.c` -ne 68; then
  1438.     echo 'shar: outscrf.c was damaged during transit (should have been 68 bytes)'
  1439. fi
  1440. fi        ; : end of overwriting check
  1441. echo 'x - pageout.c'
  1442. if test -f pageout.c; then echo 'shar: not overwriting pageout.c'; else
  1443. sed 's/^X//' << '________This_Is_The_END________' > pageout.c
  1444. X/*
  1445. X * $Header: pageout.c,v 1.1 87/04/29 17:04:47 brandon Exp $
  1446. X *
  1447. X * ``USC'' -- UNIFY(r) Screens using Curses
  1448. X * UNIFY(r) is a registered trademark of Unify Corporation.
  1449. X *
  1450. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  1451. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  1452. X *
  1453. X * $Log:    pageout.c,v $
  1454. X * Revision 1.1  87/04/29  17:04:47  brandon
  1455. X * Initial revision
  1456. X * 
  1457. X */
  1458. X
  1459. X/*LINTLIBRARY*/
  1460. X
  1461. X#include "usc.h"
  1462. X
  1463. X/*
  1464. X * A simple pager, along the lines of that built in to SSQL and the menu
  1465. X * manager.
  1466. X */
  1467. X
  1468. Xvoid pageout(fp, title)
  1469. XFILE *fp;
  1470. Xchar *title; {
  1471. X    int ch, col, line;
  1472. X
  1473. X    (void) move(2, 0);
  1474. X    (void) attron(A_REVERSE);
  1475. X    (void) addstr(title);
  1476. X    (void) attroff(A_REVERSE);
  1477. X    (void) addch('\n');
  1478. X    line = 3;
  1479. X    col = 0;
  1480. X    while ((ch = getc(fp)) != EOF) {
  1481. X        (void) move(line, col);
  1482. X        switch (ch) {
  1483. X        case '\n':
  1484. X            (void) attroff(A_UNDERLINE);
  1485. X            (void) addch('\n');
  1486. X            if (++line == LINES - 1) {
  1487. X                (void) attron(A_REVERSE);
  1488. X                (void) addstr(" More?  Press any key to continue or Q to quit. ");
  1489. X                (void) attroff(A_REVERSE);
  1490. X                (void) refresh();
  1491. X                switch (getchar() & 0x7f) {
  1492. X                case 'q':
  1493. X                case 'Q':
  1494. X                    line = -1;
  1495. X                    break;
  1496. X                default:
  1497. X                    line = 3;
  1498. X                    break;
  1499. X                }
  1500. X                (void) addch('\r');
  1501. X                (void) clrtoeol();
  1502. X            }
  1503. X            break;
  1504. X        case '\b':
  1505. X            (void) addch('\b');
  1506. X            (void) attron(A_UNDERLINE);
  1507. X            if (col > 0)
  1508. X                col--;
  1509. X            continue;
  1510. X        case '\t':
  1511. X            do {
  1512. X                (void) addch(' ');
  1513. X                (void) attroff(A_UNDERLINE);
  1514. X                if (++col == COLS) {
  1515. X                    col = 0;
  1516. X                    ++line;
  1517. X                    break;
  1518. X                }
  1519. X            } while (col % 8 != 0);
  1520. X            if (line == LINES - 1) {
  1521. X                (void) attron(A_REVERSE);
  1522. X                (void) addstr(" More?  Press any key to continue or Q to quit. ");
  1523. X                (void) attroff(A_REVERSE);
  1524. X                (void) refresh();
  1525. X                switch (getchar() & 0x7f) {
  1526. X                case 'q':
  1527. X                case 'Q':
  1528. X                    line = -1;
  1529. X                    break;
  1530. X                default:
  1531. X                    line = 3;
  1532. X                    break;
  1533. X                }
  1534. X                (void) addch('\r');
  1535. X                (void) clrtoeol();
  1536. X            }
  1537. X            break;
  1538. X        case '\r':
  1539. X            col = 0;
  1540. X            (void) addch('\r');
  1541. X            (void) attroff(A_UNDERLINE);
  1542. X            break;
  1543. X        default:
  1544. X            if (ch < ' ' || ch > '~')
  1545. X                ch = ' ';
  1546. X            (void) addch(ch);
  1547. X            (void) attroff(A_UNDERLINE);
  1548. X            if (++col < COLS)
  1549. X                break;
  1550. X            col = 0;
  1551. X            if (++line == LINES - 1) {
  1552. X                (void) attron(A_REVERSE);
  1553. X                (void) addstr(" More?  Press any key to continue or Q to quit. ");
  1554. X                (void) attroff(A_REVERSE);
  1555. X                (void) refresh();
  1556. X                switch (getchar() & 0x7f) {
  1557. X                case 'q':
  1558. X                case 'Q':
  1559. X                    line = -1;
  1560. X                    break;
  1561. X                default:
  1562. X                    line = 3;
  1563. X                    break;
  1564. X                }
  1565. X                (void) addch('\r');
  1566. X                (void) clrtoeol();
  1567. X            }
  1568. X            break;
  1569. X        }
  1570. X        if (line == -1)
  1571. X            break;
  1572. X    }
  1573. X    if (line == -1 || (line == 3 && col == 0))
  1574. X        return;
  1575. X    prtmsg(1, 23, "Completed.  Press RETURN to continue");
  1576. X}
  1577. ________This_Is_The_END________
  1578. if test `wc -l < pageout.c` -ne 133; then
  1579.     echo 'shar: pageout.c was damaged during transit (should have been 133 bytes)'
  1580. fi
  1581. fi        ; : end of overwriting check
  1582. echo 'x - pamt.c'
  1583. if test -f pamt.c; then echo 'shar: not overwriting pamt.c'; else
  1584. sed 's/^X//' << '________This_Is_The_END________' > pamt.c
  1585. X/*
  1586. X * $Header: pamt.c,v 1.1 87/04/29 12:18:40 brandon Exp $
  1587. X *
  1588. X * ``USC'' -- UNIFY(r) Screens using Curses
  1589. X * UNIFY(r) is a registered trademark of Unify Corporation.
  1590. X *
  1591. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  1592. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  1593. X *
  1594. X * $Log:    pamt.c,v $
  1595. X * Revision 1.1  87/04/29  12:18:40  brandon
  1596. X * Initial revision
  1597. X * 
  1598. X */
  1599. X
  1600. X/*LINTLIBRARY*/
  1601. X
  1602. X#include "usc.h"
  1603. X
  1604. X/*
  1605. X * Display a value of type AMT.
  1606. X */
  1607. X
  1608. Xvoid pamt(len, buf)
  1609. Xlong *buf; {
  1610. X    (void) setraw();
  1611. X    if (len < 4)
  1612. X        return;
  1613. X    (void) attron(A_UNDERLINE);
  1614. X    (void) printw("%*ld.%02d", len - 3, *buf / 100L, *buf % 100L);
  1615. X    (void) attroff(A_UNDERLINE);
  1616. X}
  1617. ________This_Is_The_END________
  1618. if test `wc -l < pamt.c` -ne 32; then
  1619.     echo 'shar: pamt.c was damaged during transit (should have been 32 bytes)'
  1620. fi
  1621. fi        ; : end of overwriting check
  1622. echo 'x - pdata.c'
  1623. if test -f pdata.c; then echo 'shar: not overwriting pdata.c'; else
  1624. sed 's/^X//' << '________This_Is_The_END________' > pdata.c
  1625. X/*
  1626. X * $Header: pdata.c,v 1.1 87/04/29 13:51:45 brandon Exp $
  1627. X *
  1628. X * ``USC'' -- UNIFY(r) Screens using Curses
  1629. X * UNIFY(r) is a registered trademark of Unify Corporation.
  1630. X *
  1631. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  1632. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  1633. X *
  1634. X * $Log:    pdata.c,v $
  1635. X * Revision 1.1  87/04/29  13:51:45  brandon
  1636. X * Initial revision
  1637. X * 
  1638. X */
  1639. X
  1640. X/*LINTLIBRARY*/
  1641. X
  1642. X#include "usc.h"
  1643. X
  1644. X/*
  1645. X * ENTRY POINT:  pdata() -- Display data from database fields
  1646. X *
  1647. X * DIFFERENCE FROM UNIFY:  FLT is FUBAR; see pflt.c.
  1648. X */
  1649. X
  1650. Xvoid pdata(x, y, fld) {
  1651. X    char fbuf[256];
  1652. X    FLDESC fd;
  1653. X
  1654. X    if (!fldesc(fld, &fd))
  1655. X        xerror(-1, "pdata", "Unknown database field %d", fld);
  1656. X    if (fd.f_typ == COMB)
  1657. X        xerror(-2, "pdata", "COMB field %d illegal", fld);
  1658. X    if (gfield(fld, fbuf) != 0)
  1659. X        xerror(-3, "pdata", "Read access for field %d denied", fld);
  1660. X    outscrf(x, y, fd.f_typ, fd.f_len, fbuf);
  1661. X}
  1662. ________This_Is_The_END________
  1663. if test `wc -l < pdata.c` -ne 37; then
  1664.     echo 'shar: pdata.c was damaged during transit (should have been 37 bytes)'
  1665. fi
  1666. fi        ; : end of overwriting check
  1667. echo 'x - pdate.c'
  1668. if test -f pdate.c; then echo 'shar: not overwriting pdate.c'; else
  1669. sed 's/^X//' << '________This_Is_The_END________' > pdate.c
  1670. X/*
  1671. X * $Header: pdate.c,v 1.1 87/04/29 12:18:30 brandon Exp $
  1672. X *
  1673. X * ``USC'' -- UNIFY(r) Screens using Curses
  1674. X * UNIFY(r) is a registered trademark of Unify Corporation.
  1675. X *
  1676. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  1677. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  1678. X *
  1679. X * $Log:    pdate.c,v $
  1680. X * Revision 1.1  87/04/29  12:18:30  brandon
  1681. X * Initial revision
  1682. X * 
  1683. X */
  1684. X
  1685. X/*LINTLIBRARY*/
  1686. X
  1687. X#include "usc.h"
  1688. X
  1689. X/*
  1690. X * Display a value of type DATE.  Under UNIFY 3.2, this is easier...
  1691. X */
  1692. X
  1693. X#ifdef UNIFY32
  1694. X
  1695. Xvoid pdate(buf)
  1696. Xshort *buf; {
  1697. X    char dbuf[8];
  1698. X
  1699. X    (void) setraw();
  1700. X    (void) attron(A_UNDERLINE);
  1701. X    (void) dspdt(*buf, dbuf);    /* handles DATETP automatically */
  1702. X    (void) printw("%.8s", dbuf);
  1703. X    (void) attroff(A_UNDERLINE);
  1704. X}
  1705. X
  1706. X#else
  1707. X
  1708. Xvoid pdate(buf)
  1709. Xshort *buf; {
  1710. X    int date[3];
  1711. X
  1712. X    (void) setraw();
  1713. X    (void) attron(A_UNDERLINE);
  1714. X    if (*buf == NULLDATE)
  1715. X        (void) addstr("**/**/**");
  1716. X    else {
  1717. X        kdate(*buf, date);
  1718. X        (void) printw("%02d/%02d/%02d", date[MONTH], date[DAY], date[YEAR]);
  1719. X    }
  1720. X    (void) attroff(A_UNDERLINE);
  1721. X}
  1722. ________This_Is_The_END________
  1723. if test `wc -l < pdate.c` -ne 52; then
  1724.     echo 'shar: pdate.c was damaged during transit (should have been 52 bytes)'
  1725. fi
  1726. fi        ; : end of overwriting check
  1727. echo 'x - pflt.c'
  1728. if test -f pflt.c; then echo 'shar: not overwriting pflt.c'; else
  1729. sed 's/^X//' << '________This_Is_The_END________' > pflt.c
  1730. X/*
  1731. X * $Header: pflt.c,v 1.2 87/04/29 14:41:32 brandon Exp $
  1732. X *
  1733. X * ``USC'' -- UNIFY(r) Screens using Curses
  1734. X * UNIFY(r) is a registered trademark of Unify Corporation.
  1735. X *
  1736. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  1737. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  1738. X *
  1739. X * $Log:    pflt.c,v $
  1740. X * Revision 1.2  87/04/29  14:41:32  brandon
  1741. X * Forgot to declare pflt() as (void)!
  1742. X * 
  1743. X * Revision 1.1  87/04/29  12:36:23  brandon
  1744. X * Initial revision
  1745. X * 
  1746. X */
  1747. X
  1748. X/*LINTLIBRARY*/
  1749. X
  1750. X#include "usc.h"
  1751. X
  1752. X/*
  1753. X * Display a value of type FLT.  Note that there is a problem here -- screen
  1754. X * fields come with # of decimals, database fields and outscrf() specs do not.
  1755. X * This problem persists and I don't know what, really, to do about it in the
  1756. X * case of database fields.  Screen fields get their specified decimals,
  1757. X * however, and outscrf() uses %g to avoid the issue entirely.  So dbfields
  1758. X * use outscrf() and you have to accept the loss.
  1759. X *
  1760. X * This is a botch.  UNIFY Corporation, PLEASE FIX THIS!!!  I don't like the
  1761. X * loss of this data and I don't like violating license agreements to dig it
  1762. X * out of the guts of UNITRIEVE!
  1763. X */
  1764. X
  1765. Xvoid pflt(len, buf, ndec)
  1766. Xdouble *buf; {
  1767. X    (void) setraw();
  1768. X    (void) attron(A_UNDERLINE);
  1769. X    if (ndec == -1)    /* unknown decimals */
  1770. X        (void) printw("%*g", len, *buf);
  1771. X    else
  1772. X        (void) printw("%*.*f", len, ndec, *buf);
  1773. X    (void) attroff(A_UNDERLINE);
  1774. X}
  1775. ________This_Is_The_END________
  1776. if test `wc -l < pflt.c` -ne 45; then
  1777.     echo 'shar: pflt.c was damaged during transit (should have been 45 bytes)'
  1778. fi
  1779. fi        ; : end of overwriting check
  1780. echo 'x - pflush.c'
  1781. if test -f pflush.c; then echo 'shar: not overwriting pflush.c'; else
  1782. sed 's/^X//' << '________This_Is_The_END________' > pflush.c
  1783. X/*
  1784. X * $Header: pflush.c,v 1.1 87/06/01 15:32:07 brandon Exp $
  1785. X *
  1786. X * ``USC'' -- UNIFY(r) Screens using Curses
  1787. X * UNIFY(r) is a registered trademark of Unify Corporation.
  1788. X *
  1789. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  1790. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  1791. X *
  1792. X * $Log:    pflush.c,v $
  1793. X * Revision 1.1  87/06/01  15:32:07  brandon
  1794. X * Initial revision
  1795. X * 
  1796. X */
  1797. X
  1798. X/*LINTLIBRARY*/
  1799. X
  1800. X#include "usc.h"
  1801. X
  1802. X/*
  1803. X * The pflush() function does a refresh() without having to include the
  1804. X * curses header file in a user program not otherwise using curses.
  1805. X */
  1806. X
  1807. Xvoid pflush() {
  1808. X    (void) refresh();
  1809. X}
  1810. ________This_Is_The_END________
  1811. if test `wc -l < pflush.c` -ne 27; then
  1812.     echo 'shar: pflush.c was damaged during transit (should have been 27 bytes)'
  1813. fi
  1814. fi        ; : end of overwriting check
  1815. echo 'x - phamt.c'
  1816. if test -f phamt.c; then echo 'shar: not overwriting phamt.c'; else
  1817. sed 's/^X//' << '________This_Is_The_END________' > phamt.c
  1818. X/*
  1819. X * $Header: phamt.c,v 1.1 87/04/29 12:35:58 brandon Exp $
  1820. X *
  1821. X * ``USC'' -- UNIFY(r) Screens using Curses
  1822. X * UNIFY(r) is a registered trademark of Unify Corporation.
  1823. X *
  1824. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  1825. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  1826. X *
  1827. X * $Log:    phamt.c,v $
  1828. X * Revision 1.1  87/04/29  12:35:58  brandon
  1829. X * Initial revision
  1830. X * 
  1831. X */
  1832. X
  1833. X/*LINTLIBRARY*/
  1834. X
  1835. X#include "usc.h"
  1836. X
  1837. X/*
  1838. X * Print a value of type HAMT.
  1839. X */
  1840. X
  1841. Xvoid phamt(len, buf)
  1842. Xdouble *buf; {
  1843. X    (void) setraw();
  1844. X    (void) attron(A_UNDERLINE);
  1845. X    (void) printw("%*.2f", len, *buf / 100.0);
  1846. X    (void) attroff(A_UNDERLINE);
  1847. X}
  1848. ________This_Is_The_END________
  1849. if test `wc -l < phamt.c` -ne 30; then
  1850.     echo 'shar: phamt.c was damaged during transit (should have been 30 bytes)'
  1851. fi
  1852. fi        ; : end of overwriting check
  1853. echo 'x - plong.c'
  1854. if test -f plong.c; then echo 'shar: not overwriting plong.c'; else
  1855. sed 's/^X//' << '________This_Is_The_END________' > plong.c
  1856. X/*
  1857. X * $Header: plong.c,v 1.1 87/04/29 12:47:21 brandon Exp $
  1858. X *
  1859. X * ``USC'' -- UNIFY(r) Screens using Curses
  1860. X * UNIFY(r) is a registered trademark of Unify Corporation.
  1861. X *
  1862. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  1863. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  1864. X *
  1865. X * $Log:    plong.c,v $
  1866. X * Revision 1.1  87/04/29  12:47:21  brandon
  1867. X * Initial revision
  1868. X * 
  1869. X */
  1870. X
  1871. X/*LINTLIBRARY*/
  1872. X
  1873. X#include "usc.h"
  1874. X
  1875. X/*
  1876. X * Display a value of type LONG.
  1877. X */
  1878. X
  1879. Xvoid plong(len, buf)
  1880. Xlong *buf; {
  1881. X    (void) setraw();
  1882. X    (void) attron(A_UNDERLINE);
  1883. X    (void) printw("%*ld", len, *buf);
  1884. X    (void) attroff(A_UNDERLINE);
  1885. X}
  1886. ________This_Is_The_END________
  1887. if test `wc -l < plong.c` -ne 30; then
  1888.     echo 'shar: plong.c was damaged during transit (should have been 30 bytes)'
  1889. fi
  1890. fi        ; : end of overwriting check
  1891. echo 'x - priamd.c'
  1892. if test -f priamd.c; then echo 'shar: not overwriting priamd.c'; else
  1893. sed 's/^X//' << '________This_Is_The_END________' > priamd.c
  1894. X/*
  1895. X * $Header: priamd.c,v 1.4 87/04/29 16:02:38 brandon Exp $
  1896. X *
  1897. X * ``USC'' -- UNIFY(r) Screens using Curses
  1898. X * UNIFY(r) is a registered trademark of Unify Corporation.
  1899. X *
  1900. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  1901. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  1902. X *
  1903. X * $Log:    priamd.c,v $
  1904. X * Revision 1.4  87/04/29  16:02:38  brandon
  1905. X * Added a (void) cast to mvaddstr().
  1906. X * 
  1907. X * Revision 1.3  87/04/29  15:56:10  brandon
  1908. X * Added $UUACL handler
  1909. X * 
  1910. X * Revision 1.2  87/04/29  11:31:08  brandon
  1911. X * Added RCS header information
  1912. X * 
  1913. X */
  1914. X
  1915. X/*LINTLIBRARY*/
  1916. X
  1917. X#include "usc.h"
  1918. X#include <ctype.h>
  1919. X
  1920. Xextern int logacl;    /* access level, set from sysrecev */
  1921. X
  1922. X/*
  1923. X * ENTRY POINT:  priamd() -- prompt for operational mode
  1924. X *
  1925. X * DIFFERENCE FROM UNIFY:  We no longer wait for a newline.  Also, the blocky
  1926. X * bleechy "[I]NQUIRE" type stuff is now "Inquire" which looks much nicer.
  1927. X */
  1928. X
  1929. Xpriamd(line) {
  1930. X    char cmdline[80], cmd[6];
  1931. X    char ch;
  1932. X    static int uuacl = -1;
  1933. X
  1934. X    (void) mvaddstr(line, 1, "            ");
  1935. X    if (uuacl == -1) {
  1936. X        char *ep;
  1937. X
  1938. X        if (logacl < 0 || logacl > 15)
  1939. X            logacl = INQUIRE;
  1940. X        if ((ep = getenv("UUACL")) == (char *) 0)
  1941. X            uuacl = logacl;
  1942. X        else if ((uuacl = atoi(ep)) <= 0 || uuacl > 15)
  1943. X            uuacl = logacl;
  1944. X        logacl = uuacl;
  1945. X    }
  1946. X    if (logacl == 0)
  1947. X        return BACK;
  1948. X    cmdline[0] = '\0';
  1949. X    cmd[0] = '\0';
  1950. X    if (logacl & INQUIRE) {
  1951. X        (void) strcat(cmdline, "Inquire");
  1952. X        (void) strcat(cmd, "I");
  1953. X    }
  1954. X    if (logacl & ADD) {
  1955. X        if (cmdline[0] != '\0')
  1956. X            (void) strcat(cmdline, ", ");
  1957. X        (void) strcat(cmdline, "Add");
  1958. X        (void) strcat(cmd, "A");
  1959. X    }
  1960. X    if (logacl & MODIFY) {
  1961. X        if (cmdline[0] != '\0')
  1962. X            (void) strcat(cmdline, ", ");
  1963. X        (void) strcat(cmdline, "Modify");
  1964. X        (void) strcat(cmd, "M");
  1965. X    }
  1966. X    if (logacl & DELETE) {
  1967. X        if (cmdline[0] != '\0')
  1968. X            (void) strcat(cmdline, ", ");
  1969. X        (void) strcat(cmdline, "Delete");
  1970. X        (void) strcat(cmd, "D");
  1971. X    }
  1972. X    (void) strcat(cmdline, "? ");
  1973. X    (void) mvaddstr(22, 1, cmdline);
  1974. X    for (;; (void) beep()) {
  1975. X        ch = toupper(getchar() & 0x7f);
  1976. X        if (ch == '\0')
  1977. X            continue;
  1978. X        if (ch == '\t' || ch == '\025') {
  1979. X            (void) addch('\r');
  1980. X            (void) clrtoeol();
  1981. X            return BACK;
  1982. X        }
  1983. X        if (strchr(cmd, ch) != (char *) 0)
  1984. X            break;
  1985. X    }
  1986. X    (void) addch('\r');
  1987. X    (void) clrtoeol();
  1988. X    switch (ch) {
  1989. X    case 'I':
  1990. X        (void) mvaddstr(line, 1, "Inquire mode");
  1991. X        return 0;
  1992. X    case 'A':
  1993. X        (void) mvaddstr(line, 1, "Add mode");
  1994. X        return 1;
  1995. X    case 'M':
  1996. X        (void) mvaddstr(line, 1, "Modify mode");
  1997. X        return 2;
  1998. X    case 'D':
  1999. X        (void) mvaddstr(line, 1, "Delete mode");
  2000. X        return 3;
  2001. X    }
  2002. X    xerror(-1, "priamd", "Illegal internal state %c", ch);
  2003. X    /*NOTREACHED*/
  2004. X}
  2005. ________This_Is_The_END________
  2006. if test `wc -l < priamd.c` -ne 111; then
  2007.     echo 'shar: priamd.c was damaged during transit (should have been 111 bytes)'
  2008. fi
  2009. fi        ; : end of overwriting check
  2010. echo 'x - prmp.c'
  2011. if test -f prmp.c; then echo 'shar: not overwriting prmp.c'; else
  2012. sed 's/^X//' << '________This_Is_The_END________' > prmp.c
  2013. X/*
  2014. X * $Header: prmp.c,v 1.2 87/04/29 11:31:10 brandon Exp $
  2015. X *
  2016. X * ``USC'' -- UNIFY(r) Screens using Curses
  2017. X * UNIFY(r) is a registered trademark of Unify Corporation.
  2018. X *
  2019. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  2020. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  2021. X *
  2022. X * $Log:    prmp.c,v $
  2023. X * Revision 1.2  87/04/29  11:31:10  brandon
  2024. X * Added RCS header information
  2025. X * 
  2026. X */
  2027. X
  2028. X/*LINTLIBRARY*/
  2029. X
  2030. X#include "usc.h"
  2031. X
  2032. X/*
  2033. X * ENTRY POINT:  prmp() -- Display a string
  2034. X *
  2035. X * DIFFERENCE FROM UNIFY:  Rather than dim/normal, uses regular output vs.
  2036. X * data fields underlined (if supported).
  2037. X */
  2038. X
  2039. Xvoid prmp(x, y, str)
  2040. Xchar *str; {
  2041. X    (void) mvaddstr(y, x, str);
  2042. X}
  2043. ________This_Is_The_END________
  2044. if test `wc -l < prmp.c` -ne 30; then
  2045.     echo 'shar: prmp.c was damaged during transit (should have been 30 bytes)'
  2046. fi
  2047. fi        ; : end of overwriting check
  2048. echo 'x - prmpf.c'
  2049. if test -f prmpf.c; then echo 'shar: not overwriting prmpf.c'; else
  2050. sed 's/^X//' << '________This_Is_The_END________' > prmpf.c
  2051. X/*
  2052. X * $Header: prmpf.c,v 1.2 87/04/29 11:31:12 brandon Exp $
  2053. X *
  2054. X * ``USC'' -- UNIFY(r) Screens using Curses
  2055. X * UNIFY(r) is a registered trademark of Unify Corporation.
  2056. X *
  2057. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  2058. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  2059. X *
  2060. X * $Log:    prmpf.c,v $
  2061. X * Revision 1.2  87/04/29  11:31:12  brandon
  2062. X * Added RCS header information
  2063. X * 
  2064. X */
  2065. X
  2066. X/*LINTLIBRARY*/
  2067. X
  2068. X#include "usc.h"
  2069. X
  2070. X/*
  2071. X * ENTRY POINT:  prmpf() -- Display a string in the foreground
  2072. X *
  2073. X * DIFFERENCE FROM UNIFY:  Rather than dim/normal, uses regular output vs.
  2074. X * data fields underlined (if supported).  Note that cleancrt() won't undo
  2075. X * these, unfortunately.
  2076. X */
  2077. X
  2078. Xvoid prmpf(x, y, str)
  2079. Xchar *str; {
  2080. X    (void) attron(A_UNDERLINE);
  2081. X    (void) mvaddstr(y, x, str);
  2082. X    (void) attroff(A_UNDERLINE);
  2083. X}
  2084. ________This_Is_The_END________
  2085. if test `wc -l < prmpf.c` -ne 33; then
  2086.     echo 'shar: prmpf.c was damaged during transit (should have been 33 bytes)'
  2087. fi
  2088. fi        ; : end of overwriting check
  2089. echo 'x - prmprv.c'
  2090. if test -f prmprv.c; then echo 'shar: not overwriting prmprv.c'; else
  2091. sed 's/^X//' << '________This_Is_The_END________' > prmprv.c
  2092. X/*
  2093. X * $Header: prmprv.c,v 1.2 87/04/29 11:31:14 brandon Exp $
  2094. X *
  2095. X * ``USC'' -- UNIFY(r) Screens using Curses
  2096. X * UNIFY(r) is a registered trademark of Unify Corporation.
  2097. X *
  2098. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  2099. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  2100. X *
  2101. X * $Log:    prmprv.c,v $
  2102. X * Revision 1.2  87/04/29  11:31:14  brandon
  2103. X * Added RCS header information
  2104. X * 
  2105. X */
  2106. X
  2107. X/*LINTLIBRARY*/
  2108. X
  2109. X#include "usc.h"
  2110. X
  2111. X/*
  2112. X * ENTRY POINT:  prmprv() -- Display a string in reverse video
  2113. X *
  2114. X * DIFFERENCE FROM UNIFY:  None (!)
  2115. X */
  2116. X
  2117. Xvoid prmprv(x, y, str)
  2118. Xchar *str; {
  2119. X    (void) attron(A_REVERSE);
  2120. X    (void) mvaddstr(y, x, str);
  2121. X    (void) attroff(A_REVERSE);
  2122. X}
  2123. ________This_Is_The_END________
  2124. if test `wc -l < prmprv.c` -ne 31; then
  2125.     echo 'shar: prmprv.c was damaged during transit (should have been 31 bytes)'
  2126. fi
  2127. fi        ; : end of overwriting check
  2128. echo 'x - prtmsg.c'
  2129. if test -f prtmsg.c; then echo 'shar: not overwriting prtmsg.c'; else
  2130. sed 's/^X//' << '________This_Is_The_END________' > prtmsg.c
  2131. X/*
  2132. X * $Header: prtmsg.c,v 1.2 87/04/29 11:31:16 brandon Exp $
  2133. X *
  2134. X * ``USC'' -- UNIFY(r) Screens using Curses
  2135. X * UNIFY(r) is a registered trademark of Unify Corporation.
  2136. X *
  2137. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  2138. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  2139. X *
  2140. X * $Log:    prtmsg.c,v $
  2141. X * Revision 1.2  87/04/29  11:31:16  brandon
  2142. X * Added RCS header information
  2143. X * 
  2144. X */
  2145. X
  2146. X/*LINTLIBRARY*/
  2147. X
  2148. X#include "usc.h"
  2149. X
  2150. X/*
  2151. X * ENTRY POINT:  prtmsg() -- Spit out a message in reverse video and wait for
  2152. X * a keypress.
  2153. X *
  2154. X * DIFFERENCE FROM UNIFY:  Typeahead is discarded.  This prevents the problems
  2155. X * we have with people typing faster than they are thinking.  :-)
  2156. X */
  2157. X
  2158. Xvoid prtmsg(x, y, str)
  2159. Xchar *str; {
  2160. X    setraw();
  2161. X    (void) flushinp();
  2162. X    (void) attrset(A_REVERSE);
  2163. X    (void) mvprintw(y, x, " %s -> -> ", str);
  2164. X    (void) attrset(0);
  2165. X    (void) refresh();
  2166. X    (void) getchar();
  2167. X    (void) move(y, x);
  2168. X    (void) clrtoeol();
  2169. X    (void) refresh();    /* so it disappears immediately */
  2170. X}
  2171. ________This_Is_The_END________
  2172. if test `wc -l < prtmsg.c` -ne 40; then
  2173.     echo 'shar: prtmsg.c was damaged during transit (should have been 40 bytes)'
  2174. fi
  2175. fi        ; : end of overwriting check
  2176. echo 'x - pshort.c'
  2177. if test -f pshort.c; then echo 'shar: not overwriting pshort.c'; else
  2178. sed 's/^X//' << '________This_Is_The_END________' > pshort.c
  2179. X/*
  2180. X * $Header: pshort.c,v 1.1 87/04/29 12:47:33 brandon Exp $
  2181. X *
  2182. X * ``USC'' -- UNIFY(r) Screens using Curses
  2183. X * UNIFY(r) is a registered trademark of Unify Corporation.
  2184. X *
  2185. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  2186. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  2187. X *
  2188. X * $Log:    pshort.c,v $
  2189. X * Revision 1.1  87/04/29  12:47:33  brandon
  2190. X * Initial revision
  2191. X * 
  2192. X */
  2193. X
  2194. X/*LINTLIBRARY*/
  2195. X
  2196. X#include "usc.h"
  2197. X
  2198. X/*
  2199. X * Display a value of type INT.
  2200. X */
  2201. X
  2202. Xvoid pshort(len, buf)
  2203. Xshort *buf; {
  2204. X    (void) setraw();
  2205. X    (void) attron(A_UNDERLINE);
  2206. X    (void) printw("%*d", len, *buf);
  2207. X    (void) attroff(A_UNDERLINE);
  2208. X}
  2209. ________This_Is_The_END________
  2210. if test `wc -l < pshort.c` -ne 30; then
  2211.     echo 'shar: pshort.c was damaged during transit (should have been 30 bytes)'
  2212. fi
  2213. fi        ; : end of overwriting check
  2214. echo 'x - pstr.c'
  2215. if test -f pstr.c; then echo 'shar: not overwriting pstr.c'; else
  2216. sed 's/^X//' << '________This_Is_The_END________' > pstr.c
  2217. X/*
  2218. X * $Header: pstr.c,v 1.3 87/06/03 14:05:11 brandon Exp $
  2219. X *
  2220. X * ``USC'' -- UNIFY(r) Screens using Curses
  2221. X * UNIFY(r) is a registered trademark of Unify Corporation.
  2222. X *
  2223. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  2224. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  2225. X *
  2226. X * $Log:    pstr.c,v $
  2227. X * Revision 1.3  87/06/03  14:05:11  brandon
  2228. X * TRY qmove(), DUMMY!  :-)
  2229. X * 
  2230. X * Revision 1.2  87/06/03  13:51:32  brandon
  2231. X * Added workaround for UNITRIEVE nulls misfeature.
  2232. X * 
  2233. X * Revision 1.1  87/04/29  12:47:40  brandon
  2234. X * Initial revision
  2235. X * 
  2236. X */
  2237. X
  2238. X/*LINTLIBRARY*/
  2239. X
  2240. X#include "usc.h"
  2241. X
  2242. X/*
  2243. X * Display a value of type STRNG.  This would be simple if not for the penchant
  2244. X * of UNITRIEVE to initialize STRNG fields to nulls....
  2245. X */
  2246. X
  2247. Xvoid pstr(len, buf)
  2248. Xchar *buf; {
  2249. X    char nulls[256];
  2250. X
  2251. X    cfill(0, nulls, len);
  2252. X    if (ivcmp(buf, nulls, len))
  2253. X        cfill(' ', nulls, len);
  2254. X    else
  2255. X        qmove(buf, nulls, len);
  2256. X    (void) setraw();
  2257. X    (void) attron(A_UNDERLINE);
  2258. X    (void) printw("%.*s", len, nulls);
  2259. X    (void) attroff(A_UNDERLINE);
  2260. X}
  2261. ________This_Is_The_END________
  2262. if test `wc -l < pstr.c` -ne 44; then
  2263.     echo 'shar: pstr.c was damaged during transit (should have been 44 bytes)'
  2264. fi
  2265. fi        ; : end of overwriting check
  2266. echo 'x - ptct_crt.c'
  2267. if test -f ptct_crt.c; then echo 'shar: not overwriting ptct_crt.c'; else
  2268. sed 's/^X//' << '________This_Is_The_END________' > ptct_crt.c
  2269. X/*
  2270. X * $Header: ptct_crt.c,v 1.2 87/04/29 11:31:17 brandon Exp $
  2271. X *
  2272. X * ``USC'' -- UNIFY(r) Screens using Curses
  2273. X * UNIFY(r) is a registered trademark of Unify Corporation.
  2274. X *
  2275. X * THIS PROGRAM IS NOT BASED ON COPYRIGHTED CODE OF UNIFY CORPORATION, AND
  2276. X * IS HEREBY PLACED IN THE PUBLIC DOMAIN.
  2277. X *
  2278. X * $Log:    ptct_crt.c,v $
  2279. X * Revision 1.2  87/04/29  11:31:17  brandon
  2280. X * Added RCS header information
  2281. X * 
  2282. X */
  2283. X
  2284. X/*LINTLIBRARY*/
  2285. X
  2286. X#include "usc.h"
  2287. X
  2288. X/*
  2289. X * ENTRY POINT:  ptct_crt() -- turn on terminal write protection
  2290. X *
  2291. X * DIFFERENCE FROM UNIFY:  All we do is check fd == 1, since curses handles the
  2292. X * screen itself.
  2293. X */
  2294. X
  2295. Xvoid ptct_crt(fd, flg) {
  2296. X    if (fd != 1)
  2297. X        xerror(-1, "ptct_crt", "Multi-terminal operation on fd %d not supported", fd);
  2298. X}
  2299. ________This_Is_The_END________
  2300. if test `wc -l < ptct_crt.c` -ne 30; then
  2301.     echo 'shar: ptct_crt.c was damaged during transit (should have been 30 bytes)'
  2302. fi
  2303. fi        ; : end of overwriting check
  2304. exit 0
  2305.