xref: /netbsd-src/usr.bin/ftp/extern.h (revision a3dc48d868d4b81d0d2ae6392515e483260b2252)
1 /*	$NetBSD: extern.h,v 1.84 2024/10/04 18:06:53 christos Exp $	*/
2 
3 /*-
4  * Copyright (c) 1996-2023 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Luke Mewburn.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /*-
33  * Copyright (c) 1994 The Regents of the University of California.
34  * All rights reserved.
35  *
36  * Redistribution and use in source and binary forms, with or without
37  * modification, are permitted provided that the following conditions
38  * are met:
39  * 1. Redistributions of source code must retain the above copyright
40  *    notice, this list of conditions and the following disclaimer.
41  * 2. Redistributions in binary form must reproduce the above copyright
42  *    notice, this list of conditions and the following disclaimer in the
43  *    documentation and/or other materials provided with the distribution.
44  * 3. Neither the name of the University nor the names of its contributors
45  *    may be used to endorse or promote products derived from this software
46  *    without specific prior written permission.
47  *
48  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58  * SUCH DAMAGE.
59  *
60  *	@(#)extern.h	8.3 (Berkeley) 10/9/94
61  */
62 
63 /*
64  * Copyright (C) 1997 and 1998 WIDE Project.
65  * All rights reserved.
66  *
67  * Redistribution and use in source and binary forms, with or without
68  * modification, are permitted provided that the following conditions
69  * are met:
70  * 1. Redistributions of source code must retain the above copyright
71  *    notice, this list of conditions and the following disclaimer.
72  * 2. Redistributions in binary form must reproduce the above copyright
73  *    notice, this list of conditions and the following disclaimer in the
74  *    documentation and/or other materials provided with the distribution.
75  * 3. Neither the name of the project nor the names of its contributors
76  *    may be used to endorse or promote products derived from this software
77  *    without specific prior written permission.
78  *
79  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
80  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
81  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
82  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
83  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
84  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
85  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
86  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
87  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
88  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
89  * SUCH DAMAGE.
90  */
91 
92 struct sockaddr;
93 struct tm;
94 struct addrinfo;
95 
96 void	abort_remote(FILE *);
97 void	account(int, char **);
98 void	ai_unmapped(struct addrinfo *);
99 int	another(int *, char ***, const char *);
100 int	auto_fetch(int, char **);
101 int	auto_put(int, char **, const char *);
102 void	blkfree(char **);
103 void	cd(int, char **);
104 void	cdup(int, char **);
105 void	changetype(int, int);
106 void	cleanuppeer(void);
107 void	cmdabort(int);
108 void	cmdtimeout(int);
109 void	cmdscanner(void);
110 int	command(const char *, ...)
111      __attribute__((__format__(__printf__, 1, 2)));
112 #ifndef NO_EDITCOMPLETE
113 unsigned char complete(EditLine *, int);
114 void	controlediting(void);
115 #endif /* !NO_EDITCOMPLETE */
116 void	crankrate(int);
117 FILE   *dataconn(const char *);
118 void	delete(int, char **);
119 void	disconnect(int, char **);
120 void	do_chmod(int, char **);
121 void	do_umask(int, char **);
122 void	domacro(int, char **);
123 void	doproxy(int, char **);
124 void	feat(int, char **);
125 void	fget(int, char **);
126 int	fileindir(const char *, const char *);
127 int	foregroundproc(void);
128 void	formatbuf(char *, size_t, const char *);
129 void	ftpvis(char *, size_t, const char *, size_t);
130 int	ftp_login(const char *, const char *, const char *);
131 void	get(int, char **);
132 struct cmd *getcmd(const char *);
133 int	getit(int, char **, int, const char *);
134 int	get_line(FILE *, char *, size_t, const char **);
135 struct option *getoption(const char *);
136 char   *getoptionvalue(const char *);
137 void	getremoteinfo(void);
138 int	getreply(int);
139 char   *globulize(const char *);
140 char   *gunique(char *);
141 void	help(int, char **);
142 char   *hookup(const char *, const char *);
143 void	idlecmd(int, char **);
144 int	initconn(void);
145 __dead void	intr(int);
146 int	isipv6addr(const char *);
147 void	list_vertical(StringList *);
148 void	lcd(int, char **);
149 void	lostpeer(int);
150 void	lpage(int, char **);
151 void	lpwd(int, char **);
152 void	ls(int, char **);
153 void	macdef(int, char **);
154 void	makeargv(void);
155 void	makedir(int, char **);
156 void	mdelete(int, char **);
157 void	mget(int, char **);
158 void	mls(int, char **);
159 void	mlst(int, char **);
160 void	modtime(int, char **);
161 void	mput(int, char **);
162 const char *onoff(int);
163 void	opts(int, char **);
164 void	newer(int, char **);
165 void	page(int, char **);
166 const char *parse_rfc2616time(struct tm *, const char *);
167 int	parserate(int, char **, int);
168 char   *prompt(void);
169 __dead void	proxabort(int);
170 void	proxtrans(const char *, const char *, const char *);
171 void	psabort(int);
172 void	pswitch(int);
173 void	put(int, char **);
174 void	pwd(int, char **);
175 void	quit(int, char **);
176 void	justquit(void) __dead;
177 void	quote(int, char **);
178 void	quote1(const char *, int, char **);
179 void	recvrequest(const char *, char *, const char *,
180 	    const char *, int, int);
181 void	reget(int, char **);
182 char   *remglob(char **, int, const char **);
183 time_t	remotemodtime(const char *, int);
184 off_t	remotesize(const char *, int);
185 void	removedir(int, char **);
186 void	renamefile(int, char **);
187 void	reset(int, char **);
188 void	restart(int, char **);
189 const char *rfc2822time(const struct tm *);
190 void	rmthelp(int, char **);
191 void	rmtstatus(int, char **);
192 char   *rprompt(void);
193 int	ruserpass(const char *, char **, char **, char **);
194 void	sendrequest(const char *, const char *, const char *, int);
195 void	setascii(int, char **);
196 void	setbell(int, char **);
197 void	setbinary(int, char **);
198 void	setcase(int, char **);
199 void	setcr(int, char **);
200 void	setdebug(int, char **);
201 void	setedit(int, char **);
202 void	setepsv4(int, char **);
203 void	setepsv6(int, char **);
204 void	setepsv(int, char **);
205 void	setform(int, char **);
206 void	setftmode(int, char **);
207 void	setgate(int, char **);
208 void	setglob(int, char **);
209 void	sethash(int, char **);
210 void	setnmap(int, char **);
211 void	setntrans(int, char **);
212 void	setoption(int, char **);
213 void	setpassive(int, char **);
214 void	setpeer(int, char **);
215 void	setport(int, char **);
216 void	setpreserve(int, char **);
217 void	setprogress(int, char **);
218 void	setprompt(int, char **);
219 void	setrate(int, char **);
220 void	setrunique(int, char **);
221 void	setstruct(int, char **);
222 void	setsunique(int, char **);
223 void	settenex(int, char **);
224 void	settrace(int, char **);
225 void	setttywidth(int);
226 void	settype(int, char **);
227 void	setupsockbufsize(int);
228 void	setverbose(int, char **);
229 void	setxferbuf(int, char **);
230 void	set_option(const char *, const char *, int);
231 void	shell(int, char **);
232 void	site(int, char **);
233 void	sizecmd(int, char **);
234 char   *slurpstring(void);
235 void	status(int, char **);
236 int	strsuftoi(const char *);
237 void	syst(int, char **);
238 int	togglevar(int, char **, int *, const char *);
239 void	unsetoption(int, char **);
240 void	updatelocalcwd(void);
241 void	updateremotecwd(void);
242 void	user(int, char **);
243 int	ftp_connect(int, const struct sockaddr *, socklen_t, int);
244 int	ftp_listen(int, int);
245 int	ftp_poll(struct pollfd *, int, int);
246 int	ftp_truthy(const char *, const char *, int);
247 #ifndef SMALL
248 void   *ftp_malloc(size_t);
249 StringList *ftp_sl_init(void);
250 void	ftp_sl_add(StringList *, char *);
251 char   *ftp_strdup(const char *);
252 #else
253 #define	ftp_malloc(a)	malloc(a);
254 #define ftp_sl_init()	sl_init()
255 #define ftp_sl_add(a, b)	sl_add((a), (b))
256 #define ftp_strdup(a)	strdup(a)
257 #endif
258