home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume33 / problem / part01 < prev    next >
Encoding:
Text File  |  1992-10-18  |  51.6 KB  |  1,393 lines

  1. Newsgroups: comp.sources.misc
  2. From: lijewski@rosserv.gsfc.nasa.gov (Mike Lijewski)
  3. Subject:  v33i003:  problem - A Problem Database Manager, Part01/07
  4. Message-ID: <1992Oct19.165747.3979@sparky.imd.sterling.com>
  5. X-Md4-Signature: 22ab85f11b0f0c324497ec0d067a7a3e
  6. Date: Mon, 19 Oct 1992 16:57:47 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: lijewski@rosserv.gsfc.nasa.gov (Mike Lijewski)
  10. Posting-number: Volume 33, Issue 3
  11. Archive-name: problem/part01
  12. Environment: UNIX, GDBM, C++, termcap
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then unpack
  16. # it by saving it into a file and typing "sh file".  To overwrite existing
  17. # files, type "sh file -c".  You can also feed this as standard input via
  18. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  19. # will see the following message at the end:
  20. #        "End of archive 1 (of 7)."
  21. # Contents:  classes.h display.h help.h lister.h keys.h problem.h
  22. #   regexp.h version.h utilities.h AREAS.template ChangeLog INSTALL
  23. #   MANIFEST
  24. # Wrapped by lijewski@xtesoc2 on Mon Oct 19 11:04:56 1992
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f 'classes.h' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'classes.h'\"
  28. else
  29. echo shar: Extracting \"'classes.h'\" \(8836 characters\)
  30. sed "s/^X//" >'classes.h' <<'END_OF_FILE'
  31. X/*
  32. X** classes.h - the declarations of the classes used in problem
  33. X**
  34. X** classes.h classes.h 1.7   Delta'd: 15:50:54 9/22/92   Mike Lijewski, CNSF
  35. X**
  36. X** Copyright (c) 1991, 1992 Cornell University
  37. X** All rights reserved.
  38. X**
  39. X** Redistribution and use in source and binary forms are permitted
  40. X** provided that: (1) source distributions retain this entire copyright
  41. X** notice and comment, and (2) distributions including binaries display
  42. X** the following acknowledgement:  ``This product includes software
  43. X** developed by Cornell University'' in the documentation or other
  44. X** materials provided with the distribution and in all advertising
  45. X** materials mentioning features or use of this software. Neither the
  46. X** name of the University nor the names of its contributors may be used
  47. X** to endorse or promote products derived from this software without
  48. X** specific prior written permission.
  49. X**
  50. X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  51. X** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  52. X** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  53. X*/
  54. X
  55. X#ifndef __CLASSES_H
  56. X#define __CLASSES_H
  57. X
  58. X#include <stddef.h>
  59. X#include <string.h>
  60. X
  61. X#include "problem.h"
  62. X
  63. X/////////////////////////////////////////////////////////////////////////////
  64. X// A Simple reference counted string class.  It is implemented as an
  65. X// Envelope-Letter abstaction with String being the envelope and StringRep
  66. X// being the letter.
  67. X/////////////////////////////////////////////////////////////////////////////
  68. X
  69. Xclass String;
  70. Xclass SBHelper;
  71. X
  72. Xclass StringRep {
  73. X  public:
  74. X    friend class String;
  75. X    friend class SBHelper;
  76. X
  77. X    StringRep();
  78. X    StringRep(const char *s);
  79. X    StringRep(char** r, size_t slen) { rep = *r; len = slen; count = 1; }
  80. X    ~StringRep()                     { DELETE rep;                      }
  81. X
  82. X    enum { chunksize = 50 };     // # of StringReps to allocate at a time
  83. X    static StringRep *freeList;  // we manage our own storage
  84. X    void *operator new(size_t size);
  85. X    void operator delete(void *object);
  86. X
  87. X    int operator!=(const char *rhs) const;
  88. X    int operator==(const char *rhs) const;
  89. X    int operator!=(const StringRep& rhs) const;
  90. X    int operator==(const StringRep& rhs) const;
  91. X
  92. X    String operator+(const String& s) const;
  93. X
  94. X    size_t length() const { return len; }
  95. X  private:
  96. X    //
  97. X    // Disable these two methods
  98. X    //
  99. X    StringRep(const StringRep&);
  100. X    StringRep& operator=(const StringRep &);
  101. X    union {
  102. X        char *rep;
  103. X        StringRep *next;
  104. X    };
  105. X    size_t len;
  106. X    int count;
  107. X};
  108. X
  109. Xclass String {
  110. X  public:
  111. X    friend class StringRep;
  112. X    friend class SBHelper;
  113. X
  114. X    String()                       { p = new StringRep();           }
  115. X    String(const String& s)        { p = s.p; p->count++;           }
  116. X    String(const char *s)          { p = new StringRep(s);          }
  117. X    String(char **s)               { p = new StringRep(s, ::strlen(*s)); }
  118. X    String(char** s, size_t slen)  { p = new StringRep(s, slen);    }
  119. X    ~String();
  120. X
  121. X    String& operator=(const String& rhs);
  122. X
  123. X    int operator==(const char *rhs)   const;
  124. X    int operator==(const String& rhs) const;
  125. X    int operator!=(const char *rhs)   const;
  126. X    int operator!=(const String& rhs) const;
  127. X
  128. X    String operator+(const String &rhs) const   { return *p + rhs;      }
  129. X    friend String operator+(const char *lhs, const String& rhs)
  130. X                                            { return rhs + String(lhs); }
  131. X
  132. X    void operator+=(const String &rhs);
  133. X    void operator+=(const char *rhs);
  134. X
  135. X    operator const char *() const { return p->rep; }
  136. X    SBHelper operator[](int index);
  137. X    size_t length() const { return p->len; }
  138. X    void range_error(int index);
  139. X  private:
  140. X    StringRep *p;
  141. X};
  142. X
  143. X/////////////////////////////////////////////////////////////////////////////
  144. X// This class is a helper class used by String::operator[] to distinguish
  145. X// between applications of operator[] on the lhs and rhs of "=" signs.
  146. X/////////////////////////////////////////////////////////////////////////////
  147. X
  148. Xclass SBHelper {
  149. X  public:
  150. X    SBHelper(String &s, int i);
  151. X    char operator=(char c);
  152. X    operator char() { return str.p->rep[index]; }
  153. X  private:
  154. X    SBHelper(const SBHelper&);        // disallow this method
  155. X    void operator=(const SBHelper&);  // disallow this method
  156. X    String &str;
  157. X    int index;
  158. X};
  159. X
  160. X///////////////////////////////////////////////////////////////////////////////
  161. X// DLink - Class modeling a link in a doubly-linked list of strings.
  162. X//         We also maintain the length of the string.
  163. X///////////////////////////////////////////////////////////////////////////////
  164. X
  165. Xclass DLink {
  166. X    friend class DList;
  167. X  public:
  168. X    DLink(char **);
  169. X    ~DLink() { }
  170. X
  171. X    static DLink *freeList;    // we manage our own storage for DLinks
  172. X    enum { chunksize = 50 };   // size blocks of DLinks we allocate
  173. X    void *operator new(size_t size);
  174. X    void operator delete(void *object);
  175. X
  176. X    const char *line()  const { return _line;          }
  177. X    int length()        const { return _line.length(); }
  178. X    DLink *next()       const { return _next;          }
  179. X    DLink *prev()       const { return _prev;          }
  180. X    void update(char **);
  181. X  private:
  182. X    String            _line;
  183. X    DLink            *_next;
  184. X    DLink            *_prev;
  185. X    //
  186. X    // Disallow these operations by not providing definitions.
  187. X    // Also keep compiler from generating default versions of these.
  188. X    //
  189. X    DLink();
  190. X    DLink(const DLink &);
  191. X    DLink &operator=(const DLink &); 
  192. X};
  193. X
  194. X///////////////////////////////////////////////////////////////////////////////
  195. X// DList - Class modeling a doubly-linked list of DLinks.
  196. X//         It also maintains our current notion of what
  197. X//         is and isn't visible in the window.
  198. X///////////////////////////////////////////////////////////////////////////////
  199. X
  200. Xclass DList {
  201. X  public:
  202. X    DList();
  203. X    ~DList();
  204. X
  205. X    DLink *head()              const { return _head;                   }
  206. X    DLink *tail()              const { return _tail;                   }
  207. X    DLink *firstLine()         const { return _firstLine;              }
  208. X    DLink *lastLine()          const { return _lastLine;               }
  209. X    DLink *currLine()          const { return _currLine;               }
  210. X    DList *next()              const { return _next;                   }
  211. X    DList *prev()              const { return _prev;                   }
  212. X
  213. X    int savedXPos()            const { return _saved_x;                }
  214. X    int savedYPos()            const { return _saved_y;                }
  215. X
  216. X    void setFirst(DLink *e)          { _firstLine = e;                 }
  217. X    void setLast (DLink *e)          { _lastLine  = e;                 }
  218. X    void setCurrLine (DLink *ln)     { _currLine = ln;                 }
  219. X
  220. X    void setNext (DList *l)          { _next = l;                      }
  221. X    void setPrev (DList *l)          { _prev = l;                      }
  222. X
  223. X    int nelems()                 const { return _nelems;               }
  224. X    void saveYXPos(int y, int x)       { _saved_x = (short)x;
  225. X                                         _saved_y = (short)y;          }
  226. X
  227. X    int atBegOfList()            const { return _currLine == _head;    }
  228. X    int atEndOfList()            const { return _currLine == _tail;    }
  229. X
  230. X    int atWindowTop()            const { return _currLine == _firstLine; }
  231. X    int atWindowBot()            const { return _currLine == _lastLine;  }
  232. X
  233. X    void add(DLink *);
  234. X    void deleteLine();
  235. X  private:
  236. X    DLink      *_head;
  237. X    DLink      *_tail;
  238. X    int         _nelems;
  239. X    short       _saved_x;     // saved x cursor position
  240. X    short       _saved_y;     // saved y cursor position
  241. X    DLink      *_firstLine;   // first viewable DLink in window
  242. X    DLink      *_lastLine;    // last  viewable DLink in window
  243. X    DLink      *_currLine;    // line cursor is on in window
  244. X    DList      *_next;
  245. X    DList      *_prev;
  246. X    //
  247. X    // Disallow these operations by not providing definitions.
  248. X    // Also keep compiler from generating default versions of these.
  249. X    //
  250. X    DList(const DList &);
  251. X    DList &operator=(const DList &);
  252. X};
  253. X
  254. Xinline int StringRep::operator!=(const char *rhs) const {
  255. X    return strcmp(rep, rhs);
  256. X}
  257. X
  258. Xinline int StringRep::operator==(const char *rhs) const {
  259. X    return strcmp(rep, rhs) == 0;
  260. X}
  261. X
  262. Xinline int StringRep::operator!=(const StringRep& rhs) const {
  263. X    return strcmp(rep, rhs.rep);
  264. X}
  265. X
  266. Xinline int StringRep::operator==(const StringRep& rhs) const {
  267. X    return strcmp(rep, rhs.rep) == 0;
  268. X}
  269. X
  270. Xinline int String::operator==(const char *rhs) const {
  271. X    return *p == rhs;
  272. X}
  273. X
  274. Xinline int String::operator==(const String& rhs) const {
  275. X    return *p == *(rhs.p);
  276. X}
  277. X
  278. Xinline int String::operator!=(const char *rhs) const {
  279. X    return *p != rhs;
  280. X}
  281. X
  282. Xinline int String::operator!=(const String& rhs) const {
  283. X    return *p != *(rhs.p);
  284. X}
  285. X
  286. X#endif /* __CLASSES_H */
  287. END_OF_FILE
  288. if test 8836 -ne `wc -c <'classes.h'`; then
  289.     echo shar: \"'classes.h'\" unpacked with wrong size!
  290. fi
  291. # end of 'classes.h'
  292. fi
  293. if test -f 'display.h' -a "${1}" != "-c" ; then 
  294.   echo shar: Will not clobber existing file \"'display.h'\"
  295. else
  296. echo shar: Extracting \"'display.h'\" \(7724 characters\)
  297. sed "s/^X//" >'display.h' <<'END_OF_FILE'
  298. X/*
  299. X** external definitions needed for interfacing with display.C
  300. X**
  301. X** display.h display.h 1.8   Delta'd: 15:50:52 9/22/92   Mike Lijewski, CNSF
  302. X**
  303. X** Copyright (c) 1991, 1992 Cornell University
  304. X** All rights reserved.
  305. X**
  306. X** Redistribution and use in source and binary forms are permitted
  307. X** provided that: (1) source distributions retain this entire copyright
  308. X** notice and comment, and (2) distributions including binaries display
  309. X** the following acknowledgement:  ``This product includes software
  310. X** developed by Cornell University'' in the documentation or other
  311. X** materials provided with the distribution and in all advertising
  312. X** materials mentioning features or use of this software. Neither the
  313. X** name of the University nor the names of its contributors may be used
  314. X** to endorse or promote products derived from this software without
  315. X** specific prior written permission.
  316. X**
  317. X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  318. X** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  319. X** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  320. X*/
  321. X
  322. X#ifndef __DISPLAY_H
  323. X#define __DISPLAY_H
  324. X
  325. X//
  326. X// termcap capabilities we'll try to use
  327. X//
  328. Xextern char *AL;               // insert blank line before cursor
  329. Xextern char *ALN;              // insert N blank lines before cursor
  330. Xextern int   AM;               // automatic margins?
  331. Xextern char *BC;               // backspace, if not BS
  332. Xextern int   BS;               // ASCII backspace works
  333. Xextern char *CD;               // clear to end of display
  334. Xextern char *CE;               // clear to end of line
  335. Xextern char *CL;               // clear screen
  336. Xextern int   CO;               // number of columns
  337. Xextern char *CM;               // cursor motion
  338. Xextern char *CR;               // cursor beginning of line
  339. Xextern char *CS;               // set scroll region
  340. Xextern int   DA;               // backing store off top?
  341. Xextern int   DB;               // backing store off bottom?
  342. Xextern char *DC;               // delete character at cursor
  343. Xextern char *DL;               // delete line cursor is on
  344. Xextern char *DLN;              // delete N lines at cursor
  345. Xextern char *DM;               // string to enter delete mode
  346. Xextern char *DO;               // cursor down
  347. Xextern char *ED;               // string to end delete mode
  348. Xextern int   HC;               // hardcopy terminal?
  349. Xextern char *HO;               // cursor home
  350. Xextern char *IS;               // initialize terminal
  351. Xextern char *KD;               // down arrow key
  352. Xextern char *KE;               // de-initialize keypad
  353. Xextern char *KS;               // initialize keypad (for arrow keys)
  354. Xextern char *KU;               // up arrrow key
  355. Xextern char *LE;               // cursor back one column
  356. Xextern int   LI;               // number of rows
  357. Xextern char *LL;               // cursor to lower left
  358. Xextern int   OS;               // terminal overstrikes?
  359. Xextern char  PC;               // pad character
  360. Xextern char *PCstr;            // pad string
  361. Xextern char *SE;               // end standout mode
  362. Xextern char *SF;               // scroll screen up one line
  363. Xextern char *SO;               // enter standout mode
  364. Xextern char *SR;               // scroll screen down one line
  365. Xextern char *TE;               // end cursor addressing mode
  366. Xextern char *TI;               // enter cursor addressing mode
  367. Xextern char *UP;               // cursor up
  368. Xextern char *VE;               // end visual mode
  369. Xextern char *VS;               // enter visual mode
  370. Xextern char *XN;               // strange wrap behaviour
  371. X
  372. X// have we just been resumed after being suspended?
  373. Xextern int resumingAfterSuspension;
  374. X
  375. X//
  376. X// termcap routines
  377. X//
  378. Xextern "C" {
  379. X    extern short ospeed;        // terminal speed - needed by tputs()
  380. X#if !defined(__GNUG__) || __GNUG__ == 2
  381. X    int    tgetent(const char *buf, const char *name);
  382. X    int    tgetflag(const char *);
  383. X    int    tgetnum(const char *);
  384. X    char  *tgetstr(const char *, char **);
  385. X    char  *tgoto(const char *, int, int);
  386. X    int    tputs(const char *, int, int (*)(int));
  387. X#endif
  388. X}
  389. X
  390. X//
  391. X// functions defined in display.C
  392. X//
  393. Xextern void    clear_display();
  394. Xextern void    clear_to_end_of_screen(int);
  395. Xextern void    delete_listing_line(int);
  396. Xextern void    init_display();
  397. Xextern int     outputch(int);
  398. Xextern void    scroll_listing_up_one();
  399. Xextern void    scroll_listing_down_one();
  400. Xextern void    scroll_listing_up_N(int);
  401. Xextern void    scroll_listing_down_N(int);
  402. Xextern void    scroll_screen_up_one();
  403. Xextern void    scroll_screen_down_one();
  404. Xextern void    scroll_screen_up_N(int);
  405. Xextern void    scroll_screen_down_N(int);
  406. Xextern void    setraw();
  407. Xextern void    termcap(const char *);
  408. Xextern void    term_display();
  409. Xextern void    termstop(int);
  410. Xextern void    unsetraw();
  411. Xextern void    update_screen_line(const char *, const char *, int);
  412. X
  413. X/*
  414. X** output_string_capability - output a string capability from termcap
  415. X**                             to the terminal. The second argument,
  416. X**                             which defaults to 1, is the number
  417. X**                             of rows affected.
  418. X*/
  419. X
  420. Xinline void output_string_capability(const char *capability, int affected = 1)
  421. X{
  422. X    if (capability) tputs(capability, affected, outputch);
  423. X}
  424. X
  425. Xinline int rows() { return LI; }
  426. X
  427. Xinline int columns() { return CO; }
  428. X
  429. Xinline void initialize_terminal() { output_string_capability(IS); }
  430. X
  431. Xinline void synch_display() { (void)fflush(stdout); }
  432. X
  433. Xinline void enter_cursor_addressing_mode() { output_string_capability(TI); }
  434. X
  435. Xinline void enable_keypad() { output_string_capability(KS); }
  436. X
  437. Xinline void disable_keypad() { output_string_capability(KE); }
  438. X
  439. Xinline void enter_visual_mode() { output_string_capability(VS); }
  440. X
  441. Xinline void end_visual_mode() { output_string_capability(VE); }
  442. X
  443. Xinline void end_cursor_addressing_mode() { output_string_capability(TE); }
  444. X
  445. Xinline void enter_standout_mode() { output_string_capability(SO); }
  446. X
  447. Xinline void end_standout_mode() { output_string_capability(SE); }
  448. X
  449. Xinline void enter_delete_mode() { output_string_capability(DM); }
  450. X
  451. Xinline void end_delete_mode() { output_string_capability(ED); }
  452. X
  453. Xinline void move_cursor(int row, int column)
  454. X{
  455. X    if (column >= columns()) column = columns()-1;
  456. X    output_string_capability(tgoto(CM, column, row));
  457. X}
  458. X
  459. Xinline void cursor_home()
  460. X{
  461. X    HO ? output_string_capability(HO) : move_cursor(0, 0);
  462. X}
  463. X
  464. Xinline void clear_to_end_of_line() { output_string_capability(CE); }
  465. X
  466. Xinline void move_to_modeline() { move_cursor(rows() - 2, 0); }
  467. X
  468. Xinline void move_to_message_line()
  469. X{
  470. X    if (LL)
  471. X        output_string_capability(LL);
  472. X    else
  473. X        move_cursor(rows()-1, 0); }
  474. X
  475. Xinline void clear_modeline() { move_to_modeline(); clear_to_end_of_line(); }
  476. X
  477. Xinline void clear_message_line()
  478. X{
  479. X    move_to_message_line(); clear_to_end_of_line();
  480. X}
  481. X
  482. Xinline void delete_screen_line(int y)
  483. X{
  484. X    move_cursor(y, 0);
  485. X    output_string_capability(DL, rows()-y);
  486. X}
  487. X
  488. Xinline void backspace() {
  489. X    if (BS)
  490. X        putchar('\b');
  491. X    else if (LE)
  492. X        output_string_capability(LE);
  493. X    else
  494. X        output_string_capability(BC);
  495. X}
  496. X
  497. Xinline void cursor_up() { output_string_capability(UP); }
  498. X
  499. Xinline void delete_char_at_cursor()
  500. X{
  501. X    if (DM) output_string_capability(DM);
  502. X    output_string_capability(DC);
  503. X    if (ED) output_string_capability(ED);
  504. X}
  505. X
  506. Xinline void cursor_down() { output_string_capability(DO); }
  507. X
  508. Xinline void cursor_beginning_of_line() { output_string_capability(CR); } 
  509. X
  510. Xinline void cursor_wrap() { cursor_beginning_of_line(); cursor_down(); }
  511. X
  512. Xinline void ding() {
  513. X    //
  514. X    // This should be `output('\a')', but some braindead C compilers when
  515. X    // used as the backend to Cfront, don't recognize '\a' as the BELL.
  516. X    //
  517. X    outputch(7);
  518. X    synch_display();
  519. X} 
  520. X
  521. X#endif
  522. END_OF_FILE
  523. if test 7724 -ne `wc -c <'display.h'`; then
  524.     echo shar: \"'display.h'\" unpacked with wrong size!
  525. fi
  526. # end of 'display.h'
  527. fi
  528. if test -f 'help.h' -a "${1}" != "-c" ; then 
  529.   echo shar: Will not clobber existing file \"'help.h'\"
  530. else
  531. echo shar: Extracting \"'help.h'\" \(2843 characters\)
  532. sed "s/^X//" >'help.h' <<'END_OF_FILE'
  533. X/*
  534. X** help.C - strings displayed for help while in the lister
  535. X**
  536. X** help.h 1.7   Delta'd: 17:26:30 10/7/92   Mike Lijewski, CNSF
  537. X**
  538. X** Copyright (c) 1991 Cornell University
  539. X** All rights reserved.
  540. X**
  541. X** Redistribution and use in source and binary forms are permitted
  542. X** provided that: (1) source distributions retain this entire copyright
  543. X** notice and comment, and (2) distributions including binaries display
  544. X** the following acknowledgement:  ``This product includes software
  545. X** developed by Cornell University'' in the documentation or other
  546. X** materials provided with the distribution and in all advertising
  547. X** materials mentioning features or use of this software. Neither the
  548. X** name of the University nor the names of its contributors may be used
  549. X** to endorse or promote products derived from this software without
  550. X** specific prior written permission.
  551. X**
  552. X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  553. X** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  554. X** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  555. X*/
  556. X
  557. Xconst char *const help_file[] = {
  558. X    " CURSOR MOVEMENT COMMANDS:",
  559. X    "",
  560. X    "    ?  H               Display this help.",
  561. X    "    q                  quit.",
  562. X    "    j  n  ^N  SPC  CR  Forward  one line.",
  563. X    "    DOWN_ARROW_KEY             \"        .",
  564. X    "    k  p  ^P  ^Y       Backward one line.",
  565. X    "    UP_ARROW_KEY               \"        .",
  566. X    "    ^F  ^V             Forward  one window.",
  567. X    "    b  ^B  ESC-V       Backward one window.",
  568. X    "    ^D                 Forward  one half-window.",
  569. X    "    ^U                 Backward one half-window.",
  570. X    "    <                  Go to first line of listing.",
  571. X    "    >                  Go to last line of listing.",
  572. X    "",
  573. X    " COMMANDS WHICH OPERATE ON THE CURRENT PROBLEM:",
  574. X    "",
  575. X    "    a                  Append to current problem.",
  576. X    "    c                  Close current problem.",
  577. X    "    d                  Delete current problem.",
  578. X    "    e m v              Examine, View or \"more\" current problem.",
  579. X    "    r                  Reorganize the database.",
  580. X    "    M                  Modify keyword field.",
  581. X    "    R                  Reopen a closed problem.",
  582. X    "    S                  Save problem listing to a file - prompts for filename.",
  583. X    "",
  584. X    " MISCELLANEOUS COMMANDS:",
  585. X    "",
  586. X    "    !                  starts up a shell.",
  587. X    "    ! cmd              executes a shell command - prompts for command.",
  588. X    "    !!                 reexecutes previous shell command.",
  589. X    "    ^L                 Repaint screen.",
  590. X    "    CR                 Signifies end-of-response when in a prompt.",
  591. X    "    V                  Print out version string."
  592. X};
  593. X
  594. X// number of entries in help_file
  595. Xconst int HELP_FILE_DIM = int(sizeof(help_file) / sizeof(help_file[0]));
  596. END_OF_FILE
  597. if test 2843 -ne `wc -c <'help.h'`; then
  598.     echo shar: \"'help.h'\" unpacked with wrong size!
  599. fi
  600. # end of 'help.h'
  601. fi
  602. if test -f 'lister.h' -a "${1}" != "-c" ; then 
  603.   echo shar: Will not clobber existing file \"'lister.h'\"
  604. else
  605. echo shar: Extracting \"'lister.h'\" \(1312 characters\)
  606. sed "s/^X//" >'lister.h' <<'END_OF_FILE'
  607. X/*
  608. X** lister.h - the public interface to lister.C
  609. X**
  610. X** lister.h 1.3   Delta'd: 15:51:02 9/22/92   Mike Lijewski, CNSF
  611. X**
  612. X** Copyright (c) 1991, 1992 Cornell University
  613. X** All rights reserved.
  614. X**
  615. X** Redistribution and use in source and binary forms are permitted
  616. X** provided that: (1) source distributions retain this entire copyright
  617. X** notice and comment, and (2) distributions including binaries display
  618. X** the following acknowledgement:  ``This product includes software
  619. X** developed by Cornell University'' in the documentation or other
  620. X** materials provided with the distribution and in all advertising
  621. X** materials mentioning features or use of this software. Neither the
  622. X** name of the University nor the names of its contributors may be used
  623. X** to endorse or promote products derived from this software without
  624. X** specific prior written permission.
  625. X**
  626. X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  627. X** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  628. X** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  629. X*/
  630. X
  631. X#ifndef __LISTER_H
  632. X#define __LISTER_H
  633. X
  634. X// interface to the lister
  635. Xextern void initialize_lister(DList *dl);
  636. Xextern void lister_cmd_loop(DList *dl);
  637. X
  638. X// goal_column - mostly a no-op now
  639. Xinline int goal_column(const DList*) { return 0; }
  640. X
  641. X#endif
  642. END_OF_FILE
  643. if test 1312 -ne `wc -c <'lister.h'`; then
  644.     echo shar: \"'lister.h'\" unpacked with wrong size!
  645. fi
  646. # end of 'lister.h'
  647. fi
  648. if test -f 'keys.h' -a "${1}" != "-c" ; then 
  649.   echo shar: Will not clobber existing file \"'keys.h'\"
  650. else
  651. echo shar: Extracting \"'keys.h'\" \(3601 characters\)
  652. sed "s/^X//" >'keys.h' <<'END_OF_FILE'
  653. X/*
  654. X** keys.h - contains definitions of all the keys which invoke commands.
  655. X**
  656. X** keys.h 1.7   Delta'd: 17:26:33 10/7/92   Mike Lijewski, CNSF
  657. X**
  658. X** Copyright (c) 1991, 1992 Cornell University
  659. X** All rights reserved.
  660. X**
  661. X** Redistribution and use in source and binary forms are permitted
  662. X** provided that: (1) source distributions retain this entire copyright
  663. X** notice and comment, and (2) distributions including binaries display
  664. X** the following acknowledgement:  ``This product includes software
  665. X** developed by Cornell University'' in the documentation or other
  666. X** materials provided with the distribution and in all advertising
  667. X** materials mentioning features or use of this software. Neither the
  668. X** name of the University nor the names of its contributors may be used
  669. X** to endorse or promote products derived from this software without
  670. X** specific prior written permission.
  671. X**
  672. X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  673. X** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  674. X** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  675. X*/
  676. X
  677. X#ifndef __KEYS_H
  678. X#define __KEYS_H
  679. X
  680. Xconst char KEY_CTL_D = 4;       // forward half window - ASCII CTL-D
  681. Xconst char KEY_CTL_U = 0x15;    // backward half window - ASCII CTL-U
  682. Xconst char KEY_TOP   = '<';     // go to first line in listing
  683. Xconst char KEY_BOT   = '>';     // go to last line in listing
  684. Xconst char KEY_CTL_L = '\f';    // repaint screen -- CTR-L
  685. Xconst char KEY_a     = 'a';     // append to current problem
  686. Xconst char KEY_c     = 'c';     // close current problem
  687. Xconst char KEY_d     = 'd';     // delete current problem
  688. Xconst char KEY_e     = 'e';     // examine current problem
  689. Xconst char KEY_l     = 'l';     // log new problem
  690. Xconst char KEY_m     = 'm';     // examine current problem -- aka "more"
  691. Xconst char KEY_q     = 'q';     // quit
  692. Xconst char KEY_r     = 'r';     // reorganize the database for current area
  693. Xconst char KEY_s     = 's';     // subscribe to a problem area
  694. Xconst char KEY_u     = 'u';     // unsubscribe from a problem area
  695. Xconst char KEY_v     = 'v';     // view problem summaries
  696. Xconst char KEY_K     = 'K';     // keyword search over entire problem text
  697. Xconst char KEY_M     = 'M';     // modify keywords
  698. Xconst char KEY_R     = 'R';     // reopen a closed problem
  699. Xconst char KEY_S     = 'S';     // save problem listing to file
  700. Xconst char KEY_V     = 'V';     // print out version string
  701. Xconst char KEY_BKSP  = '\b';    // backspace works as expected while in a prompt
  702. Xconst char KEY_BANG  = '!';     // run shell command
  703. Xconst char KEY_ESC   = 0x1B;    // for GNU Emacs compatibility -- ASCII-ESC
  704. X
  705. X// display help
  706. Xconst char KEY_QM    = '?';
  707. Xconst char KEY_H     = 'H';
  708. X
  709. X// forward one line
  710. Xconst char KEY_j          = 'j';
  711. Xconst char KEY_n          = 'n';
  712. Xconst char KEY_CTL_N      = 0xE;   // ASCII CTL-N
  713. Xconst char KEY_SPC        = ' ';
  714. Xconst char KEY_CR         = '\r';  // carriage return
  715. Xconst char KEY_ARROW_DOWN = 300;
  716. X
  717. X// backward one line
  718. Xconst char KEY_k        = 'k';  // or keyword search over problem headers
  719. Xconst char KEY_p        = 'p';
  720. Xconst char KEY_CTL_P    = 0x10; // ASCII CTL-P
  721. Xconst char KEY_CTL_Y    = 0x19; // ASCII CTL-Y
  722. Xconst char KEY_ARROW_UP = 301;
  723. X
  724. X// forward one window
  725. Xconst char KEY_CTL_F = 6;    // ASCII CTL-F
  726. Xconst char KEY_CTL_V = 0x16; // ASCII CTL-V
  727. X
  728. X// backward one window
  729. Xconst char KEY_b     = 'b';
  730. Xconst char KEY_CTL_B = 2;   // ASCII CTL-B
  731. X
  732. X// abort from a prompt - CTL-G
  733. X//
  734. X// Can't use '\a' here due to some C compilers not recognizing this
  735. X// as the terminal bell.
  736. X//
  737. Xconst char KEY_ABORT = 0x7;
  738. X
  739. X#endif /* __KEYS_H */
  740. END_OF_FILE
  741. if test 3601 -ne `wc -c <'keys.h'`; then
  742.     echo shar: \"'keys.h'\" unpacked with wrong size!
  743. fi
  744. # end of 'keys.h'
  745. fi
  746. if test -f 'problem.h' -a "${1}" != "-c" ; then 
  747.   echo shar: Will not clobber existing file \"'problem.h'\"
  748. else
  749. echo shar: Extracting \"'problem.h'\" \(2118 characters\)
  750. sed "s/^X//" >'problem.h' <<'END_OF_FILE'
  751. X/*
  752. X** problem.h - functions exported by problem.C
  753. X**
  754. X** problem.h 1.9   Delta'd: 15:50:49 9/22/92   Mike Lijewski, CNSF
  755. X**
  756. X** Copyright (c) 1991, 1992 Cornell University
  757. X** All rights reserved.
  758. X**
  759. X** Redistribution and use in source and binary forms are permitted
  760. X** provided that: (1) source distributions retain this entire copyright
  761. X** notice and comment, and (2) distributions including binaries display
  762. X** the following acknowledgement:  ``This product includes software
  763. X** developed by Cornell University'' in the documentation or other
  764. X** materials provided with the distribution and in all advertising
  765. X** materials mentioning features or use of this software. Neither the
  766. X** name of the University nor the names of its contributors may be used
  767. X** to endorse or promote products derived from this software without
  768. X** specific prior written permission.
  769. X**
  770. X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  771. X** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  772. X** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  773. X*/
  774. X
  775. X#ifndef __PROBLEM_H
  776. X#define __PROBLEM_H
  777. X
  778. Xextern "C" {
  779. X#include <gdbm.h>
  780. Xextern gdbm_error gdbm_errno;
  781. X}
  782. X
  783. X// our GDMB filehandle  -- only one open GDBM file at a time
  784. Xextern GDBM_FILE GdbmFile;
  785. X
  786. X// help message for the message window when displaying help
  787. Xextern const char *const HELP_MSG[];
  788. X
  789. Xextern int   append_to_problem(const char *number = 0);
  790. Xextern int   close_problem(const char *number = 0);
  791. Xextern int   database_exists();
  792. Xextern int   delete_problem(const char *number = 0);
  793. Xextern int   examine_problem(const char *number = 0);
  794. Xextern int   modify_keywords(const char *number = 0);
  795. Xextern void  open_database(int mode);
  796. Xextern int   reopen_problem(const char *number = 0);
  797. Xextern void  reorganize_database(int dodelay = 1);
  798. Xextern char *summary_info(datum &data);
  799. X
  800. X//
  801. X// We need this on i486 + ISC v3.2 3.0 Unix (SysVR3)
  802. X// pid_t is the type returned by fork(2).
  803. X//
  804. X#ifdef ISC
  805. X#define pid_t short
  806. X#endif
  807. X
  808. X//
  809. X// Deal with old and new types of delete
  810. X//
  811. X#ifdef  OLDDELETE
  812. X#define DELETE delete
  813. X#else
  814. X#define DELETE delete []
  815. X#endif
  816. X
  817. X#endif
  818. END_OF_FILE
  819. if test 2118 -ne `wc -c <'problem.h'`; then
  820.     echo shar: \"'problem.h'\" unpacked with wrong size!
  821. fi
  822. # end of 'problem.h'
  823. fi
  824. if test -f 'regexp.h' -a "${1}" != "-c" ; then 
  825.   echo shar: Will not clobber existing file \"'regexp.h'\"
  826. else
  827. echo shar: Extracting \"'regexp.h'\" \(1596 characters\)
  828. sed "s/^X//" >'regexp.h' <<'END_OF_FILE'
  829. X/*
  830. X** external definitions needed for interfacing with regexp.C
  831. X**
  832. X** regexp.h regexp.h 1.3   Delta'd: 23:06:20 7/2/92   Mike Lijewski, CNSF
  833. X**
  834. X** Copyright (c) 1991 Cornell University
  835. X** All rights reserved.
  836. X**
  837. X** Redistribution and use in source and binary forms are permitted
  838. X** provided that: (1) source distributions retain this entire copyright
  839. X** notice and comment, and (2) distributions including binaries display
  840. X** the following acknowledgement:  ``This product includes software
  841. X** developed by Cornell University'' in the documentation or other
  842. X** materials provided with the distribution and in all advertising
  843. X** materials mentioning features or use of this software. Neither the
  844. X** name of the University nor the names of its contributors may be used
  845. X** to endorse or promote products derived from this software without
  846. X** specific prior written permission.
  847. X**
  848. X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  849. X** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  850. X** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  851. X*/
  852. X
  853. X#ifndef _REGEXP_H
  854. X#define _REGEXP_H
  855. X
  856. X#define NSUBEXP  10
  857. Xtypedef struct regexp {
  858. X    char *startp[NSUBEXP];
  859. X    char *endp[NSUBEXP];
  860. X    char regstart;        // Internal use only.
  861. X    char reganch;        // Internal use only.
  862. X    char *regmust;        // Internal use only.
  863. X    int regmlen;        // Internal use only.
  864. X    char program[1];    // Unwarranted chumminess with compiler.
  865. X} regexp;
  866. X
  867. Xextern const char *REerror; // how we pass error messages around
  868. Xextern regexp *regcomp(const char *exp);
  869. Xextern int regexec(regexp *prog, char *string);
  870. X
  871. X#endif
  872. END_OF_FILE
  873. if test 1596 -ne `wc -c <'regexp.h'`; then
  874.     echo shar: \"'regexp.h'\" unpacked with wrong size!
  875. fi
  876. # end of 'regexp.h'
  877. fi
  878. if test -f 'version.h' -a "${1}" != "-c" ; then 
  879.   echo shar: Will not clobber existing file \"'version.h'\"
  880. else
  881. echo shar: Extracting \"'version.h'\" \(1176 characters\)
  882. sed "s/^X//" >'version.h' <<'END_OF_FILE'
  883. X/*
  884. X** version.h - where our version number is defined
  885. X**
  886. X** version.h version.h 1.8   Delta'd: 13:39:02 10/13/92   Mike Lijewski, CNSF
  887. X**
  888. X** Copyright (c) 1991 Cornell University
  889. X** All rights reserved.
  890. X**
  891. X** Redistribution and use in source and binary forms are permitted
  892. X** provided that: (1) source distributions retain this entire copyright
  893. X** notice and comment, and (2) distributions including binaries display
  894. X** the following acknowledgement:  ``This product includes software
  895. X** developed by Cornell University'' in the documentation or other
  896. X** materials provided with the distribution and in all advertising
  897. X** materials mentioning features or use of this software. Neither the
  898. X** name of the University nor the names of its contributors may be used
  899. X** to endorse or promote products derived from this software without
  900. X** specific prior written permission.
  901. X**
  902. X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  903. X** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  904. X** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  905. X*/
  906. X
  907. X#ifndef _VERSION_H
  908. X#define _VERSION_H
  909. X
  910. Xconst char *const Version = "Problem Version 1.0";
  911. X
  912. X#endif
  913. END_OF_FILE
  914. if test 1176 -ne `wc -c <'version.h'`; then
  915.     echo shar: \"'version.h'\" unpacked with wrong size!
  916. fi
  917. # end of 'version.h'
  918. fi
  919. if test -f 'utilities.h' -a "${1}" != "-c" ; then 
  920.   echo shar: Will not clobber existing file \"'utilities.h'\"
  921. else
  922. echo shar: Extracting \"'utilities.h'\" \(3526 characters\)
  923. sed "s/^X//" >'utilities.h' <<'END_OF_FILE'
  924. X/*
  925. X** utilities.h - functions in utilities.C
  926. X**
  927. X** utilities.h utilities.h 1.27   Delta'd: 17:42:55 10/8/92   Mike Lijewski, CNSF
  928. X**
  929. X** Copyright (c) 1991, 1992 Cornell University
  930. X** All rights reserved.
  931. X**
  932. X** Redistribution and use in source and binary forms are permitted
  933. X** provided that: (1) source distributions retain this entire copyright
  934. X** notice and comment, and (2) distributions including binaries display
  935. X** the following acknowledgement:  ``This product includes software
  936. X** developed by Cornell University'' in the documentation or other
  937. X** materials provided with the distribution and in all advertising
  938. X** materials mentioning features or use of this software. Neither the
  939. X** name of the University nor the names of its contributors may be used
  940. X** to endorse or promote products derived from this software without
  941. X** specific prior written permission.
  942. X**
  943. X** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  944. X** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  945. X** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  946. X*/
  947. X
  948. X#ifndef __UTILITIES_H
  949. X#define __UTILITIES_H
  950. X
  951. X#include <stdio.h>
  952. X#include "classes.h"
  953. X
  954. X//
  955. X// possible response for yes_or_no command
  956. X//
  957. Xenum Response { No, Yes };
  958. X
  959. Xextern void         adjust_window();
  960. Xextern void         block_tstp_and_winch();
  961. Xextern void         cleanup(int);
  962. Xextern void         display_string(const char *str, int len =0, int offset =0); 
  963. Xextern void         eat_a_character(const char *msg, void (*redisplay)(),int=0);
  964. Xextern void         error(const char *format, ...);
  965. Xextern void         exec_with_system(const char *cmd, int prompt = 1);
  966. Xextern int          execute(const char *file, const char *argv[]);
  967. Xextern const char  *expand_tilde(char *str);
  968. Xextern char        *fgetline(FILE *fp, int size);
  969. Xextern char        *get_prob_number(const DList *dl);
  970. Xextern void         initialize();
  971. Xextern void         initial_listing(DList *dl);
  972. Xextern void         leftshift_current_line(DList *dl);
  973. Xextern int          lines_displayed(DList *dl);
  974. Xextern int          read_and_exec_perm(const char *file);
  975. Xextern void         rightshift_current_line(DList *dl);
  976. Xextern void         lock_file(int fd);
  977. Xextern void         message(const char *fmt, const char *str = 0);
  978. Xextern char        *prompt(const char *msg, void (*redisplay)());
  979. Xextern int          read_file(FILE *, char** &, int, int, int = 0);
  980. Xextern long         seconds_in_date(const char *date);
  981. Xextern void         set_signals();
  982. Xextern const char  *temporary_file();
  983. Xextern const char **tokenize(const char *line, const char *separators);
  984. Xextern void         unblock_tstp_and_winch();
  985. Xextern void         unlock_file(int fd);
  986. Xextern void         unset_signals();
  987. Xextern void         update_modeline(const char *head=0, const char *tail=0);
  988. Xextern void         update_screen_line(const char *oldl, const char *newl, int y);
  989. Xextern const char  *username();
  990. Xextern void         winch(int);
  991. Xextern void         write_to_pipe(int fd, const char *data, int size);
  992. Xextern int          yes_or_no(const char *msg,
  993. X                              void (*redisplay)(),
  994. X                              Response defResponse,
  995. X                              int standout);
  996. X
  997. X// has the window size changed?
  998. Xextern int windowSizeChanged;
  999. X
  1000. X// is the message window dirty?
  1001. Xextern int message_window_dirty;
  1002. X
  1003. X// the current modeline
  1004. Xextern char *current_modeline;
  1005. X
  1006. X// max - the maximum of two integer arguments.
  1007. Xinline int max(int x, int y) { return x >= y ? x : y; }
  1008. X
  1009. X#endif /*__UTILITIES_H*/
  1010. END_OF_FILE
  1011. if test 3526 -ne `wc -c <'utilities.h'`; then
  1012.     echo shar: \"'utilities.h'\" unpacked with wrong size!
  1013. fi
  1014. # end of 'utilities.h'
  1015. fi
  1016. if test -f 'AREAS.template' -a "${1}" != "-c" ; then 
  1017.   echo shar: Will not clobber existing file \"'AREAS.template'\"
  1018. else
  1019. echo shar: Extracting \"'AREAS.template'\" \(900 characters\)
  1020. sed "s/^X//" >'AREAS.template' <<'END_OF_FILE'
  1021. X#
  1022. X# This file contains the problem areas that are currently
  1023. X# valid.  Lines with a `#' in the first position are considered
  1024. X# comments; all other lines should be of the form:
  1025. X#
  1026. X# apf        - for APF problems under AIX/370
  1027. X# dbx
  1028. X# aix370     - general AIX/370 problems
  1029. X# AFS or NFS - any AFS or NFS related problem
  1030. X#
  1031. X# The part preceding the '-' is considered the to the problem area.
  1032. X# Any trailing spaces and tabs will be striped.  Any spaces embedded
  1033. X# in the name will be transformed to underscores.  The resultant name
  1034. X# must be a valid UNIX filename. So you shouldn't have any leading
  1035. X# spaces in these strings, nor any slashes (/) at all.  The full line
  1036. X# will be displayed in the AREA screen from which the user chooses
  1037. X# areas.  It is suggested that you use only spaces to align the
  1038. X# comment fields as there is no guarantee that tab aligned fields will
  1039. X# come out aligned when displayed.
  1040. X#
  1041. END_OF_FILE
  1042. if test 900 -ne `wc -c <'AREAS.template'`; then
  1043.     echo shar: \"'AREAS.template'\" unpacked with wrong size!
  1044. fi
  1045. # end of 'AREAS.template'
  1046. fi
  1047. if test -f 'ChangeLog' -a "${1}" != "-c" ; then 
  1048.   echo shar: Will not clobber existing file \"'ChangeLog'\"
  1049. else
  1050. echo shar: Extracting \"'ChangeLog'\" \(1676 characters\)
  1051. sed "s/^X//" >'ChangeLog' <<'END_OF_FILE'
  1052. X0.7 to 0.8
  1053. X---------
  1054. X
  1055. Xo replaced access(2) with open(2) in problem1.C
  1056. Xo replaced calls to fchmod(2) with chmod(2).
  1057. Xo made temporary_file return a const char *.
  1058. Xo replaced all calls to ftruncate() with a close(open()) combination.
  1059. Xo some #ifdef ISCs to make i486 + ISC v3.2 3.0 Unix (SysVR3) work.
  1060. Xo added POSIX signals and a flag to choose between BSD and POSIX
  1061. X  signals for those places where I truly need to "block" signals.
  1062. Xo added a MANIFEST file to the distribution.
  1063. X
  1064. X0.8 to 0.9
  1065. X---------
  1066. X
  1067. Xo added a '-v' flag.
  1068. Xo if we can't fit all the areas on the screen, even after compacting
  1069. X  them into multiple columns, the title line on the area window
  1070. X  becomes: "The First N Areas:".
  1071. Xo removed setbuf for setvbuf -- stdout is still fully buffered, but I now
  1072. X  let the standard I/O package choose the buffer and buffer size.
  1073. Xo added macro OLDDELETE to signify that the C++ compiler cannot deal
  1074. X  with the 'delete []' form of deleting arrays of objects.
  1075. Xo will now strip trailing tabs as well as spaces from the area names,
  1076. X  though tab-embedded strings probably won't display as the user
  1077. X  expects.
  1078. Xo am now cognizant of the fact that the second argument to execvp is a
  1079. X  (char *const *) and am using it correctly.
  1080. X
  1081. X0.9 to .95
  1082. X---------
  1083. X
  1084. Xo ran c++-tame-comments on all the .C files.  This is where all the
  1085. X  backslashes in comments come from.
  1086. Xo added 1992 to Copyright notice.
  1087. Xo fixed problem with not being able to use emacs as an editor.
  1088. Xo merged in patch from Rob Kurver
  1089. X
  1090. X0.95 to 1.0
  1091. X----------
  1092. X
  1093. Xo changed modify keyword command from 'm' to 'M'; now 'm' is
  1094. X  a mnemonic for "more" in "view" mode.
  1095. Xo enhanced yes_or_no with a default response mode.
  1096. Xo added patches for Apollo
  1097. END_OF_FILE
  1098. if test 1676 -ne `wc -c <'ChangeLog'`; then
  1099.     echo shar: \"'ChangeLog'\" unpacked with wrong size!
  1100. fi
  1101. # end of 'ChangeLog'
  1102. fi
  1103. if test -f 'INSTALL' -a "${1}" != "-c" ; then 
  1104.   echo shar: Will not clobber existing file \"'INSTALL'\"
  1105. else
  1106. echo shar: Extracting \"'INSTALL'\" \(8889 characters\)
  1107. sed "s/^X//" >'INSTALL' <<'END_OF_FILE'
  1108. X
  1109. XInstallation Guidelines:
  1110. X-----------------------
  1111. X
  1112. XProblem is written in C++, so you must have a C++ compiler.  It runs
  1113. Xonly in the UNIX environment for the time being.  You must also have
  1114. Xthe GNU database management library (GDBM) installed, as well as have
  1115. Xthe pager "less" on your system.  It has been successfully built and
  1116. Xtested in the following environments:
  1117. X
  1118. XSun Sparc running SunOS 4.1.1 with Cfront 2.0, g++ 2.2
  1119. XIBM 3090 running AIX/370 with Cfront 2.0
  1120. XIBM RS/6000 running AIX 3.1.5 with Cfront 2.1, g++ 2.2, xlC
  1121. Xi486 + ISC v3.2 3.0 Unix (SysVR3) with g++ 2.2.2 (use -DTERMIO -DISC)
  1122. XApollo running Domain/OS 10.3 with ANSI headers, BSD Environment, g++ 2.2
  1123. X
  1124. XIn order to build "problem", a few lines in the Makefile will need to be
  1125. Xmodified.  The line
  1126. X
  1127. XCC = 
  1128. X
  1129. Xis used to define the name of your C++ compiler.
  1130. X
  1131. X  ex.  You have some version of Cfront
  1132. X  --
  1133. X         CC = CC
  1134. X
  1135. X  ex.  you have GNU g++
  1136. X  --
  1137. X         CC = g++
  1138. X
  1139. XThe line
  1140. X
  1141. XCFLAGS =
  1142. X
  1143. Xis where system-specific preprocessor defines are put.  Direct from
  1144. Xthe Makefile we have:
  1145. X
  1146. X# Add -DSIGINTERRUPT if you both have it and NEED it to ensure that signals
  1147. X# interrupt slow system calls.  This is primarily for 4.3 BSD-based systems.
  1148. X# Otherwise, your system most certaily does the right thing already.
  1149. X#
  1150. X# Add -DOLDDELETE if your compiler can't handle the 'delete []' form
  1151. X# of the delete operator for deleting arrays of objects allocated
  1152. X# via new.  If you don't know whether you compiler can handle it or
  1153. X# not, just don't define it and see what happens.  If your compiler
  1154. X# accepts it, it'll do the right thing.
  1155. X#
  1156. X# You must indicate where the GDBM header file 'gdbm.h' is to be found
  1157. X# using a flag of the form: -I/usr/local/include.
  1158. X#
  1159. X# If you have the BSD 4.3 signal mechanism, in particular, sigblock(2) and
  1160. X# sigsetmask(2), add -DBSDSIGNALS.  Else if you have POSIX signals, in
  1161. X# particular sigprocmask(2), add -DPOSIXSIGNALS.  Otherwise I'll use
  1162. X# the usually ANSI C signal mechanism when I need to block SIGTSTP and
  1163. X# SIGWINCH.  This can lead to some lost signals in very rare
  1164. X# circumstances, but what can you do with a braindead signal mechanism.
  1165. X#
  1166. X# The default locking is done using the POSIX "lockf".  If you don't
  1167. X# have "lockf" but have the BSD "flock", add -DFLOCK.  If you have
  1168. X# neither, well ...
  1169. X
  1170. X  ex.  On a Sun you need to use -DSIGINTERRUPT and -DBSDSIGNALS
  1171. X  --
  1172. X         CFLAGS = -DSIGINTERRUPT -DBSDSIGNALS -I/usr/local/include
  1173. X
  1174. X  ex.  On an RS/6000 you only need -DBSDSIGNALS
  1175. X  --
  1176. X         CFLAGS = -DBSDSIGNALS -I/usr/local/include
  1177. X
  1178. XYou should also add -O to CFLAGS, unless you really don't trust the
  1179. Xoptimization phase of your compiler.
  1180. X
  1181. XThe line
  1182. X
  1183. XTERMFLAGS = 
  1184. X
  1185. Xis used to set which type of terminal control your OS uses.  From the
  1186. XMakefile:
  1187. X
  1188. X# Those flags needed to compile in the type of terminal
  1189. X# control you have.  Use -DTERMIOS if you have <termios.h>, the POSIX
  1190. X# terminal control.  Use -DTERMIO if you have <termio.h>, the SYSV
  1191. X# terminal control.  Otherwise, the default assumes you have <sgtty.h>,
  1192. X# the BSD terminal control.
  1193. X#
  1194. X# If you choose to use -DTERMIOS and have problems, try -DTERMIO.  On
  1195. X# at least two systems I've tried, the vendor hasn't had all the
  1196. X# include files set up correctly to include <unistd.h> together with 
  1197. X#  <osfcn.h> among others.
  1198. X#
  1199. X# On RS/6000s, AIX/370 and recent Suns, -DTERMIO works well.
  1200. X
  1201. X  ex.  on a SYSV-based system
  1202. X  --
  1203. X         TERMFLAGS = -DTERMIO
  1204. X
  1205. X  ex.  on a POSIX system
  1206. X  --
  1207. X         TERMFLAGS = -DTERMIOS
  1208. X
  1209. X  ex.  on a BSD-based system
  1210. X  --
  1211. X         TERMFLAGS =
  1212. X
  1213. XTo control the screen, dired uses the termcap(3) library.  It used the
  1214. XGNU Database Management Library  (GDBM) for low-level database
  1215. Xmanipulations.  You'll need to link with both these libraries.  From
  1216. Xthe Makefile we have:
  1217. X
  1218. XLIBS =  -lgdbm -ltermcap
  1219. X
  1220. XYou shouldn't need to change this unless you don't have termcap(3).
  1221. XIf this is the case, try one of '-lterminfo' or '-lcurses'.
  1222. X
  1223. XThe macro HOMEBASE is used to control where "problem" stores its
  1224. Xdatabases, mailing lists, SEQUENCE file and AREA file.  It must be a
  1225. Xfull pathname.  From the Makefile:
  1226. X
  1227. X# Directory is which the databases, AREA file (this is the file, with
  1228. X# one area per line, listing the valid problem areas), SEQUENCE file
  1229. X# (this is the file used to keep the unique problem #), and
  1230. X# MAILLIST.* files (which contains the names of interested parties)
  1231. X# will be stored. 
  1232. X
  1233. XThe macro MAILPROG is a version of mail which accepts the -s option to
  1234. Xset the subject line.  It must be a full pathname.
  1235. X
  1236. X  ex.  on AIX/370
  1237. X  --
  1238. X       MAILPROG = /bin/mail  
  1239. X
  1240. X  ex.  on a RS/6000
  1241. X  --
  1242. X       MAILPROG = /usr/bin/mail
  1243. X
  1244. XProblem maintains some limit on the amount of text it will accept for
  1245. Xany initial problem log, or for any single append or close.  From
  1246. Xexperience, this is important to keep people from putting lots of
  1247. Xexxtraneous information in their problem reports which does nothing
  1248. Xexcept cause the databases to grow excessively fast.  The size of this
  1249. Xlimit is configurable by setting the MAXFILESIZE.  At the authors site
  1250. Xwe use
  1251. X
  1252. XMAXFILESIZE = 16000
  1253. X
  1254. XProblem is designed to be run SUID from an account which has write
  1255. Xpermission to the HOMEBASE directory.  This is so that it can update
  1256. Xits SEQUENCE file and mailing list files, without giving write access
  1257. Xto the world.  To start with, it is probably easiest to just make the
  1258. XHOMEBASE directory writeable only by the "problem" administrator and
  1259. Xthen make it SUID to that user.
  1260. X
  1261. XOnce you've edited Makefile, type 'make'.  Hopefully, the make will
  1262. Xcomplete with no errors and you will have a working "problem".  Then
  1263. Xmove the executable "problem" to a suitable binary directory making
  1264. Xsure to set it up SUID to the owner of the HOMEBASE directory.  You
  1265. Xthen need to add some areas to the AREA file.
  1266. X
  1267. XA Word On GDBM:
  1268. X--------------
  1269. X
  1270. XRegarding GDBM, you'll need to do a bit of work to make it work from
  1271. XC++ code.  Specifically, the gdbm.h file generated when GDBM is built
  1272. Xisn't callable from C++; it doesn't have the functions prototyped.
  1273. XThe file 'gdbm.h-proto' should be a dropin replacement for the gdbm.h
  1274. Xfile generated on your system from GDBM version 1.5.  I've also sent
  1275. Xthis to the author of GDBM so that future releases will hopefully be
  1276. Xboth C and C++ compatible.
  1277. X
  1278. XThere is a potential problem with calling the GDBM functions on Suns
  1279. Xfrom C++ code if you use g++.  Basically, you need to compile GDBM and
  1280. X"problem" with compilers from the same "family".  That is, if you
  1281. Xcompile GDBM with gcc, you must compile "problem" with g++.  Likewise,
  1282. Xif you compiled GDBM with cc, you must use a Cfront-based compiler to
  1283. Xcompile "problem".  Otherwise, "problem" will seg fault when you try
  1284. Xto call any of the GDBM functions.  The problem is due to incompatible
  1285. Xstruct passing conventions between gcc and the native C compiler.  I'm
  1286. Xtold that this has been fixed in gcc/g++ versions 2.0 and higher.
  1287. XMoral: don't use a version of g++ lower than 2.0 on Suns.
  1288. X
  1289. XA Note Regarding Portability:
  1290. X----------------------------
  1291. X
  1292. XUnfortunately, from experience, it appears that C++ code is much more
  1293. Xdifficult to port than C code.  The main difficulty seems to be header
  1294. Xfiles.  Since every function must be prototyped before it is used, one
  1295. Xnecessarily includes many system include files to properly prototype
  1296. Xfunctions, especially in an application such as "problem" which uses a
  1297. Xfair number of system services and library functions.  When one starts
  1298. Xincluding many include files, the inconsistencies of the files becomes
  1299. Xapparent.  The most common "bug" is when two different include files
  1300. Xprototype a function differently.  C++ compilers consider this as a
  1301. Xhard error.  The only thing to be done in this situation is to fix the
  1302. Xheader file(s) and continue with the build process.
  1303. X
  1304. XAnother common difficulty is a header file which doesn't prototype a
  1305. Xfunction when in fact it should.  In this case your best bet is to
  1306. Xmanually add the prototype to "problem.h".
  1307. X
  1308. XAnother more fundamental difficulty with include files is that they are
  1309. Xincompletely or inconsistently standardized.  ANSI C dictates the
  1310. Xcontents of only fifteen include files which are meant to cover the C
  1311. Xlibrary.  In order to use a function not covered by ANSI C, which, by
  1312. Xnecessity, will include all operating system specific functions, one
  1313. Xmust have some other scheme for deciding what file(s) to include.
  1314. XWhere ANSI C stops, "problem" development has followed the rules
  1315. Xproposed by POSIX 1003.1 as regards which file to include to get the
  1316. Xprototype of some system-specific function.  Not all systems follow or
  1317. Xeven purport to follow the POSIX standard.
  1318. X
  1319. XIf nothing else, attempting to compile "problem" will probably point out
  1320. Xa number of deficiencies in the implementation of your header files.
  1321. XPersevere and report all bugs to your vendor.
  1322. X
  1323. X
  1324. XMike Lijewski (W)607/254-8686 (H)607/272-0238
  1325. XGoddard Space Flight Center
  1326. XINTERNET: lijewski@rosserv.gsfc.nasa.gov
  1327. XSMAIL:  446 Ridge Rd. Apt. 3, Greenbelt, MD  20770
  1328. END_OF_FILE
  1329. if test 8889 -ne `wc -c <'INSTALL'`; then
  1330.     echo shar: \"'INSTALL'\" unpacked with wrong size!
  1331. fi
  1332. # end of 'INSTALL'
  1333. fi
  1334. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  1335.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  1336. else
  1337. echo shar: Extracting \"'MANIFEST'\" \(1315 characters\)
  1338. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  1339. XAREAS.template     template for the AREAS file
  1340. XINSTALL            how to install this critter
  1341. XMANIFEST           you're reading it
  1342. XMakefile           controls the build
  1343. XREADME             a little about "problem"
  1344. XTHANKS             a bit of thanks to some people
  1345. Xclasses.C          definitions of some of our class member functions
  1346. Xclasses.h          declarations of the classes we use
  1347. Xdisplay.C          contains code controlling the display using termcap(3)
  1348. Xdisplay.h          declarations and inlines for display.C
  1349. Xgdbm.h-proto       sample C++-compatible header file for GDBM 1.5
  1350. Xhelp.h             contains help messages
  1351. Xkeys.h             definitions of all the keyboard keys we acknowledge
  1352. Xlister.C           contains code controlling the view window
  1353. Xlister.h           externally visible declarations for lister.C
  1354. Xproblem.1          man page
  1355. Xproblem.h          external declarations
  1356. Xproblem.lpr        line printable version of the man page
  1357. Xproblem1.C         first part of main command loop
  1358. Xproblem2.C         final part of main command loop
  1359. Xregexp.C           regular expression code
  1360. Xregexp.h           external declarations for regular expression code
  1361. Xutilities.C        some utility functions
  1362. Xutilities.h        external declarations of utility functions
  1363. Xversion.h          contains the patch level
  1364. X
  1365. X
  1366. X
  1367. X
  1368. END_OF_FILE
  1369. if test 1315 -ne `wc -c <'MANIFEST'`; then
  1370.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  1371. fi
  1372. # end of 'MANIFEST'
  1373. fi
  1374. echo shar: End of archive 1 \(of 7\).
  1375. cp /dev/null ark1isdone
  1376. MISSING=""
  1377. for I in 1 2 3 4 5 6 7 ; do
  1378.     if test ! -f ark${I}isdone ; then
  1379.     MISSING="${MISSING} ${I}"
  1380.     fi
  1381. done
  1382. if test "${MISSING}" = "" ; then
  1383.     echo You have unpacked all 7 archives.
  1384.     rm -f ark[1-9]isdone
  1385. else
  1386.     echo You still need to unpack the following archives:
  1387.     echo "        " ${MISSING}
  1388. fi
  1389. ##  End of shell archive.
  1390. exit 0
  1391.  
  1392. exit 0 # Just in case...
  1393.