home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume14 / mush6.0 / part08 / mush.h < prev   
Encoding:
C/C++ Source or Header  |  1988-04-12  |  20.4 KB  |  549 lines

  1. /* @(#)mush.h    (c) copyright 1986 (Dan Heller) */
  2.  
  3. #define VERSION "Mail User's Shell (Vers 6.0) Sat Apr  2 19:36:07 PST 1988"
  4.  
  5. #include "config.h"
  6.  
  7. #ifdef CURSES
  8. #ifdef USG
  9. #    define _USG
  10. #    undef USG
  11. #endif /* USG */
  12. #include <curses.h>
  13. #if !defined(USG) && defined(_USG)
  14. #    define USG
  15. #    undef _USG
  16. #endif /* USG && _USG */
  17. #else /* CURSES */
  18. #include <stdio.h>
  19. #if defined(SYSV) && defined(USG)
  20. #include <termio.h>
  21. #endif /* SYSV && USG */
  22. #endif /* CURSES */
  23.  
  24. #include <ctype.h>
  25. #include <errno.h>
  26. #include <setjmp.h>
  27. #include "strings.h"
  28.  
  29. #ifdef SUNTOOL
  30. #    include <suntool/tool_hs.h>
  31. #else  /* SUNTOOL */
  32. #    include <sys/types.h>
  33. #    include <signal.h>
  34. #    ifndef SYSV
  35. #        include <sys/time.h>
  36. #     include <sys/ioctl.h>   /* for ltchars */
  37. #    else
  38. #        include <time.h>
  39. #        include <fcntl.h>
  40. #    endif /* SYSV */
  41. #endif /* SUNTOOL */
  42.  
  43. #include <sys/stat.h>
  44. #include <sys/file.h>
  45.  
  46. #ifdef SUNTOOL
  47. #    include <suntool/gfxsw.h>
  48. #    include <suntool/panel.h>
  49. #    include <suntool/ttysw.h>
  50. #    include <suntool/ttytlsw.h>
  51. #    include <suntool/menu.h>
  52. #    include <suntool/icon_load.h>
  53. #endif /* SUNTOOL */
  54.  
  55. /* if no maximum number of files can be found, we'll use getdtablesize() */
  56. #ifdef _NFILE
  57. #    define MAXFILES _NFILE
  58. #else
  59. #ifdef NOFILE
  60. #    define MAXFILES NOFILE
  61. #endif /* NOFILE */
  62. #endif /* NFILE */
  63.  
  64. #ifndef CTRL
  65. #define CTRL(c)        ('c' & 037)
  66. #endif /* CTRL */
  67.  
  68. #define ESC         '\033'
  69.  
  70. #define NO_STRING    ""
  71. #ifdef  NULL
  72. #undef  NULL
  73. #endif /* NULL */
  74. #define NULL        (char *)0
  75. #define NULL_FILE    (FILE *)0
  76. #define DUBL_NULL    (char **)0
  77. #define TRPL_NULL    (char ***)0
  78. #ifdef putchar
  79. #undef putchar
  80. #endif /* putchar */
  81. #define putchar(c)    fputc(c, stdout)
  82. #define bell()         fputc('\007', stderr)
  83.  
  84. /* For error recovery purposes, send keyboard generated signals to a special
  85.  * routine (interrupt) to set a global flag (WAS_INTR) and return to the
  86.  * calling routine which is responsible for checking the flag.  For both
  87.  * on_intr() and off_intr() macros, initialize WAS_INTR to false.
  88.  */
  89. #define on_intr() \
  90.     turnoff(glob_flags, WAS_INTR), oldint = signal(SIGINT, interrupt), \
  91.     oldquit = signal(SIGQUIT, interrupt)
  92.  
  93. #define off_intr() \
  94.     turnoff(glob_flags, WAS_INTR), (void) signal(SIGINT, oldint), \
  95.     (void) signal(SIGQUIT, oldquit)
  96.  
  97. /* Don't flush input when setting echo or cbreak modes (allow typeahead) */
  98. #ifdef TIOCSETN
  99. #ifdef stty
  100. #undef stty
  101. #endif /* stty */
  102. #define stty(fd, sgttybuf)    (ioctl(fd, TIOCSETN, sgttybuf))
  103. #endif /* TIOCSETN */
  104.  
  105. /* for system-V machines that run termio */
  106. #if defined(SYSV) && defined(USG)
  107. unsigned char vmin;
  108. #define sg_erase  c_cc[2]
  109. #define sg_flags  c_lflag
  110. #define sg_kill   c_cc[3]
  111. #define sg_ospeed c_cflag
  112. #define gtty(fd, SGTTYbuf)    ioctl(fd, TCGETA, SGTTYbuf)
  113. #undef stty
  114. #define stty(fd, SGTTYbuf)    ioctl(fd, TCSETAW, SGTTYbuf)
  115. #define echon()    (_tty.sg_flags |= (ECHO|ECHOE),    stty(0, &_tty))
  116. #define echoff()   (_tty.sg_flags &= ~ECHO,   stty(0, &_tty))
  117. #define cbrkon()   \
  118.     (_tty.sg_flags &= ~ICANON, _tty.c_cc[VMIN] = 1, stty(0, &_tty))
  119. #define cbrkoff()  \
  120.     (_tty.sg_flags |= ICANON, _tty.c_cc[VMIN] = vmin, stty(0, &_tty))
  121. #define savetty()  (void) gtty(0, &_tty), vmin = _tty.c_cc[VMIN]
  122. #define cbreak()   cbrkon()
  123. #define nocbreak() cbrkoff()
  124.  
  125. /* If curses isn't defined, declare our 'tty' and macros for echo/cbreak */
  126. #ifndef CURSES
  127. typedef struct termio SGTTY;
  128. #define echom()    echon()
  129. #define noechom()  echoff()
  130. #define crmode()   cbrkon()
  131. #define nocrmode() cbrkoff()
  132.  
  133. #else /* CURSES */
  134. /* If curses is defined, use the echo/cbreak commands in library only
  135.  * if cursees is running.  If curses isn't running, use macros above.
  136.  */
  137. #define echom()    ((iscurses) ? echo(): echon())
  138. #define noechom()  ((iscurses) ? noecho(): echoff())
  139. #define crmode()   ((iscurses) ? cbreak() : cbrkon())
  140. #define nocrmode() ((iscurses) ? nocbreak() : cbrkoff())
  141. #endif /* CURSES */
  142. #endif /* SYSV && USG */
  143.  
  144. #if !defined(USG)
  145. #ifndef CURSES
  146. /* if curses is not defined, simulate the same tty based macros */
  147. typedef struct sgttyb SGTTY;
  148. /* Do real ioctl calls to set the tty modes */
  149. #define crmode()   (_tty.sg_flags |= CBREAK,  stty(0, &_tty))
  150. #define nocrmode() (_tty.sg_flags &= ~CBREAK, stty(0, &_tty))
  151. #define echom()    (_tty.sg_flags |= ECHO,    stty(0, &_tty))
  152. #define noechom()  (_tty.sg_flags &= ~ECHO,   stty(0, &_tty))
  153. #define savetty()  (void) gtty(0, &_tty)
  154. #else /* CURSES */
  155. #define echom()    echo()
  156. #define noechom()  noecho()
  157. #endif /* ~CURSES */
  158. #endif /* ~USG */
  159.  
  160. /* With all that out of the way, we can now declare our tty type */
  161. SGTTY _tty;
  162.  
  163. /* These macros now turn on/off echo/cbreak independent of the UNIX running */
  164. #define echo_on()    \
  165.     if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) nocrmode(), echom()
  166. #define echo_off()    \
  167.     if (_tty.sg_flags && isoff(glob_flags, ECHO_FLAG)) crmode(), noechom()
  168.  
  169. #define strdup(dst, src) (xfree (dst), dst = savestr(src))
  170. #define Debug        if (debug) printf
  171.  
  172. #ifdef SYSV
  173. #ifndef L_SET
  174. #define L_SET    0
  175. #endif /* L_SET */
  176. #ifndef F_OK
  177. #define F_OK    000
  178. #define R_OK    004
  179. #define W_OK    002
  180. #define E_OK    001
  181. #endif /* F_OK */
  182. typedef    unsigned long    u_long;
  183. #define vfork   fork
  184. #ifdef SIGCHLD
  185. #undef SIGCHLD
  186. #endif /* SIGCHLD */
  187. #define SIGCHLD SIGCLD
  188. #endif /* SYSV */
  189.  
  190. #if !defined(SUNTOOL) && !defined(CURSES)
  191.  
  192. #define TRUE          1
  193. #define FALSE          0
  194. #define print          printf
  195. #define wprint          printf
  196. #define print_more      printf
  197.  
  198. #endif /* SUNTOOL && !CURSES */
  199.  
  200. #ifndef max
  201. #define max(a,b) (((a) > (b)) ? (a) : (b))
  202. #define min(a,b) (((a) < (b)) ? (a) : (b))
  203. #endif /* max */
  204.  
  205. #if defined(CURSES) && !defined(SUNTOOL)
  206. #define wprint printf
  207. #endif /* !SUNTOOL && CURSES */
  208.  
  209. #if defined(CURSES) || defined(SUNTOOL)
  210. #define print_more      turnon(glob_flags, CONT_PRNT), print
  211. void print();        /* printf to window or curses or tty accordingly */
  212. #endif /* CURSES || SUNTOOL */
  213.  
  214. #ifdef  SUNTOOL
  215.  
  216. #define NO_ITEM          (Panel_item)0
  217. #define NO_EVENT      (struct inputevent *)0
  218. #define TIME_OUT      60           /* sleep 60 secs between mailchecks */
  219. #define PIX_XOR          PIX_SRC ^ PIX_DST
  220. #define ID           event.ie_code
  221. #define l_width(font)      fonts[font]->pf_defaultsize.x /* width of letter */
  222. #define l_height(font)      fonts[font]->pf_defaultsize.y /* height of letter */
  223. #define Clrtoeol(w,x,y,f) pw_text(w, x, y, PIX_SRC, fonts[f], blank)
  224. #define type_cursor(op)   pw_char(msg_win, txt.x,txt.y, op, fonts[curfont],'_')
  225.  
  226. #define highlight(win,x,y,font,s) \
  227.     pw_text(win,x,y, PIX_SRC, fonts[font],s), \
  228.     pw_text(win,x+1,y, \
  229.     (ison(glob_flags, REV_VIDEO))? PIX_NOT(PIX_SRC): PIX_SRC|PIX_DST, \
  230.     fonts[font],s)
  231.  
  232. /* Fonts */
  233. #define FONTDIR          "/usr/lib/fonts/fixedwidthfonts"
  234. #define DEFAULT          0
  235. #define SMALL           1
  236. #define LARGE           2
  237. #define MAX_FONTS      3
  238.  
  239. #endif /* SUNTOOL */
  240.  
  241. /* bits and pieces */
  242. #define turnon(flg,val)   ((flg) |= ((u_long)1 << ((u_long)(val)-1L)))
  243. #define turnoff(flg,val)  ((flg) &= ~((u_long)1 << ((u_long)(val)-1L)))
  244. #define ison(flg,val)     ((u_long)(flg) & ((u_long)1 << ((u_long)(val)-1L)))
  245. #define isoff(flg,val)    (!ison((flg), (val)))
  246. #define set_replied(n)      \
  247.     if (isoff(msg[n].m_flags, REPLIED)) \
  248.         turnon(glob_flags, DO_UPDATE), turnon(msg[n].m_flags, REPLIED)
  249. #define set_isread(n)      \
  250.     if (ison(msg[n].m_flags, UNREAD)) \
  251.         turnon(glob_flags, DO_UPDATE), turnoff(msg[n].m_flags, UNREAD)
  252.  
  253. /* msg lists represented by bits (8 should be replaced by sizeof(char) */
  254. #define clear_msg_list(list)      (void) bzero(list, (msg_cnt+7)/8)
  255. #define msg_bit(list, n)    ((list[(n) / 8] >> ((n) % 8)) & 1)
  256. #define set_msg_bit(list, n)    (list[(n) / 8] |= (1 << ((n) % 8)))
  257. #define unset_msg_bit(list, n)  (list[(n) / 8] &= ~(1 << ((n) % 8)))
  258. #define bput(S1, S2, Len, op)                   \
  259.         {                         \
  260.             register char *s1 = S1, *s2 = S2;         \
  261.             register int len = Len;             \
  262.             while(len--)                 \
  263.             *s2++ op *s1++;             \
  264.         }
  265. #define bitput(m1,m2,len,op)    bput(m1, m2, (((len)+7)/8), op)
  266.  
  267. /* convenience and/or readability */
  268. #define when          break;case
  269. #define otherwise      break;default
  270. #define lower(c)      (isupper(c)? tolower(c): c)
  271. #define Lower(c)      (c = lower(c))
  272. #define upper(c)      (islower(c)? toupper(c): c)
  273. #define Upper(c)      (c = upper(c))
  274. #define skipspaces(n)     for(p += (n); *p == ' ' || *p == '\t'; ++p)
  275. #define skipdigits(n)     for(p += (n); isdigit(*p); ++p)
  276.  
  277. #define NO_FLG        0
  278.  
  279. /* various flags */
  280. long   glob_flags;    /* global boolean flags thruout the whole program */
  281. #define DO_UPDATE   1    /* check for changes to avoid unnecessary copyback */
  282. #define REV_VIDEO   2    /* reverse video for curses or toolmode */
  283. #define CONT_PRNT   3    /* continue to print (maybe a printf) without a '\n' */
  284. #define DO_SHELL    4    /* run a shell even if no mail? (true if tool) */
  285. #define DO_PIPE     5    /* true if commands are piping to another command */
  286. #define IS_PIPE     6    /* true if commands' "input" is piped from another */
  287. #define IGN_SIGS    7    /* true if catch() should not longjump */
  288. #define IGN_BANG    8    /* ignore ! as a history reference (see source()) */
  289. #define ECHO_FLAG   9    /* if true, echo|cbreak is ON, echo typing (-e) */
  290. #define IS_GETTING 10    /* true if we're getting input for a letter */
  291. #define PRE_CURSES 11    /* true if curses will be run, but hasn't started yet */
  292. #define READ_ONLY  12    /* -r passed to folder() (or main) setting read only */
  293. #define REDIRECT   13    /* true if stdin is being redirected */
  294. #define WAS_INTR   14    /* catch interrupts, set this flag (signals.c) */
  295. #define WARNING    15   /* if set, various warning messages may be printed */
  296. #define NEW_MAIL   17   /* new mail has arrived; user is busy or in icon mode */
  297. #define CNTD_CMD   18   /* curses.c -- "...continue..." prompt in curses */
  298. #define IS_SENDING 19   /* was started to send mail, not to be run as a shell */
  299. #define MIL_TIME   20    /* if $mil_time is set, use 24hr military time fmt */
  300.  
  301. #define VERBOSE        1       /* verbose flag for sendmail */
  302. #define INCLUDE        2       /* include msg in response */
  303. #define INCLUDE_H    3    /* include msg with header */
  304. #define EDIT        4    /* enter editor by defualt on mailing */
  305. #define SIGN        5    /* auto-include ~/.signature in mail */
  306. #define DO_FORTUNE    6    /* add a fortune at end of msgs */
  307.  
  308. /* msg flags */
  309. #define NO_HEADER    7    /* don't print header of message (top, write) */
  310. #define DELETE        8
  311. #define OLD            9
  312. #define UNREAD        10
  313. #define UPDATE_STATUS    11    /* change status of msg when copyback */
  314. #define NO_PAGE        12    /* don't page this message */
  315. #define INDENT        13    /* indent included msg with string */
  316. #define NO_IGNORE    14    /* don't ignore headers */
  317. #define PRESERVE    15      /* preserve in mailbox unless deleted */
  318. #define TOP        15    /* just print the top of msg (same as pre) */
  319. #define FORWARD        16    /* Forward messages into the message buffer */
  320. #define REPLIED        17    /* Messages that have been replied to */
  321. #define NEW_SUBJECT    18    /* new subject regardless of $ask (mail -s) */
  322.  
  323. #define    MAXMSGS_BITS    MAXMSGS/sizeof(char)    /* number of bits for bitmap */
  324.  
  325. struct msg {
  326.     u_long m_flags;
  327.     long   m_offset;               /* offset in tempfile of msg */
  328.     long   m_size;                 /* number of bytes in msg */
  329.     int    m_lines;                /* number of lines in msg */
  330. } msg[MAXMSGS];
  331.  
  332. struct options {
  333.     char *option;
  334.     char *value;
  335.     struct options *next;
  336. } *set_options, *aliases, *ignore_hdr, *functions, *fkeys, *own_hdrs;
  337. #ifdef CURSES
  338. struct options *bindings;
  339. #endif /* CURSES */
  340.  
  341. struct cmd {
  342.     char *command;
  343.     int (*func)();
  344. };
  345. extern struct cmd ucb_cmds[];
  346. extern struct cmd cmds[], hidden_cmds[];
  347. #ifdef SUNTOOL
  348. extern struct cmd fkey_cmds[];
  349. #endif /* SUNTOOL */
  350.  
  351. FILE
  352.     *tmpf,        /* temporary holding place for all mail */
  353.     *open_file(),    /* open a file or program for write/append */
  354.     *popen();        /* this should be in stdio.h */
  355.  
  356. extern char
  357.     *sys_errlist[],    /* system's list of global error messages */
  358. #ifdef SUNTOOL
  359.     *font_files[],     /* the names of the files fonts are kept in */
  360.     *alt_fonts[],     /* fonts to use if first ones don't work */
  361. #endif /* SUNTOOL */
  362.     **environ;        /* user's environment variables */
  363.  
  364. extern int errno;    /* global system error number */
  365. jmp_buf jmpbuf;        /* longjmp to jmpbuf on sigs (not in tool) */
  366.  
  367. char
  368.     debug,        /* debug causes various print statements in code */
  369.     tempfile[40],    /* path to filename of temporary file */
  370.     msg_list[MAXMSGS_BITS],    /* MAXMSGS bits of boolean storage */
  371.     *cmd_help,        /* filename of location for "command -?" commands. */
  372.     *get_name_n_addr(), /* get name and addr from a well-formed address */
  373.     *login,        /* login name of user */
  374.     *mailfile,        /* path to filename of current mailfile */
  375.     *ourname[MAX_HOST_NAMES],    /* the name and aliases of the current host */
  376.     *prompt,        /* the prompt string -- may have %d */
  377.     *escape,        /* the "tilde escape" when inputting text to letter */
  378.     *hdrs_only,        /* true if -H flag was given --set to args */
  379.     *hdr_format,    /* set to the header format string; referenced a lot */
  380.     *argv_to_string(),    /* convert a vector of strings into one string */
  381.     **make_command(),    /* build a command vector (argv) */
  382.     **mk_argv(),    /* given a string, make a vector */
  383.     *itoa(),        /* return a string representation of a number */
  384.     *lcase_strcpy(),    /* just like strcpy, but convert all chars to lower */
  385.     *variable_stuff(),    /* return information about variables */
  386.     *no_newln(),    /* remove newline and extra whitespace - return end */
  387.     *savestr(),        /* strcpy arg into malloc-ed memory; return address */
  388.     *spoolfile,        /* MAILDIR/$USER in a string -- this is used a lot */
  389.     *date_to_string(),    /* returns a string described by parse_date() */
  390.     *msg_date(),    /* return a string of the date of a message */
  391.     *parse_date(),    /* parse an ascii date, and return message-id str */
  392.     *Time(),        /* returns string expression of time (takes args) */
  393.     *do_range(),    /* parse a string converting to a "range" of numbers */
  394.     *getpath(),        /* static char returning path (expanding ~, +, %, #) */
  395.     *compose_hdr(),    /* returns a formatted line describing passed msg # */
  396.     *my_atoi(),     /* do an atoi, but return the last char parsed */
  397.     *do_set(),        /* set/unset an option, alias, ignored-hdr */
  398.     *reply_to(),    /* who do we reply to when responding */
  399.     *reply_hdr(),    /* compose In-Reply-to: hdr according to format */
  400.     *cc_to(),         /* when responding, return str which is the cc-list */
  401.     *subject_to(),      /* when responding, return str which is the subject */
  402.     *header_field(),    /* the line in msg described by arg (message header) */
  403.     *alias_to_address(),/* convert a name[list] to "real" names */
  404.     *set_header(),     /* [interactive] proc to set/display to/subject/cc */
  405.     *getenv(), *prog_name;
  406.  
  407. int
  408.     last_msg_cnt,    /* when checking for new mail, save the last msg_cnt */
  409.     msg_cnt,        /* total number of messages */
  410.     crt,        /* min number of lines msg contains to invoke pager */
  411.     current_msg,    /* the current message we're dealing with */
  412.     exec_pid,        /* pid of a command that has been "exec"ed */
  413.     hist_no,        /* command's history number */
  414.     iscurses,        /* if we're running curses */
  415.     istool,        /* argv[0] == "xxxxtool", ranges from 0 to 2 */
  416.     n_array[128],    /* array of message numbers in the header window */
  417.     screen,        /* number of headers window can handle */
  418.  
  419.     quit(), cleanup(), catch(), do_alias(), respond(), cd(), sh(), stop(),
  420.     folder(), save_msg(), delete(), do_mail(), lpr(), alts(), set(), do_hdrs(),
  421.     rm_edfile(), pick(), save_opts(), preserve(), sort(), readmsg(),
  422.     do_pick(), print_help(), folders(), question_mark(), do_from(), my_stty(),
  423.     do_version(), disp_hist(), source(), do_echo(), sigchldcatcher(), ls(),
  424.     nopenfiles(), Setenv(), Unsetenv(), Printenv(), bus_n_seg(), msg_flags(),
  425.     toggle_debug(), stop_start(), interrupt();
  426.  
  427. long
  428.     still_more,        /* there is still more message to display */
  429.     spool_size,        /* size of sppol mail regardless of current folder */
  430.     last_size,        /* the lastsize of the mailfile since last check */
  431.     time();        /* satisfy lint */
  432.  
  433. void
  434.     xfree(), free_vec(), error(), getmail(), mail_status(),
  435.     file_to_fp(), init(), display_msg();
  436.     /* printf(), fclose(), fflush(), fputs(), fputc() */
  437. #ifdef TIOCGLTC
  438. struct ltchars ltchars;            /* tty character settings */
  439. #endif /* TIOCGLTC */
  440.  
  441. #ifdef CURSES
  442.  
  443. #define STANDOUT(y,x,s) standout(), mvaddstr(y,x,s), standend()
  444. #define redraw()    clearok(curscr, TRUE), wrefresh(curscr)
  445.  
  446. int
  447.     curses_init(),    /* interpret commands via the curses interface */
  448.     bind_it();        /* bind chars or strings to functions */
  449. #endif /* CURSES */
  450.  
  451. #ifdef SUNTOOL
  452. void
  453.     lock_cursors(), unlock_cursors(), scroll_win(),
  454.     set_fkeys(), set_key(), toggle_opt(), help_opt();
  455.  
  456. char
  457.     *rite(),        /* rite a char to msg_win: return string if c == '\n' */
  458.     *find_key(),    /* pass x,y coords to find which function key assoc. */
  459.     *key_set_to(),    /* pass fkey string, return string describing func */
  460.     *panel_get(),          /* returns what has been typed in a panel item */
  461.     *tool_help,        /* help for tool-related things (sometimes, overlap) */
  462.     blank[128];        /* use to clear to end of line */
  463.  
  464. int
  465.     time_out,        /* time out interval to wait for new mail */
  466.     rootfd,        /* the root window's fd */
  467.     parentfd,        /* the parent's window fd */
  468.     getting_opts,    /* true if getting/setting opts from msg_win */
  469.     curfont,        /* the current font to use for mail message window */
  470.     total_fonts,    /* total number of fonts available */
  471.     get_hdr_field,    /* bitmask of header fields to be gotten */
  472.  
  473.     msg_io(), msgwin_handlesigwinch(), hdr_io(), hdrwin_handlesigwinch(),
  474.     sigchldcatcher(), sigtermcatcher(), sigwinchcatcher(), do_sort(),
  475.     do_compose(), do_edit(), read_mail(), delete_mail(), respond_mail(),
  476.     do_hdr(), display_hdrs(), print_sigwinch(), p_set_opts(),
  477.     tool_mgmt(), do_help(), text_done(), msg_num_done(), do_lpr(),
  478.     toolquit(), change_font(), do_clear(), do_update(),
  479.     file_dir(), do_file_dir(), do_send(), abort_mail(), check_new_mail(),
  480.     fkey_cmd(), fkey_settings();
  481.  
  482. struct tchars  tchars;            /* more tty character settings */
  483.  
  484. struct tool *tool;      /* main tool structure */
  485. struct toolsw
  486.     *panel_sw,        /* main panel subwindow */
  487.     *hdr_sw,         /* subwindow for message headers */
  488.     *hdr_panel_sw,    /* panel for headers */
  489.     *tty_sw,         /* subwindow which forks a shell (usually editor) */
  490.     *print_sw,         /* subwindow for print statements */
  491.     *msg_sw;         /* main subwindow to display messages and more */
  492.  
  493. struct pixwin
  494.     *msg_win,        /* main pixwin for message display and more */
  495.     *hdr_win,        /* pixwin for message headers */
  496.     *print_win;        /* pixwin for printing messages ( print() ) */
  497.  
  498. struct pr_pos txt;               /* current position of text written */
  499. struct rect msg_rect, hdr_rect;         /* sizes of the main and hdr rects */
  500. struct pixfont *fonts[MAX_FONTS];    /* array of fonts */
  501.  
  502. Panel
  503.     main_panel,        /* the main panel dealing with generic items */
  504.     hdr_panel;        /* panel which contains message header specific items */
  505.  
  506. Panel_item
  507.     abort_item,        /* abort mail in progress */
  508.     alias_item,        /* set/view/change current mail aliases */
  509.     cd_item,        /* changes file_item to cd (for cd-ing) */
  510.     comp_item,        /* compose a letter */
  511.     delete_item,    /* delete/undelete messages */
  512.     edit_item,        /* edit a message */
  513.     font_item,        /* choose which font to use */
  514.     folder_item,    /* change folders */
  515.     file_item,         /* text item for files or directories (forlder/cd) */
  516.     hdr_display,    /* format message headers are displayed */
  517.     help_item,        /* choose this to get various help */
  518.     ignore_item,    /* set/view/change message headers to be ignored */
  519.     input_item,        /* text item to get values for set/unsetting values */
  520.     msg_num_item,    /* text item to explicity state which message to read */
  521.     next_scr,        /* display the next screenful of message headers */
  522.     option_item,    /* set/view/unset mail options */
  523.     prev_scr,        /* display the previous screen of messages */
  524.     print_item,        /* send current message to the printer */
  525.     quit_item,        /* quit tool/close to icon */
  526.     read_item,        /* read the current message */
  527.     respond_item,    /* respond to messages */
  528.     save_item,        /* saves messages; uses text item input_item */
  529.     send_item,        /* when composing letter, this will send it off */
  530.     sort_item,        /* sort routine... */
  531.     sub_hdr_item[6],    /* display items that just sit there and give help */
  532.     update_item;    /* commit changes to folder */
  533.  
  534. struct itimerval mail_timer;    /* frequency to check for new mail */
  535.  
  536.             /* mouse symbols and data */
  537. /* left, middle and right mouse pixrects */
  538. struct cursor
  539.     l_cursor, m_cursor, r_cursor, coffee, read_cursor, write_cursor,
  540.     main_cursor, checkmark;
  541.  
  542. struct pixrect *msg_pix; /* pixrect holding text of a message */
  543. extern struct pixrect mouse_left, mouse_middle, mouse_right;
  544. extern struct pixrect dn_arrow, up_arrow, cycle, shade_50;
  545.  
  546. extern struct icon mail_icon;
  547. #endif /* SUNTOOL */
  548.  
  549.