home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sources / misc / 4078 < prev    next >
Encoding:
Text File  |  1992-11-12  |  56.9 KB  |  1,545 lines

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