Deleted Added
full compact
ftp_var.h (223308) ftp_var.h (223328)
1/* $NetBSD: ftp_var.h,v 1.71 2005/04/11 01:49:31 lukem Exp $ */
1/* $NetBSD: ftp_var.h,v 1.10 2009/05/20 12:53:47 lukem Exp $ */
2/* from NetBSD: ftp_var.h,v 1.81 2009/04/12 10:18:52 lukem Exp */
2
3/*-
3
4/*-
4 * Copyright (c) 1996-2005 The NetBSD Foundation, Inc.
5 * Copyright (c) 1996-2009 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.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Luke Mewburn.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS

--- 69 unchanged lines hidden (view full) ---

102
103#ifdef SMALL
104#undef NO_EDITCOMPLETE
105#define NO_EDITCOMPLETE
106#undef NO_PROGRESS
107#define NO_PROGRESS
108#endif
109
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS

--- 69 unchanged lines hidden (view full) ---

96
97#ifdef SMALL
98#undef NO_EDITCOMPLETE
99#define NO_EDITCOMPLETE
100#undef NO_PROGRESS
101#define NO_PROGRESS
102#endif
103
104#if 0 /* tnftp */
105
110#include <sys/param.h>
111
112#include <netinet/in.h>
113#include <arpa/inet.h>
114
115#include <poll.h>
116
117#include <setjmp.h>
118#include <stringlist.h>
119
106#include <sys/param.h>
107
108#include <netinet/in.h>
109#include <arpa/inet.h>
110
111#include <poll.h>
112
113#include <setjmp.h>
114#include <stringlist.h>
115
116#endif /* tnftp */
117
120#ifndef NO_EDITCOMPLETE
121#include <histedit.h>
122#endif /* !NO_EDITCOMPLETE */
123
124#include "extern.h"
125#include "progressbar.h"
126
127/*
128 * Format of command table.
129 */
130struct cmd {
118#ifndef NO_EDITCOMPLETE
119#include <histedit.h>
120#endif /* !NO_EDITCOMPLETE */
121
122#include "extern.h"
123#include "progressbar.h"
124
125/*
126 * Format of command table.
127 */
128struct cmd {
131 char *c_name; /* name of command */
129 const char *c_name; /* name of command */
132 const char *c_help; /* help string */
133 char c_bell; /* give bell when command completes */
134 char c_conn; /* must be connected to use command */
135 char c_proxy; /* proxy server may execute */
136#ifndef NO_EDITCOMPLETE
137 const char *c_complete; /* context sensitive completion list */
138#endif /* !NO_EDITCOMPLETE */
139 void (*c_handler)(int, char **); /* function to call */
140};
141
130 const char *c_help; /* help string */
131 char c_bell; /* give bell when command completes */
132 char c_conn; /* must be connected to use command */
133 char c_proxy; /* proxy server may execute */
134#ifndef NO_EDITCOMPLETE
135 const char *c_complete; /* context sensitive completion list */
136#endif /* !NO_EDITCOMPLETE */
137 void (*c_handler)(int, char **); /* function to call */
138};
139
140#define MAX_C_NAME 12 /* maximum length of cmd.c_name */
141
142/*
143 * Format of macro table
144 */
145struct macel {
146 char mac_name[9]; /* macro name */
147 char *mac_start; /* start of macro in macbuf */
148 char *mac_end; /* end of macro in macbuf */
149};
150
151/*
152 * Format of option table
153 */
154struct option {
142/*
143 * Format of macro table
144 */
145struct macel {
146 char mac_name[9]; /* macro name */
147 char *mac_start; /* start of macro in macbuf */
148 char *mac_end; /* end of macro in macbuf */
149};
150
151/*
152 * Format of option table
153 */
154struct option {
155 char *name;
156 char *value;
155 const char *name;
156 char *value;
157};
158
159/*
160 * Indices to features[]; an array containing status of remote server
161 * features; -1 not known (FEAT failed), 0 absent, 1 present.
162 */
163enum {
164 FEAT_FEAT = 0, /* FEAT, OPTS */

--- 40 unchanged lines hidden (view full) ---

205 */
206GLOBAL int trace; /* trace packets exchanged */
207GLOBAL int hash; /* print # for each buffer transferred */
208GLOBAL int mark; /* number of bytes between hashes */
209GLOBAL int sendport; /* use PORT/LPRT cmd for each data connection */
210GLOBAL int connected; /* 1 = connected to server, -1 = logged in */
211GLOBAL int interactive; /* interactively prompt on m* cmds */
212GLOBAL int confirmrest; /* confirm rest of current m* cmd */
157};
158
159/*
160 * Indices to features[]; an array containing status of remote server
161 * features; -1 not known (FEAT failed), 0 absent, 1 present.
162 */
163enum {
164 FEAT_FEAT = 0, /* FEAT, OPTS */

--- 40 unchanged lines hidden (view full) ---

205 */
206GLOBAL int trace; /* trace packets exchanged */
207GLOBAL int hash; /* print # for each buffer transferred */
208GLOBAL int mark; /* number of bytes between hashes */
209GLOBAL int sendport; /* use PORT/LPRT cmd for each data connection */
210GLOBAL int connected; /* 1 = connected to server, -1 = logged in */
211GLOBAL int interactive; /* interactively prompt on m* cmds */
212GLOBAL int confirmrest; /* confirm rest of current m* cmd */
213GLOBAL int debug; /* debugging level */
213GLOBAL int ftp_debug; /* debugging level */
214GLOBAL int bell; /* ring bell on cmd completion */
215GLOBAL int doglob; /* glob local file names */
216GLOBAL int autologin; /* establish user account on connection */
217GLOBAL int proxy; /* proxy server connection active */
218GLOBAL int proxflag; /* proxy connection exists */
219GLOBAL int gatemode; /* use gate-ftp */
214GLOBAL int bell; /* ring bell on cmd completion */
215GLOBAL int doglob; /* glob local file names */
216GLOBAL int autologin; /* establish user account on connection */
217GLOBAL int proxy; /* proxy server connection active */
218GLOBAL int proxflag; /* proxy connection exists */
219GLOBAL int gatemode; /* use gate-ftp */
220GLOBAL char *gateserver; /* server to use for gate-ftp */
220GLOBAL const char *gateserver; /* server to use for gate-ftp */
221GLOBAL int sunique; /* store files on server with unique name */
222GLOBAL int runique; /* store local files with unique name */
223GLOBAL int mcase; /* map upper to lower case for mget names */
224GLOBAL int ntflag; /* use ntin ntout tables for name translation */
225GLOBAL int mapflag; /* use mapin mapout templates on file names */
226GLOBAL int preserve; /* preserve modification time on files */
227GLOBAL int code; /* return/reply code for ftp command */
228GLOBAL int crflag; /* if 1, strip car. rets. on ascii gets */

--- 18 unchanged lines hidden (view full) ---

247GLOBAL int anonftp; /* automatic anonymous login */
248GLOBAL int dirchange; /* remote directory changed by cd command */
249GLOBAL int flushcache; /* set HTTP cache flush headers with request */
250GLOBAL int rate_get; /* maximum get xfer rate */
251GLOBAL int rate_get_incr; /* increment for get xfer rate */
252GLOBAL int rate_put; /* maximum put xfer rate */
253GLOBAL int rate_put_incr; /* increment for put xfer rate */
254GLOBAL int retry_connect; /* seconds between retrying connection */
221GLOBAL int sunique; /* store files on server with unique name */
222GLOBAL int runique; /* store local files with unique name */
223GLOBAL int mcase; /* map upper to lower case for mget names */
224GLOBAL int ntflag; /* use ntin ntout tables for name translation */
225GLOBAL int mapflag; /* use mapin mapout templates on file names */
226GLOBAL int preserve; /* preserve modification time on files */
227GLOBAL int code; /* return/reply code for ftp command */
228GLOBAL int crflag; /* if 1, strip car. rets. on ascii gets */

--- 18 unchanged lines hidden (view full) ---

247GLOBAL int anonftp; /* automatic anonymous login */
248GLOBAL int dirchange; /* remote directory changed by cd command */
249GLOBAL int flushcache; /* set HTTP cache flush headers with request */
250GLOBAL int rate_get; /* maximum get xfer rate */
251GLOBAL int rate_get_incr; /* increment for get xfer rate */
252GLOBAL int rate_put; /* maximum put xfer rate */
253GLOBAL int rate_put_incr; /* increment for put xfer rate */
254GLOBAL int retry_connect; /* seconds between retrying connection */
255GLOBAL char *tmpdir; /* temporary directory */
255GLOBAL const char *tmpdir; /* temporary directory */
256GLOBAL int epsv4; /* use EPSV/EPRT on IPv4 connections */
257GLOBAL int epsv4bad; /* EPSV doesn't work on the current server */
256GLOBAL int epsv4; /* use EPSV/EPRT on IPv4 connections */
257GLOBAL int epsv4bad; /* EPSV doesn't work on the current server */
258GLOBAL int epsv6; /* use EPSV/EPRT on IPv6 connections */
259GLOBAL int epsv6bad; /* EPSV doesn't work on the current server */
258GLOBAL int editing; /* command line editing enabled */
259GLOBAL int features[FEAT_max]; /* remote FEATures supported */
260
261#ifndef NO_EDITCOMPLETE
262GLOBAL EditLine *el; /* editline(3) status structure */
263GLOBAL History *hist; /* editline(3) history structure */
264GLOBAL char *cursor_pos; /* cursor position we're looking for */
265GLOBAL size_t cursor_argc; /* location of cursor in margv */
266GLOBAL size_t cursor_argo; /* offset of cursor in margv[cursor_argc] */
267#endif /* !NO_EDITCOMPLETE */
268
260GLOBAL int editing; /* command line editing enabled */
261GLOBAL int features[FEAT_max]; /* remote FEATures supported */
262
263#ifndef NO_EDITCOMPLETE
264GLOBAL EditLine *el; /* editline(3) status structure */
265GLOBAL History *hist; /* editline(3) history structure */
266GLOBAL char *cursor_pos; /* cursor position we're looking for */
267GLOBAL size_t cursor_argc; /* location of cursor in margv */
268GLOBAL size_t cursor_argo; /* offset of cursor in margv[cursor_argc] */
269#endif /* !NO_EDITCOMPLETE */
270
269GLOBAL char *direction; /* direction transfer is occurring */
270
271GLOBAL char *hostname; /* name of host connected to */
272GLOBAL int unix_server; /* server is unix, can use binary for ascii */
273GLOBAL int unix_proxy; /* proxy is unix, can use binary for ascii */
274GLOBAL char localcwd[MAXPATHLEN]; /* local dir */
275GLOBAL char remotecwd[MAXPATHLEN]; /* remote dir */
276GLOBAL char *username; /* name of user logged in as. (dynamic) */
277
278GLOBAL sa_family_t family; /* address family to use for connections */
271GLOBAL char *hostname; /* name of host connected to */
272GLOBAL int unix_server; /* server is unix, can use binary for ascii */
273GLOBAL int unix_proxy; /* proxy is unix, can use binary for ascii */
274GLOBAL char localcwd[MAXPATHLEN]; /* local dir */
275GLOBAL char remotecwd[MAXPATHLEN]; /* remote dir */
276GLOBAL char *username; /* name of user logged in as. (dynamic) */
277
278GLOBAL sa_family_t family; /* address family to use for connections */
279GLOBAL char *ftpport; /* port number to use for FTP connections */
280GLOBAL char *httpport; /* port number to use for HTTP connections */
281GLOBAL char *gateport; /* port number to use for gateftp connections */
279GLOBAL const char *ftpport; /* port number to use for FTP connections */
280GLOBAL const char *httpport; /* port number to use for HTTP connections */
281GLOBAL const char *gateport; /* port number to use for gateftp connections */
282GLOBAL struct addrinfo *bindai; /* local address to bind as */
282
283GLOBAL char *outfile; /* filename to output URLs to */
284GLOBAL int restartautofetch; /* restart auto-fetch */
285
286GLOBAL char line[FTPBUFLEN]; /* input line buffer */
287GLOBAL char *stringbase; /* current scan point in line buffer */
288GLOBAL char argbuf[FTPBUFLEN]; /* argument storage buffer */
289GLOBAL char *argbase; /* current storage point in arg buffer */

--- 32 unchanged lines hidden (view full) ---

322extern struct cmd cmdtab[];
323extern struct option optiontab[];
324
325
326#define EMPTYSTRING(x) ((x) == NULL || (*(x) == '\0'))
327#define FREEPTR(x) if ((x) != NULL) { free(x); (x) = NULL; }
328
329#ifdef BSD4_4
283
284GLOBAL char *outfile; /* filename to output URLs to */
285GLOBAL int restartautofetch; /* restart auto-fetch */
286
287GLOBAL char line[FTPBUFLEN]; /* input line buffer */
288GLOBAL char *stringbase; /* current scan point in line buffer */
289GLOBAL char argbuf[FTPBUFLEN]; /* argument storage buffer */
290GLOBAL char *argbase; /* current storage point in arg buffer */

--- 32 unchanged lines hidden (view full) ---

323extern struct cmd cmdtab[];
324extern struct option optiontab[];
325
326
327#define EMPTYSTRING(x) ((x) == NULL || (*(x) == '\0'))
328#define FREEPTR(x) if ((x) != NULL) { free(x); (x) = NULL; }
329
330#ifdef BSD4_4
330# define HAVE_SOCKADDR_SA_LEN 1
331# define HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1
331#endif
332
333#ifdef NO_LONG_LONG
334# define STRTOLL(x,y,z) strtol(x,y,z)
335#else
336# define STRTOLL(x,y,z) strtoll(x,y,z)
337#endif
332#endif
333
334#ifdef NO_LONG_LONG
335# define STRTOLL(x,y,z) strtol(x,y,z)
336#else
337# define STRTOLL(x,y,z) strtoll(x,y,z)
338#endif
339
340#ifdef NO_DEBUG
341#define DPRINTF(...)
342#define DWARN(...)
343#else
344#define DPRINTF(...) if (ftp_debug) (void)fprintf(ttyout, __VA_ARGS__)
345#define DWARN(...) if (ftp_debug) warn(__VA_ARGS__)
346#endif
347
348#define STRorNULL(s) ((s) ? (s) : "<null>")
349
350#ifdef NO_USAGE
351void xusage(void);
352#define UPRINTF(...) xusage()
353#else
354#define UPRINTF(...) (void)fprintf(ttyout, __VA_ARGS__)
355#endif