home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume33 / problem1 / part01 < prev    next >
Encoding:
Text File  |  1992-11-12  |  56.7 KB  |  1,539 lines

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