main.c (935205e2307611615ed5a7fe0a32b225ffd8c19c) | main.c (49e49bdbc104b85fd37df4f596f98fe86defa485) |
---|---|
1/* $NetBSD: main.c,v 1.17 2009/11/15 10:12:37 lukem Exp $ */ 2/* from NetBSD: main.c,v 1.117 2009/07/13 19:05:41 roy Exp */ 3 4/*- 5 * Copyright (c) 1996-2009 The NetBSD Foundation, Inc. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to The NetBSD Foundation --- 132 unchanged lines hidden (view full) --- 141 142int 143main(int volatile argc, char **volatile argv) 144{ 145 int ch, rval; 146 struct passwd *pw; 147 char *cp, *ep, *anonpass, *upload_path, *src_addr; 148 const char *anonuser; | 1/* $NetBSD: main.c,v 1.17 2009/11/15 10:12:37 lukem Exp $ */ 2/* from NetBSD: main.c,v 1.117 2009/07/13 19:05:41 roy Exp */ 3 4/*- 5 * Copyright (c) 1996-2009 The NetBSD Foundation, Inc. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to The NetBSD Foundation --- 132 unchanged lines hidden (view full) --- 141 142int 143main(int volatile argc, char **volatile argv) 144{ 145 int ch, rval; 146 struct passwd *pw; 147 char *cp, *ep, *anonpass, *upload_path, *src_addr; 148 const char *anonuser; |
149 int dumbterm, s, isupload; | 149 int dumbterm, isupload; |
150 size_t len; | 150 size_t len; |
151 socklen_t slen; | |
152 153 tzset(); 154#if 0 /* tnftp */ /* XXX */ 155 setlocale(LC_ALL, ""); 156#endif /* tnftp */ 157 setprogname(argv[0]); 158 159 sigint_raised = 0; --- 48 unchanged lines hidden (view full) --- 208 family = AF_INET; /* force AF_INET if no INET6 support */ 209#endif 210 211 netrc[0] = '\0'; 212 cp = getenv("NETRC"); 213 if (cp != NULL && strlcpy(netrc, cp, sizeof(netrc)) >= sizeof(netrc)) 214 errx(1, "$NETRC `%s': %s", cp, strerror(ENAMETOOLONG)); 215 | 151 152 tzset(); 153#if 0 /* tnftp */ /* XXX */ 154 setlocale(LC_ALL, ""); 155#endif /* tnftp */ 156 setprogname(argv[0]); 157 158 sigint_raised = 0; --- 48 unchanged lines hidden (view full) --- 207 family = AF_INET; /* force AF_INET if no INET6 support */ 208#endif 209 210 netrc[0] = '\0'; 211 cp = getenv("NETRC"); 212 if (cp != NULL && strlcpy(netrc, cp, sizeof(netrc)) >= sizeof(netrc)) 213 errx(1, "$NETRC `%s': %s", cp, strerror(ENAMETOOLONG)); 214 |
216 /* 217 * Get the default socket buffer sizes if we don't already have them. 218 * It doesn't matter which socket we do this to, because on the first 219 * call no socket buffer sizes will have been modified, so we are 220 * guaranteed to get the system defaults. 221 */ 222 s = socket(AF_INET, SOCK_STREAM, 0); 223 if (s == -1) 224 err(1, "Can't create socket to determine default socket sizes"); 225 slen = sizeof(rcvbuf_size); 226 if (getsockopt(s, SOL_SOCKET, SO_RCVBUF, 227 (void *)&rcvbuf_size, &slen) == -1) 228 err(1, "Unable to get default rcvbuf size"); 229 slen = sizeof(sndbuf_size); 230 if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, 231 (void *)&sndbuf_size, &slen) == -1) 232 err(1, "Unable to get default sndbuf size"); 233 (void)close(s); 234 /* sanity check returned buffer sizes */ 235 if (rcvbuf_size <= 0) 236 rcvbuf_size = 8 * 1024; 237 if (sndbuf_size <= 0) 238 sndbuf_size = 8 * 1024; 239 240 if (sndbuf_size > 8 * 1024 * 1024) 241 sndbuf_size = 8 * 1024 * 1024; 242 if (rcvbuf_size > 8 * 1024 * 1024) 243 rcvbuf_size = 8 * 1024 * 1024; 244 | |
245 marg_sl = ftp_sl_init(); 246 if ((tmpdir = getenv("TMPDIR")) == NULL) 247 tmpdir = _PATH_TMP; 248 249 /* Set default operation mode based on FTPMODE environment variable */ 250 if ((cp = getenv("FTPMODE")) != NULL) { 251 if (strcasecmp(cp, "passive") == 0) { 252 passivemode = 1; --- 836 unchanged lines hidden --- | 215 marg_sl = ftp_sl_init(); 216 if ((tmpdir = getenv("TMPDIR")) == NULL) 217 tmpdir = _PATH_TMP; 218 219 /* Set default operation mode based on FTPMODE environment variable */ 220 if ((cp = getenv("FTPMODE")) != NULL) { 221 if (strcasecmp(cp, "passive") == 0) { 222 passivemode = 1; --- 836 unchanged lines hidden --- |