1 /*
2  This file is part of SLRN.
3 
4  Copyright (c) 1994, 1999, 2007-2016 John E. Davis <jed@jedsoft.org>
5  Copyright (c) 2001-2006 Thomas Schultz <tststs@gmx.de>
6 
7  This program is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the Free
9  Software Foundation; either version 2 of the License, or (at your option)
10  any later version.
11 
12  This program is distributed in the hope that it will be useful, but WITHOUT
13  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15  more details.
16 
17  You should have received a copy of the GNU General Public License along
18  with this program; if not, write to the Free Software Foundation, Inc.,
19  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21 #ifndef _SLRN_MISC_H
22 #define _SLRN_MISC_H
23 #include <stdio.h>
24 #include <stdarg.h>
25 #include <slang.h>
26 
27 #include "ttymsg.h"
28 #include "vfile.h"
29 
30 extern void slrn_make_home_filename (char *, char *, size_t);
31 extern void slrn_make_home_dirname (char *, char *, size_t);
32 extern void slrn_redraw (void);
33 extern void slrn_update_screen (void);
34 extern int Slrn_Full_Screen_Update;
35 extern int slrn_get_yesno (int, char *, ...) ATTRIBUTE_PRINTF(2,3);
36 extern int slrn_get_yesno_cancel (int, char *str, ...) ATTRIBUTE_PRINTF(2,3);
37 extern void slrn_clear_message (void);
38 extern void slrn_clear_error (void);
39 extern char *slrn_print_percent (char *, SLscroll_Window_Type *, int);
40 
41 typedef char *(PRINTF_CB)(char, void *, int *, int *);
42 extern void slrn_custom_printf (char *, PRINTF_CB, void *, int, int);
43 extern void slrn_write_nbytes (char *, unsigned int);
44 
45 extern int slrn_set_display_format (char **, unsigned int, char *);
46 extern unsigned int slrn_toggle_format (char **, unsigned int);
47 
48 extern FILE *slrn_open_home_file (char *, char *, char *, size_t, int);
49 extern VFILE *slrn_open_home_vfile (char *, char *, size_t);
50 extern void slrn_suspend_cmd (void);
51 extern int slrn_read_artnum_int (char *, NNTP_Artnum_Type *, NNTP_Artnum_Type *);
52 extern int slrn_read_input (char *, char *, char *, int, int);
53 extern int slrn_read_input_no_echo (char *, char *, char *, int, int);
54 extern int slrn_read_filename (char *, char *, char *, int, int);
55 extern int slrn_read_variable (char *, char *, char *, int, int);
56 extern void slrn_evaluate_cmd (void);
57 extern void slrn_update_top_status_line (void);
58 extern void slrn_set_color (int);
59 extern char slrn_map_translated_char (char *, char *, char);
60 extern char slrn_get_response (char *, char *, char *str, ...) ATTRIBUTE_PRINTF(3,4);
61 extern int slrn_is_fqdn (char *);
62 extern int slrn_init_readline (void);
63 extern int slrn_check_batch (void);
64 
65 extern unsigned char *slrn_regexp_match (SLRegexp_Type *, char *);
66 extern SLRegexp_Type *slrn_compile_regexp_pattern (char *);
67 extern SLRegexp_Type *slrn_free_regexp (SLRegexp_Type *);
68 
69 #define MAX_HOST_NAME_LEN 256
70 typedef struct
71 {
72    char *realname;
73    char *username;
74    char *hostname;
75    char *replyto;
76    char *org;
77    char *followup_string;
78    char *followupto_string;
79    char *reply_string;
80    char *signature;
81 #if SLRN_HAS_CANLOCK
82    char *cancelsecret;
83 #endif
84    char *posting_host;		       /* FQDN or NULL */
85    char *login_name;
86 }
87 Slrn_User_Info_Type;
88 
89 extern Slrn_User_Info_Type Slrn_User_Info;
90 extern void slrn_get_user_info (void);
91 extern int slrn_edit_file (char *, char *, unsigned int, int);
92 extern  int slrn_mail_file (char *, int, unsigned int, char *, char *);
93 
94 extern void slrn_article_help (void);
95 extern void slrn_group_help (void);
96 
97 /* Both of these must be malloced strings */
98 void slrn_set_input_string (char *);
99 void slrn_set_input_chars (char *);
100 
101 extern int Slrn_Message_Present;
102 
103 #define SLRN_CONFIRM_CATCHUP	0x01
104 #define SLRN_CONFIRM_PRINT	0x02
105 #define SLRN_CONFIRM_POST	0x04
106 #define SLRN_CONFIRM_URL	0x08
107 #define SLRN_CONFIRM_QUIT	0x10
108 #define SLRN_CONFIRM_ALL	0xFF
109 extern int Slrn_User_Wants_Confirmation;
110 extern void slrn_get_mouse_rc (int *, int *);
111 #ifndef VMS
112 extern char *Slrn_SendMail_Command;
113 #endif
114 
115 #if SLANG_VERSION < 20000
116 extern int SLang_get_error (void);
117 extern int SLang_set_error (int);
118 typedef struct SLKeyMap_List_Type SLkeymap_Type;
119 typedef SLang_RLine_Info_Type SLrline_Type;
120 extern SLkeymap_Type *SLrline_get_keymap (SLrline_Type *);
121 typedef unsigned char SLuchar_Type;
122 #endif
123 
124 extern SLKeyMap_List_Type *Slrn_RLine_Keymap;
125 extern SLang_RLine_Info_Type *Slrn_Keymap_RLI;
126 extern int slrn_rline_setkey (char *, char *, SLkeymap_Type *);
127 
128 extern void slrn_va_message (char *, va_list);
129 
130 #if SLRN_HAS_PIPING
131 extern int _slrn_pclose (FILE *);
132 #endif
133 extern FILE *slrn_popen (char *, char *);
134 extern int slrn_pclose (FILE *);
135 
136 extern int Slrn_Use_Tmpdir;
137 extern FILE *slrn_open_tmpfile_in_dir (char *, char *, size_t);
138 extern FILE *slrn_open_tmpfile (char *, size_t);
139 
140 extern int slrn_posix_system (char *, int);
141 extern char *Slrn_Editor;
142 extern char *Slrn_Editor_Post;
143 extern char *Slrn_Editor_Score;
144 extern char *Slrn_Editor_Mail;
145 extern int Slrn_Editor_Uses_Mime_Charset;
146 extern int Slrn_Mail_Editor_Is_Mua;
147 
148 extern char *Slrn_Failed_Post_Filename;
149 
150 extern char *Slrn_Top_Status_Line;
151 
152 extern int Slrn_Abort_Unmodified;
153 
154 #endif				       /* _SLRN_MISC_H */
155