1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
/* lsmbox.h
*
* Copyright (C) 2002-2004 David Weinehall
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _LSMBOX_H_
#define _LSMBOX_H_
#include <config.h>
#include <pwd.h>
#if TIME_WITH_SYS_TIME
#include <time.h>
#include <sys/time.h>
#else
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif /* HAVE_SYS_TIME_H */
#endif /* TIME_WITH_SYS_TIME */
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#ifdef HAVE_UTIME
#include <utime.h>
#else
struct utimbuf {
time_t actime; /* access time */
time_t modtime; /* modification time */
};
/* Not a perfect work-around, but at least usable */
#define utime(__x, __y) ((void)0)
#endif /* HAVE_UTIME */
#undef NDEBUG
#include <assert.h>
#if defined(USE_CURSES) && HAVE_ATEXIT
#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#else
#include <curses.h>
#endif /* HAVE_NCURSES_H */
#endif /* defined(USE_CURSES) && HAVE_ATEXIT */
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#elif HAVE_NDIR_H
#include <ndir.h>
#elif HAVE_DIR_H
#include <dir.h>
#elif HAVE_SYS_NDIR_H
#include <sys/ndir.h>
#elif HAVE_SYS_DIR_H
#include <sys/dir.h>
#endif /* DIRENT/NDIR/DIR/SYS_NDIR/SYS_DIR */
#include <getopt.h>
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
#if STDC_HEADERS
#include <string.h>
#else
#if !HAVE_STRCHR
#define strchr index
#define strrchr rindex
#endif /* !HAVE_STRCHR */
#if !HAVE_MEMCPY
#define memcpy(dest, src, n) bcopy((src), (dest), (n))
#define memmove(dest, src, n) bcopy((src), (dest), (n))
#endif /* !HAVE_MEMCPY */
#endif /* STDC_HEADERS */
#if HAVE_UNISTD_H
#include <unistd.h>
#include <sys/types.h>
#endif /* HAVE_UNISTD_H */
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif /* HAVE_SYS_WAIT_H */
#ifndef WEXITSTATUS
#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
#endif /* WEXITSTATUS */
#ifndef WIFEXITED
#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#endif /* WIFEXITED */
#include <sys/stat.h>
#include <gettext.h>
#define _(__str) gettext(__str)
#define SPOOLFILE_PATH "/var/mail" /* username follows */
#define MAILBOX_FOLDER_PATH "Mail" /* $HOME preceeds */
#define MAIL_COMMAND "xterm -e mutt -f"
#define SET_STR "set"
#define UNSET_STR "unset"
#define MARK_OLD_STR "mark_old"
#define SPOOLFILE_STR "spoolfile"
#define MAILBOX_FOLDER_STR "folder"
#define MAILBOX_STR "mailboxes"
#define MH_SEQ_UNSEEN_STR "mh_seq_unseen"
#define MAIL_COMMAND_STR "lsmbox_mail_command"
#define UNSEEN_STR "unseen"
#define FROM_STR "From "
#define STATUS_STR "Status: "
#define CONTENT_LENGTH_STR "Content-Length: "
#define BUF_SIZE 65536
#define MAILCHECK_DEFAULT 10
#define MAILCHECK_MINIMUM 3
#define HILIGHT_TIME 30
#define SELECTED_TIME 120
#define SKIP_EQ (1 << 0)
#define SKIP_QU (1 << 1)
#ifdef USE_CURSES
#define OPTSTR "ci:nosSt"
#else
#define OPTSTR "nosSt"
#endif /* USE_CURSES */
struct option const options[] = {
#ifdef USE_CURSES
{ "continuous", no_argument, 0, 'c' },
{ "check-interval", required_argument, 0, 'i' },
#endif /* USE_CURSES */
{ "new-only", no_argument, 0, 'n' },
{ "no-old", no_argument, 0, 'o' },
{ "no-summary", no_argument, 0, 's' },
{ "short-names", no_argument, 0, 'S' },
{ "no-total", no_argument, 0, 't' },
{ "help", no_argument, 0, 'h' },
{ "version", no_argument, 0, 'V' },
{ 0, 0, 0, 0 }
};
typedef enum {
MBOX,
MAILDIR,
MHDIR
} mbox_type_t;
typedef enum {
E_OK,
E_SYNTAX,
E_UNKNOWN
} lsmbox_error_t;
#ifndef HAVE_VW_PRINTW
#define vw_printw vwprintw
#endif /* HAVE_VW_PRINTW */
#endif /* _LSMBOX_H_ */
|