1 /* util.h
2  */
3 /* This software is copyrighted as detailed in the LICENSE file. */
4 
5 
6 EXT bool waiting INIT(FALSE);  	/* waiting for subprocess (in doshell)? */
7 EXT bool nowait_fork INIT(FALSE);
8 EXT bool export_nntp_fds INIT(FALSE);
9 
10 /* the strlen and the buffer length of "some_buf" after a call to:
11  *     some_buf = get_a_line(bufptr,bufsize,realloc,fp); */
12 EXT int len_last_line_got INIT(0);
13 EXT MEM_SIZE buflen_last_line_got INIT(0);
14 
15 #define AT_GREY_SPACE(s) ((*(Uchar*)(s) & 0x7F) <= ' ' || *(s) == '\177')
16 #define AT_NORM_CHAR(s)  ((*(Uchar*)(s) & 0x7F) >= ' ' && *(s) != '\177')
17 
18 /* is the string for makedir a directory name or a filename? */
19 
20 #define MD_DIR 	0
21 #define MD_FILE 1
22 
23 /* a template for parsing an ini file */
24 
25 struct ini_words {
26     int checksum;
27     char* item;
28     char* help_str;
29 };
30 
31 #define INI_LEN(words)         (words)[0].checksum
32 #define INI_VALUES(words)      ((char**)(words)[0].help_str)
33 #define INI_VALUE(words,num)   INI_VALUES(words)[num]
34 
35 #define safefree(ptr)  if (!ptr) ; else free((char*)(ptr))
36 #define safefree0(ptr)  if (!ptr) ; else free((char*)(ptr)), (ptr)=0
37 
38 /* DON'T EDIT BELOW THIS LINE OR YOUR CHANGES WILL BE LOST! */
39 
40 void util_init _((void));
41 int doshell _((char*,char*));
42 #ifndef USE_DEBUGGING_MALLOC
43 char* safemalloc _((MEM_SIZE));
44 char* saferealloc _((char*,MEM_SIZE));
45 #endif
46 char* safecat _((char*,char*,int));
47 #ifdef SETUIDGID
48 int eaccess _((char*,int));
49 #endif
50 char* trn_getwd _((char*,int));
51 char* get_a_line _((char*,int,bool_int,FILE*));
52 int makedir _((char*,int));
53 void notincl _((char*));
54 void growstr _((char**,int*,int));
55 void setdef _((char*,char*));
56 #ifndef NO_FILELINKS
57 void safelink _((char*,char*));
58 #endif
59 #ifndef HAS_STRSTR
60 char* trn_strstr _((char*,char*));
61 #endif
62 void verify_sig _((void));
63 double current_time _((void));
64 time_t text2secs _((char*,time_t));
65 char* secs2text _((time_t));
66 char* temp_filename _((void));
67 #ifdef SUPPORT_NNTP
68 char* get_auth_user _((void));
69 char* get_auth_pass _((void));
70 #endif
71 #if defined(USE_GENAUTH) && defined(SUPPORT_NNTP)
72 char* get_auth_command _((void));
73 #endif
74 char** prep_ini_words _((INI_WORDS*));
75 void unprep_ini_words _((INI_WORDS*));
76 void prep_ini_data _((char*,char*));
77 bool parse_string _((char**,char**));
78 char* next_ini_section _((char*,char**,char**));
79 char* parse_ini_section _((char*,INI_WORDS*));
80 bool check_ini_cond _((char*));
81 char menu_get_char _((void));
82 int edit_file _((char*));
83