Break out the unquote functionality to a separate function.
[mmh] / h / prototypes.h
1 /*
2 ** prototypes.h -- various prototypes
3 */
4
5 /*
6 ** missing system prototypes
7 */
8 #ifndef HAVE_TERMCAP_H
9 extern int tgetent(char *bp, char *name);
10 extern int tgetnum(char *id);
11 extern int tgetflag(char *id);
12 extern char *tgetstr(char *id, char **area);
13 extern char *tgoto(char *cm, int destcol, int destline);
14 extern int tputs(char *cp, int affcnt, int (*outc) (int));
15 #endif
16
17 /*
18 ** prototype from config.h
19 */
20 char *etcpath(char *);
21
22 /*
23 ** prototypes from the nmh subroutine library
24 */
25 void adios(int, char *, char *, ...) NORETURN;
26 void admonish(char *, char *, ...);
27 void advertise(char *, char *, char *, va_list);
28 void advise(char *, char *, ...);
29 void ambigsw(char *, struct swit *);
30 char **brkstring(char *, char *, char *);
31 int is_native_charset(char *);
32 char *concat(char *, ...);
33 int context_del(char *);
34 char *context_find(char *);
35 void context_read(void);
36 void context_replace(char *, char *);
37 void context_save(void);
38 void cpydata(int, int, char *, char *);
39 void cpydgst(int, int, char *, char *);
40 int decode_rfc2047(char *, char *, size_t);
41 int default_done(int);
42 int execprog(char *, char **);
43 int execprogl(char *, char *, ...);
44 char *expandfol(char *);
45 char *expanddir(char *);
46 int ext_hook(char *, char *, char *);
47 int folder_addmsg(struct msgs **, char *, int, int, int, int, char *);
48 int folder_delmsgs(struct msgs *, int);
49 void folder_free(struct msgs *);
50 struct msgs *folder_read(char *);
51 struct msgs *folder_realloc(struct msgs *, int, int);
52 int gans(char *, struct swit *);
53 char **getans(char *, struct swit *);
54 int getanswer(char *);
55 char **getarguments(char *, int, char **, int);
56 char *get_charset();
57 char *getcpy(char *);
58 char *getcurfol(void);
59 char *getdeffol(void);
60 int lkclose(int, char*);
61 int lkfclose(FILE *, char *);
62 FILE *lkfopen(char *, char *);
63 int lkopen(char *, int, mode_t);
64 int m_atoi(char *);
65 char *m_backup(char *);
66 int m_convert(struct msgs *, char *);
67 char *m_draft(char *);
68 int m_getfld(int, unsigned char *, unsigned char *, int, FILE *);
69 int m_gmprot(void);
70 char *m_name(int);
71 int m_putenv(char *, char *);
72 char *m_mktemp(const char *, int *, FILE **);
73 char *m_mktemp2(const char *, const char *, int *, FILE **);
74 void thisisanmbox(FILE *);
75 int makedir(char *);
76 char *norm_charmap(char *);
77 char *new_fs(char *, char *);
78 int pidwait(pid_t, int);
79 int pidstatus(int, FILE *, char *);
80 int pidXwait(int, char *);
81 void print_help(char *, struct swit *, int);
82 void print_sw(char *, struct swit *, char *, FILE *);
83 void print_version(char *);
84 void push(void);
85 char *pwd(void);
86 char *mhbasename(char *);
87 void readconfig(struct node **, FILE *, char *, int);
88 int seq_addmsg(struct msgs *, char *, int, int, int);
89 int seq_addsel(struct msgs *, char *, int, int);
90 char *seq_bits(struct msgs *);
91 int seq_delmsg(struct msgs *, char *, int);
92 int seq_delsel(struct msgs *, char *, int, int);
93 int seq_getnum(struct msgs *, char *);
94 char *seq_list(struct msgs *, char *);
95 int seq_nameok(unsigned char *);
96 void seq_print(struct msgs *, char *);
97 void seq_printall(struct msgs *);
98 void seq_read(struct msgs *);
99 void seq_save(struct msgs *);
100 void seq_setcur(struct msgs *, int);
101 void seq_setprev(struct msgs *);
102 void seq_setunseen(struct msgs *, int);
103 int showfile(char **, char *);
104 int smatch(char *, struct swit *);
105 char *snprintb(char *, size_t, unsigned, char *);
106 int stringdex(char *, char *);
107 char *toabsdir(char *);
108 char *trim(unsigned char *);
109 char *trimcpy(unsigned char *);
110 int unputenv(char *);
111 int uprf(char *, char *);
112 int vfgets(FILE *, char **);
113 char *write_charset_8bit(void);
114
115 /*
116  * Remove quotes and quoted-pair sequences from RFC-5322 atoms.
117  *
118  * Currently the actual algorithm is simpler than it technically should
119  * be: any quotes are simply eaten, unless they're preceded by the escape
120  * character (\).  This seems to be sufficient for our needs for now.
121  *
122  * Arguments:
123  *
124  * input        - The input string
125  * output       - The output string; is assumed to have at least as much
126  *                room as the input string.  At worst the output string will
127  *                be the same size as the input string; it might be smaller.
128  *
129  */
130 void unquote_string(const char *input, char *output);
131
132 int mh_strcasecmp(const char *s1, const char *s2);
133
134
135 /*
136 ** prototypes for some routines in uip
137 */
138 int distout(char *, char *, char *);
139 int what_now(char *, int, char *, char *, int, struct msgs *,
140                 char *, char *);
141
142 /*
143 ** from the former mts.h
144 */
145 char *LocalName(void);  /* hostname */
146 char *getusername(void);
147 char *getfullname(void);
148
149
150 /*
151 ** prototypes for message and sequence manipulation
152 */
153 void clear_msg_flags(struct msgs *, int);
154 void copy_msg_flags(struct msgs *, int, int);
155 void get_msg_flags(struct msgs *, seqset_t *, int);
156 void set_msg_flags(struct msgs *, seqset_t *, int);
157 seqset_t does_exist(struct msgs *, int);
158 void unset_exists(struct msgs *, int);
159 void set_exists(struct msgs *, int);
160 seqset_t is_selected(struct msgs *, int);
161 void unset_selected(struct msgs *, int);
162 void set_selected(struct msgs *, int);
163 seqset_t is_unseen(struct msgs *, int);
164 void unset_unseen(struct msgs *, int);
165 void set_unseen(struct msgs *, int);
166 seqset_t in_sequence(struct msgs *, int, int);
167 void clear_sequence(struct msgs *, int, int);
168 void add_sequence(struct msgs *, int, int);
169
170 int is_seq_private(struct msgs *, int);
171 void make_seq_public(struct msgs *, int);
172 void make_seq_private(struct msgs *, int);
173 void make_all_public(struct msgs *);
174
175 void clear_folder_flags(struct msgs *);
176 int is_readonly(struct msgs *);
177 void set_readonly(struct msgs *);
178 int other_files(struct msgs *);
179 void set_other_files(struct msgs *);