ftp_var.h revision 1.75.6.2 1 1.75.6.2 lukem /* $NetBSD: ftp_var.h,v 1.75.6.2 2007/07/22 05:02:51 lukem Exp $ */
2 1.75.6.2 lukem
3 1.75.6.2 lukem /*-
4 1.75.6.2 lukem * Copyright (c) 1996-2007 The NetBSD Foundation, Inc.
5 1.75.6.2 lukem * All rights reserved.
6 1.75.6.2 lukem *
7 1.75.6.2 lukem * This code is derived from software contributed to The NetBSD Foundation
8 1.75.6.2 lukem * by Luke Mewburn.
9 1.75.6.2 lukem *
10 1.75.6.2 lukem * Redistribution and use in source and binary forms, with or without
11 1.75.6.2 lukem * modification, are permitted provided that the following conditions
12 1.75.6.2 lukem * are met:
13 1.75.6.2 lukem * 1. Redistributions of source code must retain the above copyright
14 1.75.6.2 lukem * notice, this list of conditions and the following disclaimer.
15 1.75.6.2 lukem * 2. Redistributions in binary form must reproduce the above copyright
16 1.75.6.2 lukem * notice, this list of conditions and the following disclaimer in the
17 1.75.6.2 lukem * documentation and/or other materials provided with the distribution.
18 1.75.6.2 lukem * 3. All advertising materials mentioning features or use of this software
19 1.75.6.2 lukem * must display the following acknowledgement:
20 1.75.6.2 lukem * This product includes software developed by the NetBSD
21 1.75.6.2 lukem * Foundation, Inc. and its contributors.
22 1.75.6.2 lukem * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.75.6.2 lukem * contributors may be used to endorse or promote products derived
24 1.75.6.2 lukem * from this software without specific prior written permission.
25 1.75.6.2 lukem *
26 1.75.6.2 lukem * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.75.6.2 lukem * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.75.6.2 lukem * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.75.6.2 lukem * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.75.6.2 lukem * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.75.6.2 lukem * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.75.6.2 lukem * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.75.6.2 lukem * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.75.6.2 lukem * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.75.6.2 lukem * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.75.6.2 lukem * POSSIBILITY OF SUCH DAMAGE.
37 1.75.6.2 lukem */
38 1.75.6.2 lukem
39 1.75.6.2 lukem /*
40 1.75.6.2 lukem * Copyright (c) 1985, 1989, 1993, 1994
41 1.75.6.2 lukem * The Regents of the University of California. All rights reserved.
42 1.75.6.2 lukem *
43 1.75.6.2 lukem * Redistribution and use in source and binary forms, with or without
44 1.75.6.2 lukem * modification, are permitted provided that the following conditions
45 1.75.6.2 lukem * are met:
46 1.75.6.2 lukem * 1. Redistributions of source code must retain the above copyright
47 1.75.6.2 lukem * notice, this list of conditions and the following disclaimer.
48 1.75.6.2 lukem * 2. Redistributions in binary form must reproduce the above copyright
49 1.75.6.2 lukem * notice, this list of conditions and the following disclaimer in the
50 1.75.6.2 lukem * documentation and/or other materials provided with the distribution.
51 1.75.6.2 lukem * 3. Neither the name of the University nor the names of its contributors
52 1.75.6.2 lukem * may be used to endorse or promote products derived from this software
53 1.75.6.2 lukem * without specific prior written permission.
54 1.75.6.2 lukem *
55 1.75.6.2 lukem * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
56 1.75.6.2 lukem * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 1.75.6.2 lukem * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58 1.75.6.2 lukem * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
59 1.75.6.2 lukem * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
60 1.75.6.2 lukem * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
61 1.75.6.2 lukem * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
62 1.75.6.2 lukem * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
63 1.75.6.2 lukem * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
64 1.75.6.2 lukem * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65 1.75.6.2 lukem * SUCH DAMAGE.
66 1.75.6.2 lukem *
67 1.75.6.2 lukem * @(#)ftp_var.h 8.4 (Berkeley) 10/9/94
68 1.75.6.2 lukem */
69 1.75.6.2 lukem
70 1.75.6.2 lukem /*
71 1.75.6.2 lukem * Copyright (C) 1997 and 1998 WIDE Project.
72 1.75.6.2 lukem * All rights reserved.
73 1.75.6.2 lukem *
74 1.75.6.2 lukem * Redistribution and use in source and binary forms, with or without
75 1.75.6.2 lukem * modification, are permitted provided that the following conditions
76 1.75.6.2 lukem * are met:
77 1.75.6.2 lukem * 1. Redistributions of source code must retain the above copyright
78 1.75.6.2 lukem * notice, this list of conditions and the following disclaimer.
79 1.75.6.2 lukem * 2. Redistributions in binary form must reproduce the above copyright
80 1.75.6.2 lukem * notice, this list of conditions and the following disclaimer in the
81 1.75.6.2 lukem * documentation and/or other materials provided with the distribution.
82 1.75.6.2 lukem * 3. Neither the name of the project nor the names of its contributors
83 1.75.6.2 lukem * may be used to endorse or promote products derived from this software
84 1.75.6.2 lukem * without specific prior written permission.
85 1.75.6.2 lukem *
86 1.75.6.2 lukem * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
87 1.75.6.2 lukem * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
88 1.75.6.2 lukem * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
89 1.75.6.2 lukem * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
90 1.75.6.2 lukem * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
91 1.75.6.2 lukem * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
92 1.75.6.2 lukem * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
93 1.75.6.2 lukem * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
94 1.75.6.2 lukem * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
95 1.75.6.2 lukem * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
96 1.75.6.2 lukem * SUCH DAMAGE.
97 1.75.6.2 lukem */
98 1.75.6.2 lukem
99 1.75.6.2 lukem /*
100 1.75.6.2 lukem * FTP global variables.
101 1.75.6.2 lukem */
102 1.75.6.2 lukem
103 1.75.6.2 lukem #ifdef SMALL
104 1.75.6.2 lukem #undef NO_EDITCOMPLETE
105 1.75.6.2 lukem #define NO_EDITCOMPLETE
106 1.75.6.2 lukem #undef NO_PROGRESS
107 1.75.6.2 lukem #define NO_PROGRESS
108 1.75.6.2 lukem #endif
109 1.75.6.2 lukem
110 1.75.6.2 lukem #include <sys/param.h>
111 1.75.6.2 lukem
112 1.75.6.2 lukem #include <netinet/in.h>
113 1.75.6.2 lukem #include <arpa/inet.h>
114 1.75.6.2 lukem
115 1.75.6.2 lukem #include <poll.h>
116 1.75.6.2 lukem
117 1.75.6.2 lukem #include <setjmp.h>
118 1.75.6.2 lukem #include <stringlist.h>
119 1.75.6.2 lukem
120 1.75.6.2 lukem #ifndef NO_EDITCOMPLETE
121 1.75.6.2 lukem #include <histedit.h>
122 1.75.6.2 lukem #endif /* !NO_EDITCOMPLETE */
123 1.75.6.2 lukem
124 1.75.6.2 lukem #include "extern.h"
125 1.75.6.2 lukem #include "progressbar.h"
126 1.75.6.2 lukem
127 1.75.6.2 lukem /*
128 1.75.6.2 lukem * Format of command table.
129 1.75.6.2 lukem */
130 1.75.6.2 lukem struct cmd {
131 1.75.6.2 lukem char *c_name; /* name of command */
132 1.75.6.2 lukem const char *c_help; /* help string */
133 1.75.6.2 lukem char c_bell; /* give bell when command completes */
134 1.75.6.2 lukem char c_conn; /* must be connected to use command */
135 1.75.6.2 lukem char c_proxy; /* proxy server may execute */
136 1.75.6.2 lukem #ifndef NO_EDITCOMPLETE
137 1.75.6.2 lukem const char *c_complete; /* context sensitive completion list */
138 1.75.6.2 lukem #endif /* !NO_EDITCOMPLETE */
139 1.75.6.2 lukem void (*c_handler)(int, char **); /* function to call */
140 1.75.6.2 lukem };
141 1.75.6.2 lukem
142 1.75.6.2 lukem /*
143 1.75.6.2 lukem * Format of macro table
144 1.75.6.2 lukem */
145 1.75.6.2 lukem struct macel {
146 1.75.6.2 lukem char mac_name[9]; /* macro name */
147 1.75.6.2 lukem char *mac_start; /* start of macro in macbuf */
148 1.75.6.2 lukem char *mac_end; /* end of macro in macbuf */
149 1.75.6.2 lukem };
150 1.75.6.2 lukem
151 1.75.6.2 lukem /*
152 1.75.6.2 lukem * Format of option table
153 1.75.6.2 lukem */
154 1.75.6.2 lukem struct option {
155 1.75.6.2 lukem char *name;
156 1.75.6.2 lukem char *value;
157 1.75.6.2 lukem };
158 1.75.6.2 lukem
159 1.75.6.2 lukem /*
160 1.75.6.2 lukem * Indices to features[]; an array containing status of remote server
161 1.75.6.2 lukem * features; -1 not known (FEAT failed), 0 absent, 1 present.
162 1.75.6.2 lukem */
163 1.75.6.2 lukem enum {
164 1.75.6.2 lukem FEAT_FEAT = 0, /* FEAT, OPTS */
165 1.75.6.2 lukem FEAT_MDTM, /* MDTM */
166 1.75.6.2 lukem FEAT_MLST, /* MLSD, MLST */
167 1.75.6.2 lukem FEAT_REST_STREAM, /* RESTart STREAM */
168 1.75.6.2 lukem FEAT_SIZE, /* SIZE */
169 1.75.6.2 lukem FEAT_TVFS, /* TVFS (not used) */
170 1.75.6.2 lukem FEAT_max
171 1.75.6.2 lukem };
172 1.75.6.2 lukem
173 1.75.6.2 lukem
174 1.75.6.2 lukem /*
175 1.75.6.2 lukem * Global defines
176 1.75.6.2 lukem */
177 1.75.6.2 lukem #define FTPBUFLEN MAXPATHLEN + 200
178 1.75.6.2 lukem #define MAX_IN_PORT_T 0xffffU
179 1.75.6.2 lukem
180 1.75.6.2 lukem #define HASHBYTES 1024 /* default mark for `hash' command */
181 1.75.6.2 lukem #define DEFAULTINCR 1024 /* default increment for `rate' command */
182 1.75.6.2 lukem
183 1.75.6.2 lukem #define FTP_PORT 21 /* default if ! getservbyname("ftp/tcp") */
184 1.75.6.2 lukem #define HTTP_PORT 80 /* default if ! getservbyname("http/tcp") */
185 1.75.6.2 lukem #ifndef GATE_PORT
186 1.75.6.2 lukem #define GATE_PORT 21 /* default if ! getservbyname("ftpgate/tcp") */
187 1.75.6.2 lukem #endif
188 1.75.6.2 lukem #ifndef GATE_SERVER
189 1.75.6.2 lukem #define GATE_SERVER "" /* default server */
190 1.75.6.2 lukem #endif
191 1.75.6.2 lukem
192 1.75.6.2 lukem #define DEFAULTPAGER "more" /* default pager if $PAGER isn't set */
193 1.75.6.2 lukem #define DEFAULTPROMPT "ftp> " /* default prompt if `set prompt' is empty */
194 1.75.6.2 lukem #define DEFAULTRPROMPT "" /* default rprompt if `set rprompt' is empty */
195 1.75.6.2 lukem
196 1.75.6.2 lukem #define TMPFILE "ftpXXXXXXXXXX"
197 1.75.6.2 lukem
198 1.75.6.2 lukem
199 1.75.6.2 lukem #ifndef GLOBAL
200 1.75.6.2 lukem #define GLOBAL extern
201 1.75.6.2 lukem #endif
202 1.75.6.2 lukem
203 1.75.6.2 lukem /*
204 1.75.6.2 lukem * Options and other state info.
205 1.75.6.2 lukem */
206 1.75.6.2 lukem GLOBAL int trace; /* trace packets exchanged */
207 1.75.6.2 lukem GLOBAL int hash; /* print # for each buffer transferred */
208 1.75.6.2 lukem GLOBAL int mark; /* number of bytes between hashes */
209 1.75.6.2 lukem GLOBAL int sendport; /* use PORT/LPRT cmd for each data connection */
210 1.75.6.2 lukem GLOBAL int connected; /* 1 = connected to server, -1 = logged in */
211 1.75.6.2 lukem GLOBAL int interactive; /* interactively prompt on m* cmds */
212 1.75.6.2 lukem GLOBAL int confirmrest; /* confirm rest of current m* cmd */
213 1.75.6.2 lukem GLOBAL int ftp_debug; /* debugging level */
214 1.75.6.2 lukem GLOBAL int bell; /* ring bell on cmd completion */
215 1.75.6.2 lukem GLOBAL int doglob; /* glob local file names */
216 1.75.6.2 lukem GLOBAL int autologin; /* establish user account on connection */
217 1.75.6.2 lukem GLOBAL int proxy; /* proxy server connection active */
218 1.75.6.2 lukem GLOBAL int proxflag; /* proxy connection exists */
219 1.75.6.2 lukem GLOBAL int gatemode; /* use gate-ftp */
220 1.75.6.2 lukem GLOBAL char *gateserver; /* server to use for gate-ftp */
221 1.75.6.2 lukem GLOBAL int sunique; /* store files on server with unique name */
222 1.75.6.2 lukem GLOBAL int runique; /* store local files with unique name */
223 1.75.6.2 lukem GLOBAL int mcase; /* map upper to lower case for mget names */
224 1.75.6.2 lukem GLOBAL int ntflag; /* use ntin ntout tables for name translation */
225 1.75.6.2 lukem GLOBAL int mapflag; /* use mapin mapout templates on file names */
226 1.75.6.2 lukem GLOBAL int preserve; /* preserve modification time on files */
227 1.75.6.2 lukem GLOBAL int code; /* return/reply code for ftp command */
228 1.75.6.2 lukem GLOBAL int crflag; /* if 1, strip car. rets. on ascii gets */
229 1.75.6.2 lukem GLOBAL int passivemode; /* passive mode enabled */
230 1.75.6.2 lukem GLOBAL int activefallback; /* fall back to active mode if passive fails */
231 1.75.6.2 lukem GLOBAL char *altarg; /* argv[1] with no shell-like preprocessing */
232 1.75.6.2 lukem GLOBAL char ntin[17]; /* input translation table */
233 1.75.6.2 lukem GLOBAL char ntout[17]; /* output translation table */
234 1.75.6.2 lukem GLOBAL char mapin[MAXPATHLEN]; /* input map template */
235 1.75.6.2 lukem GLOBAL char mapout[MAXPATHLEN]; /* output map template */
236 1.75.6.2 lukem GLOBAL char typename[32]; /* name of file transfer type */
237 1.75.6.2 lukem GLOBAL int type; /* requested file transfer type */
238 1.75.6.2 lukem GLOBAL int curtype; /* current file transfer type */
239 1.75.6.2 lukem GLOBAL char structname[32]; /* name of file transfer structure */
240 1.75.6.2 lukem GLOBAL int stru; /* file transfer structure */
241 1.75.6.2 lukem GLOBAL char formname[32]; /* name of file transfer format */
242 1.75.6.2 lukem GLOBAL int form; /* file transfer format */
243 1.75.6.2 lukem GLOBAL char modename[32]; /* name of file transfer mode */
244 1.75.6.2 lukem GLOBAL int mode; /* file transfer mode */
245 1.75.6.2 lukem GLOBAL char bytename[32]; /* local byte size in ascii */
246 1.75.6.2 lukem GLOBAL int bytesize; /* local byte size in binary */
247 1.75.6.2 lukem GLOBAL int anonftp; /* automatic anonymous login */
248 1.75.6.2 lukem GLOBAL int dirchange; /* remote directory changed by cd command */
249 1.75.6.2 lukem GLOBAL int flushcache; /* set HTTP cache flush headers with request */
250 1.75.6.2 lukem GLOBAL int rate_get; /* maximum get xfer rate */
251 1.75.6.2 lukem GLOBAL int rate_get_incr; /* increment for get xfer rate */
252 1.75.6.2 lukem GLOBAL int rate_put; /* maximum put xfer rate */
253 1.75.6.2 lukem GLOBAL int rate_put_incr; /* increment for put xfer rate */
254 1.75.6.2 lukem GLOBAL int retry_connect; /* seconds between retrying connection */
255 1.75.6.2 lukem GLOBAL char *tmpdir; /* temporary directory */
256 1.75.6.2 lukem GLOBAL int epsv4; /* use EPSV/EPRT on IPv4 connections */
257 1.75.6.2 lukem GLOBAL int epsv4bad; /* EPSV doesn't work on the current server */
258 1.75.6.2 lukem GLOBAL int editing; /* command line editing enabled */
259 1.75.6.2 lukem GLOBAL int features[FEAT_max]; /* remote FEATures supported */
260 1.75.6.2 lukem
261 1.75.6.2 lukem #ifndef NO_EDITCOMPLETE
262 1.75.6.2 lukem GLOBAL EditLine *el; /* editline(3) status structure */
263 1.75.6.2 lukem GLOBAL History *hist; /* editline(3) history structure */
264 1.75.6.2 lukem GLOBAL char *cursor_pos; /* cursor position we're looking for */
265 1.75.6.2 lukem GLOBAL size_t cursor_argc; /* location of cursor in margv */
266 1.75.6.2 lukem GLOBAL size_t cursor_argo; /* offset of cursor in margv[cursor_argc] */
267 1.75.6.2 lukem #endif /* !NO_EDITCOMPLETE */
268 1.75.6.2 lukem
269 1.75.6.2 lukem GLOBAL char *direction; /* direction transfer is occurring */
270 1.75.6.2 lukem
271 1.75.6.2 lukem GLOBAL char *hostname; /* name of host connected to */
272 1.75.6.2 lukem GLOBAL int unix_server; /* server is unix, can use binary for ascii */
273 1.75.6.2 lukem GLOBAL int unix_proxy; /* proxy is unix, can use binary for ascii */
274 1.75.6.2 lukem GLOBAL char localcwd[MAXPATHLEN]; /* local dir */
275 1.75.6.2 lukem GLOBAL char remotecwd[MAXPATHLEN]; /* remote dir */
276 1.75.6.2 lukem GLOBAL char *username; /* name of user logged in as. (dynamic) */
277 1.75.6.2 lukem
278 1.75.6.2 lukem GLOBAL sa_family_t family; /* address family to use for connections */
279 1.75.6.2 lukem GLOBAL char *ftpport; /* port number to use for FTP connections */
280 1.75.6.2 lukem GLOBAL char *httpport; /* port number to use for HTTP connections */
281 1.75.6.2 lukem GLOBAL char *gateport; /* port number to use for gateftp connections */
282 1.75.6.2 lukem GLOBAL struct addrinfo *bindai; /* local address to bind as */
283 1.75.6.2 lukem
284 1.75.6.2 lukem GLOBAL char *outfile; /* filename to output URLs to */
285 1.75.6.2 lukem GLOBAL int restartautofetch; /* restart auto-fetch */
286 1.75.6.2 lukem
287 1.75.6.2 lukem GLOBAL char line[FTPBUFLEN]; /* input line buffer */
288 1.75.6.2 lukem GLOBAL char *stringbase; /* current scan point in line buffer */
289 1.75.6.2 lukem GLOBAL char argbuf[FTPBUFLEN]; /* argument storage buffer */
290 1.75.6.2 lukem GLOBAL char *argbase; /* current storage point in arg buffer */
291 1.75.6.2 lukem GLOBAL StringList *marg_sl; /* stringlist containing margv */
292 1.75.6.2 lukem GLOBAL int margc; /* count of arguments on input line */
293 1.75.6.2 lukem #define margv (marg_sl->sl_str) /* args parsed from input line */
294 1.75.6.2 lukem GLOBAL int cpend; /* flag: if != 0, then pending server reply */
295 1.75.6.2 lukem GLOBAL int mflag; /* flag: if != 0, then active multi command */
296 1.75.6.2 lukem
297 1.75.6.2 lukem GLOBAL int options; /* used during socket creation */
298 1.75.6.2 lukem
299 1.75.6.2 lukem GLOBAL int sndbuf_size; /* socket send buffer size */
300 1.75.6.2 lukem GLOBAL int rcvbuf_size; /* socket receive buffer size */
301 1.75.6.2 lukem
302 1.75.6.2 lukem GLOBAL int macnum; /* number of defined macros */
303 1.75.6.2 lukem GLOBAL struct macel macros[16];
304 1.75.6.2 lukem GLOBAL char macbuf[4096];
305 1.75.6.2 lukem
306 1.75.6.2 lukem GLOBAL char *localhome; /* local home directory */
307 1.75.6.2 lukem GLOBAL char *localname; /* local user name */
308 1.75.6.2 lukem GLOBAL char netrc[MAXPATHLEN]; /* path to .netrc file */
309 1.75.6.2 lukem GLOBAL char reply_string[BUFSIZ]; /* first line of previous reply */
310 1.75.6.2 lukem GLOBAL void (*reply_callback)(const char *);
311 1.75.6.2 lukem /*
312 1.75.6.2 lukem * function to call for each line in
313 1.75.6.2 lukem * the server's reply except for the
314 1.75.6.2 lukem * first (`xxx-') and last (`xxx ')
315 1.75.6.2 lukem */
316 1.75.6.2 lukem
317 1.75.6.2 lukem GLOBAL volatile sig_atomic_t sigint_raised;
318 1.75.6.2 lukem
319 1.75.6.2 lukem GLOBAL FILE *cin;
320 1.75.6.2 lukem GLOBAL FILE *cout;
321 1.75.6.2 lukem GLOBAL int data;
322 1.75.6.2 lukem
323 1.75.6.2 lukem extern struct cmd cmdtab[];
324 1.75.6.2 lukem extern struct option optiontab[];
325 1.75.6.2 lukem
326 1.75.6.2 lukem
327 1.75.6.2 lukem #define EMPTYSTRING(x) ((x) == NULL || (*(x) == '\0'))
328 1.75.6.2 lukem #define FREEPTR(x) if ((x) != NULL) { free(x); (x) = NULL; }
329 1.75.6.2 lukem
330 1.75.6.2 lukem #ifdef BSD4_4
331 1.75.6.2 lukem # define HAVE_STRUCT_SOCKADDR_SA_LEN 1
332 1.75.6.2 lukem #endif
333 1.75.6.2 lukem
334 1.75.6.2 lukem #ifdef NO_LONG_LONG
335 1.75.6.2 lukem # define STRTOLL(x,y,z) strtol(x,y,z)
336 1.75.6.2 lukem #else
337 1.75.6.2 lukem # define STRTOLL(x,y,z) strtoll(x,y,z)
338 1.75.6.2 lukem #endif
339 1.75.6.2 lukem
340 1.75.6.2 lukem #ifdef NO_DEBUG
341 1.75.6.2 lukem #define DPRINTF(...)
342 1.75.6.2 lukem #define DWARN(...)
343 1.75.6.2 lukem #else
344 1.75.6.2 lukem #define DPRINTF(...) if (ftp_debug) (void)fprintf(ttyout, __VA_ARGS__)
345 1.75.6.2 lukem #define DWARN(...) if (ftp_debug) warn(__VA_ARGS__)
346 1.75.6.2 lukem #endif
347 1.75.6.2 lukem
348 1.75.6.2 lukem #ifdef NO_USAGE
349 1.75.6.2 lukem void xusage(void);
350 1.75.6.2 lukem #define UPRINTF(...) xusage()
351 1.75.6.2 lukem #else
352 1.75.6.2 lukem #define UPRINTF(...) (void)fprintf(ttyout, __VA_ARGS__)
353 1.75.6.2 lukem #endif
354