FOREVER is of very bad taste, use for (;;)
[apps/madmutt.git] / lib.h
1 /*
2  * Copyright notice from original mutt:
3  * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
4  * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
5  *
6  * This file is part of mutt-ng, see http://www.muttng.org/.
7  * It's licensed under the GNU General Public License,
8  * please see the file GPL in the top level source directory.
9  */
10
11 /* mutt functions which are generally useful. */
12
13 #ifndef _LIB_H
14 # define _LIB_H
15
16 # include <stdio.h>
17 # include <string.h>
18 # ifdef HAVE_UNISTD_H
19 #  include <unistd.h>           /* needed for SEEK_SET */
20 # endif
21 # include <sys/types.h>
22 # include <sys/stat.h>
23 # include <time.h>
24 # include <limits.h>
25 # include <stdarg.h>
26 # include <signal.h>
27
28 # ifndef _POSIX_PATH_MAX
29 #  include <posix1_lim.h>
30 # endif
31
32 # define TRUE 1
33 # define FALSE 0
34
35 # undef MAX
36 # undef MIN
37 # define MAX(a,b) ((a) < (b) ? (b) : (a))
38 # define MIN(a,b) ((a) < (b) ? (a) : (b))
39
40 void mutt_exit (int);
41
42 /* Exit values used in send_msg() */
43 #define S_ERR 127
44 #define S_BKG 126
45
46 /* The actual library functions. */
47
48 FILE *safe_fopen (const char *, const char *);
49
50 char *mutt_concat_path (char *, const char *, const char *, size_t);
51 char *mutt_read_line (char *, size_t *, FILE *, int *);
52
53 const char *mutt_basename (const char *);
54
55 int mutt_copy_stream (FILE *, FILE *);
56 int mutt_copy_bytes (FILE *, FILE *, size_t);
57 int mutt_rx_sanitize_string (char *, size_t, const char *);
58
59 int safe_open (const char *, int);
60 int safe_symlink (const char *, const char *);
61 int safe_rename (const char *, const char *);
62 int safe_fclose (FILE **);
63
64 size_t mutt_quote_filename (char *, size_t, const char *);
65
66 void mutt_nocurses_error (const char *, ...);
67 void mutt_sanitize_filename (char *, short);
68 void mutt_unlink (const char *);
69
70 const char *mutt_strsysexit(int e);
71
72 #endif