"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/main.c" between
tnftp-20151004.tar.gz and tnftp-20200705.tar.gz

About: tnftp is an enhanced ftp client (prior name "lukemftp").

main.c  (tnftp-20151004):main.c  (tnftp-20200705)
/* $NetBSD: main.c,v 1.20 2015/10/04 04:53:26 lukem Exp $ */ /* $NetBSD: main.c,v 1.21 2020/07/04 09:59:07 lukem Exp $ */
/* from NetBSD: main.c,v 1.123 2015/04/23 23:31:23 lukem Exp */ /* from NetBSD: main.c,v 1.126 2019/02/04 04:09:13 mrg Exp */
/*- /*-
* Copyright (c) 1996-2015 The NetBSD Foundation, Inc. * Copyright (c) 1996-2015 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
* *
* This code is derived from software contributed to The NetBSD Foundation * This code is derived from software contributed to The NetBSD Foundation
* by Luke Mewburn. * by Luke Mewburn.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
skipping to change at line 106 skipping to change at line 106
#ifndef lint #ifndef lint
__COPYRIGHT("@(#) Copyright (c) 1985, 1989, 1993, 1994\ __COPYRIGHT("@(#) Copyright (c) 1985, 1989, 1993, 1994\
The Regents of the University of California. All rights reserved.\ The Regents of the University of California. All rights reserved.\
Copyright 1996-2015 The NetBSD Foundation, Inc. All rights reserved"); Copyright 1996-2015 The NetBSD Foundation, Inc. All rights reserved");
#endif /* not lint */ #endif /* not lint */
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94"; static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
#else #else
__RCSID(" NetBSD: main.c,v 1.123 2015/04/23 23:31:23 lukem Exp "); __RCSID(" NetBSD: main.c,v 1.126 2019/02/04 04:09:13 mrg Exp ");
#endif #endif
#endif /* not lint */ #endif /* not lint */
/* /*
* FTP User Program -- Command Interface. * FTP User Program -- Command Interface.
*/ */
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <err.h> #include <err.h>
skipping to change at line 336 skipping to change at line 336
break; break;
case 'N': case 'N':
if (strlcpy(netrc, optarg, sizeof(netrc)) if (strlcpy(netrc, optarg, sizeof(netrc))
>= sizeof(netrc)) >= sizeof(netrc))
errx(1, "%s: %s", optarg, errx(1, "%s: %s", optarg,
strerror(ENAMETOOLONG)); strerror(ENAMETOOLONG));
break; break;
case 'o': case 'o':
outfile = optarg; outfile = ftp_strdup(optarg);
if (strcmp(outfile, "-") == 0) if (strcmp(outfile, "-") == 0)
ttyout = stderr; ttyout = stderr;
break; break;
case 'p': case 'p':
passivemode = 1; passivemode = 1;
activefallback = 0; activefallback = 0;
break; break;
case 'P': case 'P':
skipping to change at line 476 skipping to change at line 476
pw = NULL; pw = NULL;
cp = getlogin(); cp = getlogin();
if (cp != NULL) if (cp != NULL)
pw = getpwnam(cp); pw = getpwnam(cp);
if (pw == NULL) if (pw == NULL)
pw = getpwuid(getuid()); pw = getpwuid(getuid());
if (pw != NULL) { if (pw != NULL) {
if (localhome == NULL && !EMPTYSTRING(pw->pw_dir)) if (localhome == NULL && !EMPTYSTRING(pw->pw_dir))
localhome = ftp_strdup(pw->pw_dir); localhome = ftp_strdup(pw->pw_dir);
localname = ftp_strdup(pw->pw_name); localname = ftp_strdup(pw->pw_name);
anonuser = localname;
} }
if (netrc[0] == '\0' && localhome != NULL) { if (netrc[0] == '\0' && localhome != NULL) {
if (strlcpy(netrc, localhome, sizeof(netrc)) >= sizeof(netrc) || if (strlcpy(netrc, localhome, sizeof(netrc)) >= sizeof(netrc) ||
strlcat(netrc, "/.netrc", sizeof(netrc)) >= sizeof(netrc)) { strlcat(netrc, "/.netrc", sizeof(netrc)) >= sizeof(netrc)) {
warnx("%s/.netrc: %s", localhome, warnx("%s/.netrc: %s", localhome,
strerror(ENAMETOOLONG)); strerror(ENAMETOOLONG));
netrc[0] = '\0'; netrc[0] = '\0';
} }
} }
if (localhome == NULL) if (localhome == NULL)
skipping to change at line 673 skipping to change at line 672
if (*p) if (*p)
fprintf(ttyout, "%s ", p); fprintf(ttyout, "%s ", p);
} }
(void)fflush(ttyout); (void)fflush(ttyout);
len = get_line(stdin, line, sizeof(line), NULL); len = get_line(stdin, line, sizeof(line), NULL);
switch (len) { switch (len) {
case -1: /* EOF */ case -1: /* EOF */
case -2: /* error */ case -2: /* error */
if (fromatty) if (fromatty)
putc('\n', ttyout); putc('\n', ttyout);
quit(0, NULL); justquit();
/* NOTREACHED */ /* NOTREACHED */
case -3: /* too long; try again */ case -3: /* too long; try again */
fputs("Sorry, input line is too long.\n", fputs("Sorry, input line is too long.\n",
ttyout); ttyout);
continue; continue;
case 0: /* empty; try again */ case 0: /* empty; try again */
continue; continue;
default: /* all ok */ default: /* all ok */
break; break;
} }
skipping to change at line 695 skipping to change at line 694
} else { } else {
const char *buf; const char *buf;
HistEvent ev; HistEvent ev;
cursor_pos = NULL; cursor_pos = NULL;
buf = el_gets(el, &ch); buf = el_gets(el, &ch);
num = ch; num = ch;
if (buf == NULL || num == 0) { if (buf == NULL || num == 0) {
if (fromatty) if (fromatty)
putc('\n', ttyout); putc('\n', ttyout);
quit(0, NULL); justquit();
} }
if (num >= sizeof(line)) { if (num >= sizeof(line)) {
fputs("Sorry, input line is too long.\n", fputs("Sorry, input line is too long.\n",
ttyout); ttyout);
break; break;
} }
memcpy(line, buf, num); memcpy(line, buf, num);
if (line[--num] == '\n') { if (line[--num] == '\n') {
line[num] = '\0'; line[num] = '\0';
if (num == 0) if (num == 0)
 End of changes. 6 change blocks. 
7 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)