"Fossies" - the Fresh Open Source Software Archive  

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

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

progressbar.c  (tnftp-20151004):progressbar.c  (tnftp-20200705)
/* $NetBSD: progressbar.c,v 1.15 2013/05/05 11:17:31 lukem Exp $ */ /* $NetBSD: progressbar.c,v 1.16 2020/07/04 09:59:07 lukem Exp $ */
/* from NetBSD: progressbar.c,v 1.22 2012/06/27 22:07:36 riastradh Exp * /* from NetBSD: progressbar.c,v 1.23 2019/06/22 23:40:33 christos Exp *
/ /
/*- /*-
* Copyright (c) 1997-2009 The NetBSD Foundation, Inc. * Copyright (c) 1997-2009 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 39 skipping to change at line 39
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "tnftp.h" #include "tnftp.h"
#if 0 /* tnftp */ #if 0 /* tnftp */
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID(" NetBSD: progressbar.c,v 1.22 2012/06/27 22:07:36 riastradh Exp "); __RCSID(" NetBSD: progressbar.c,v 1.23 2019/06/22 23:40:33 christos Exp ");
#endif /* not lint */ #endif /* not lint */
/* /*
* FTP User Program -- Misc support routines * FTP User Program -- Misc support routines
*/ */
#include <sys/param.h> #include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>
#include <err.h> #include <err.h>
skipping to change at line 100 skipping to change at line 100
{ {
int oerrno = errno; int oerrno = errno;
progressmeter(0); progressmeter(0);
errno = oerrno; errno = oerrno;
} }
/* /*
* List of order of magnitude suffixes, per IEC 60027-2. * List of order of magnitude suffixes, per IEC 60027-2.
*/ */
#if !defined(NO_PROGRESS) || !defined(STANDALONE_PROGRESS)
static const char * const suffixes[] = { static const char * const suffixes[] = {
"", /* 2^0 (byte) */ "", /* 2^0 (byte) */
"KiB", /* 2^10 Kibibyte */ "KiB", /* 2^10 Kibibyte */
"MiB", /* 2^20 Mebibyte */ "MiB", /* 2^20 Mebibyte */
"GiB", /* 2^30 Gibibyte */ "GiB", /* 2^30 Gibibyte */
"TiB", /* 2^40 Tebibyte */ "TiB", /* 2^40 Tebibyte */
"PiB", /* 2^50 Pebibyte */ "PiB", /* 2^50 Pebibyte */
"EiB", /* 2^60 Exbibyte */ "EiB", /* 2^60 Exbibyte */
#if 0 #if 0
/* The following are not necessary for signed 64-bit off_t */ /* The following are not necessary for signed 64-bit off_t */
"ZiB", /* 2^70 Zebibyte */ "ZiB", /* 2^70 Zebibyte */
"YiB", /* 2^80 Yobibyte */ "YiB", /* 2^80 Yobibyte */
#endif #endif
}; };
#define NSUFFIXES (int)(sizeof(suffixes) / sizeof(suffixes[0])) #define NSUFFIXES (int)(sizeof(suffixes) / sizeof(suffixes[0]))
#endif
/* /*
* Display a transfer progress bar if progress is non-zero. * Display a transfer progress bar if progress is non-zero.
* SIGALRM is hijacked for use by this function. * SIGALRM is hijacked for use by this function.
* - Before the transfer, set filesize to size of file (or -1 if unknown), * - Before the transfer, set filesize to size of file (or -1 if unknown),
* and call with flag = -1. This starts the once per second timer, * and call with flag = -1. This starts the once per second timer,
* and a call to updateprogressmeter() upon SIGALRM. * and a call to updateprogressmeter() upon SIGALRM.
* - During the transfer, updateprogressmeter will call progressmeter * - During the transfer, updateprogressmeter will call progressmeter
* with flag = 0 * with flag = 0
* - After the transfer, call with flag = 1 * - After the transfer, call with flag = 1
skipping to change at line 152 skipping to change at line 154
/* /*
* Work variables for progress bar. * Work variables for progress bar.
* *
* XXX: if the format of the progress bar changes * XXX: if the format of the progress bar changes
* (especially the number of characters in the * (especially the number of characters in the
* `static' portion of it), be sure to update * `static' portion of it), be sure to update
* these appropriately. * these appropriately.
*/ */
#endif #endif
#if !defined(NO_PROGRESS) || !defined(STANDALONE_PROGRESS)
size_t len; size_t len;
char buf[256]; /* workspace for progress bar */ char buf[256]; /* workspace for progress bar */
#endif
#ifndef NO_PROGRESS #ifndef NO_PROGRESS
#define BAROVERHEAD 45 /* non `*' portion of progress ba r */ #define BAROVERHEAD 45 /* non `*' portion of progress ba r */
/* /*
* stars should contain at least * stars should contain at least
* sizeof(buf) - BAROVERHEAD entries * sizeof(buf) - BAROVERHEAD entries
*/ */
static const char stars[] = static const char stars[] =
"*****************************************************************************" "*****************************************************************************"
"*****************************************************************************" "*****************************************************************************"
"*****************************************************************************"; "*****************************************************************************";
 End of changes. 6 change blocks. 
4 lines changed or deleted 8 lines changed or added

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