]> sjero.net Git - wget/blob - src/utils.h
[svn] New function xsleep that resumes sleeps interrupted by signals
[wget] / src / utils.h
1 /* Declarations for utils.c.
2    Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
3
4 This file is part of GNU Wget.
5
6 GNU Wget is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 GNU Wget is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Wget; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20 In addition, as a special exception, the Free Software Foundation
21 gives permission to link the code of its release of Wget with the
22 OpenSSL project's "OpenSSL" library (or with modified versions of it
23 that use the same license as the "OpenSSL" library), and distribute
24 the linked executables.  You must obey the GNU General Public License
25 in all respects for all of the code used other than "OpenSSL".  If you
26 modify this file, you may extend this exception to your version of the
27 file, but you are not obligated to do so.  If you do not wish to do
28 so, delete this exception statement from your version.  */
29
30 #ifndef UTILS_H
31 #define UTILS_H
32
33 enum accd {
34    ALLABS = 1
35 };
36
37 /* A linked list of strings.  The list is ordered alphabetically.  */
38 typedef struct _slist
39 {
40   char *string;
41   struct _slist *next;
42 } slist;
43
44 struct hash_table;
45
46 struct file_memory {
47   char *content;
48   long length;
49   int mmap_p;
50 };
51
52 #define HYPHENP(x) (*(x) == '-' && !*((x) + 1))
53
54 struct wget_timer;
55
56 char *time_str PARAMS ((time_t *));
57 char *datetime_str PARAMS ((time_t *));
58
59 #ifdef DEBUG_MALLOC
60 void print_malloc_debug_stats ();
61 #endif
62
63 char *xstrdup_lower PARAMS ((const char *));
64 int count_char PARAMS ((const char *, char));
65
66 char *strdupdelim PARAMS ((const char *, const char *));
67 char **sepstring PARAMS ((const char *));
68 int frontcmp PARAMS ((const char *, const char *));
69 void fork_to_background PARAMS ((void));
70
71 void touch PARAMS ((const char *, time_t));
72 int remove_link PARAMS ((const char *));
73 int file_exists_p PARAMS ((const char *));
74 int file_non_directory_p PARAMS ((const char *));
75 long file_size PARAMS ((const char *));
76 int make_directory PARAMS ((const char *));
77 char *unique_name PARAMS ((const char *, int));
78 char *file_merge PARAMS ((const char *, const char *));
79
80 int acceptable PARAMS ((const char *));
81 int accdir PARAMS ((const char *s, enum accd));
82 char *suffix PARAMS ((const char *s));
83 int match_tail PARAMS ((const char *, const char *, int));
84 int has_wildcards_p PARAMS ((const char *));
85
86 int has_html_suffix_p PARAMS ((const char *));
87
88 char *read_whole_line PARAMS ((FILE *));
89 struct file_memory *read_file PARAMS ((const char *));
90 void read_file_free PARAMS ((struct file_memory *));
91
92 void free_vec PARAMS ((char **));
93 char **merge_vecs PARAMS ((char **, char **));
94 slist *slist_append PARAMS ((slist *, const char *));
95 slist *slist_prepend PARAMS ((slist *, const char *));
96 slist *slist_nreverse PARAMS ((slist *));
97 int slist_contains PARAMS ((slist *, const char *));
98 void slist_free PARAMS ((slist *));
99
100 void string_set_add PARAMS ((struct hash_table *, const char *));
101 int string_set_contains PARAMS ((struct hash_table *, const char *));
102 void string_set_free PARAMS ((struct hash_table *));
103 void free_keys_and_values PARAMS ((struct hash_table *));
104
105 char *legible PARAMS ((long));
106 char *legible_large_int PARAMS ((LARGE_INT));
107 int numdigit PARAMS ((long));
108 char *number_to_string PARAMS ((char *, long));
109
110 struct wget_timer *wtimer_allocate PARAMS ((void));
111 struct wget_timer *wtimer_new PARAMS ((void));
112 void wtimer_delete PARAMS ((struct wget_timer *));
113 void wtimer_reset PARAMS ((struct wget_timer *));
114 double wtimer_elapsed PARAMS ((struct wget_timer *));
115 double wtimer_granularity PARAMS ((void));
116
117 char *html_quote_string PARAMS ((const char *));
118
119 int determine_screen_width PARAMS ((void));
120 int random_number PARAMS ((int));
121 double random_float PARAMS ((void));
122
123 int run_with_timeout PARAMS ((double, void (*) (void *), void *));
124 void xsleep PARAMS ((double));
125
126 #endif /* UTILS_H */