source: trunk/essentials/net-misc/wget/src/utils.h

Last change on this file was 3440, checked in by bird, 18 years ago

wget 1.10.2

File size: 4.3 KB
Line 
1/* Declarations for utils.c.
2 Copyright (C) 2005 Free Software Foundation, Inc.
3
4This file is part of GNU Wget.
5
6GNU Wget is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11GNU Wget is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with Wget; if not, write to the Free Software
18Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20In addition, as a special exception, the Free Software Foundation
21gives permission to link the code of its release of Wget with the
22OpenSSL project's "OpenSSL" library (or with modified versions of it
23that use the same license as the "OpenSSL" library), and distribute
24the linked executables. You must obey the GNU General Public License
25in all respects for all of the code used other than "OpenSSL". If you
26modify this file, you may extend this exception to your version of the
27file, but you are not obligated to do so. If you do not wish to do
28so, delete this exception statement from your version. */
29
30#ifndef UTILS_H
31#define UTILS_H
32
33enum accd {
34 ALLABS = 1
35};
36
37struct hash_table;
38
39struct file_memory {
40 char *content;
41 long length;
42 int mmap_p;
43};
44
45#define HYPHENP(x) (*(x) == '-' && !*((x) + 1))
46
47char *time_str PARAMS ((time_t *));
48char *datetime_str PARAMS ((time_t *));
49
50#ifdef DEBUG_MALLOC
51void print_malloc_debug_stats ();
52#endif
53
54char *xstrdup_lower PARAMS ((const char *));
55
56char *strdupdelim PARAMS ((const char *, const char *));
57char **sepstring PARAMS ((const char *));
58int frontcmp PARAMS ((const char *, const char *));
59void fork_to_background PARAMS ((void));
60
61#ifdef WGET_USE_STDARG
62char *aprintf PARAMS ((const char *, ...))
63 GCC_FORMAT_ATTR (1, 2);
64char *concat_strings PARAMS ((const char *, ...));
65#else /* not WGET_USE_STDARG */
66char *aprintf ();
67char *concat_strings ();
68#endif /* not WGET_USE_STDARG */
69
70void touch PARAMS ((const char *, time_t));
71int remove_link PARAMS ((const char *));
72int file_exists_p PARAMS ((const char *));
73int file_non_directory_p PARAMS ((const char *));
74wgint file_size PARAMS ((const char *));
75int make_directory PARAMS ((const char *));
76char *unique_name PARAMS ((const char *, int));
77FILE *unique_create PARAMS ((const char *, int, char **));
78FILE *fopen_excl PARAMS ((const char *, int));
79char *file_merge PARAMS ((const char *, const char *));
80
81int acceptable PARAMS ((const char *));
82int accdir PARAMS ((const char *s, enum accd));
83char *suffix PARAMS ((const char *s));
84int match_tail PARAMS ((const char *, const char *, int));
85int has_wildcards_p PARAMS ((const char *));
86
87int has_html_suffix_p PARAMS ((const char *));
88
89char *read_whole_line PARAMS ((FILE *));
90struct file_memory *read_file PARAMS ((const char *));
91void read_file_free PARAMS ((struct file_memory *));
92
93void free_vec PARAMS ((char **));
94char **merge_vecs PARAMS ((char **, char **));
95char **vec_append PARAMS ((char **, const char *));
96
97void string_set_add PARAMS ((struct hash_table *, const char *));
98int string_set_contains PARAMS ((struct hash_table *, const char *));
99void string_set_to_array PARAMS ((struct hash_table *, char **));
100void string_set_free PARAMS ((struct hash_table *));
101void free_keys_and_values PARAMS ((struct hash_table *));
102
103char *with_thousand_seps PARAMS ((wgint));
104#ifndef with_thousand_seps_sum
105char *with_thousand_seps_sum PARAMS ((SUM_SIZE_INT));
106#endif
107char *human_readable PARAMS ((wgint));
108int numdigit PARAMS ((wgint));
109char *number_to_string PARAMS ((char *, wgint));
110char *number_to_static_string PARAMS ((wgint));
111
112int determine_screen_width PARAMS ((void));
113int random_number PARAMS ((int));
114double random_float PARAMS ((void));
115
116int run_with_timeout PARAMS ((double, void (*) (void *), void *));
117void xsleep PARAMS ((double));
118
119/* How many bytes it will take to store LEN bytes in base64. */
120#define BASE64_LENGTH(len) (4 * (((len) + 2) / 3))
121
122int base64_encode PARAMS ((const char *, int, char *));
123int base64_decode PARAMS ((const char *, char *));
124
125void stable_sort PARAMS ((void *, size_t, size_t,
126 int (*) (const void *, const void *)));
127
128#endif /* UTILS_H */
Note: See TracBrowser for help on using the repository browser.