From 6a73ff232289cb7eb7752c7c51c5808df9878ad7 Mon Sep 17 00:00:00 2001 From: Yuichi Kobayashi Date: Sat, 31 Jul 2021 10:27:00 +0900 Subject: [PATCH] Modified progress_update(). --- README_en.md | 6 +++--- README_ja.md | 6 +++--- src/README.txt | 4 ++-- src/configure | 18 +++++++++--------- src/configure.ac | 16 ++++++---------- src/psync.c | 16 +++++++--------- 6 files changed, 30 insertions(+), 36 deletions(-) diff --git a/README_en.md b/README_en.md index 240af60..0096b62 100644 --- a/README_en.md +++ b/README_en.md @@ -22,9 +22,9 @@ So for this to work, you must be able to login to the sync-host with [OpenSSH]. This work is required for each sync-host include local-host. 1. Do the following to build and install. ``` -curl -LOJs https://github.com/kobayasy/pSync/releases/download/2.12/psync-2.12.tar.gz -tar xzf psync-2.12.tar.gz -cd psync-2.12 +curl -LOJs https://github.com/kobayasy/pSync/releases/download/2.13/psync-2.13.tar.gz +tar xzf psync-2.13.tar.gz +cd psync-2.13 ./configure --prefix=$HOME make install ``` diff --git a/README_ja.md b/README_ja.md index 07279ed..0f6dfe2 100644 --- a/README_ja.md +++ b/README_ja.md @@ -24,9 +24,9 @@ ローカルホストを含めた全ての同期ホストに対してこの作業が必要です。 1. 以下の手順でビルドとインストールを行ないます。 ``` -curl -LOJs https://github.com/kobayasy/pSync/releases/download/2.12/psync-2.12.tar.gz -tar xzf psync-2.12.tar.gz -cd psync-2.12 +curl -LOJs https://github.com/kobayasy/pSync/releases/download/2.13/psync-2.13.tar.gz +tar xzf psync-2.13.tar.gz +cd psync-2.13 ./configure --prefix=$HOME make install ``` diff --git a/src/README.txt b/src/README.txt index d4f68f7..3908b0d 100644 --- a/src/README.txt +++ b/src/README.txt @@ -6,8 +6,8 @@ Installation: This work is required for each sync-host include local-host. 1. Do the following to build and install. --- -tar xzf psync-2.12.tar.gz -cd psync-2.12 +tar xzf psync-2.13.tar.gz +cd psync-2.13 ./configure --prefix=$HOME make install --- diff --git a/src/configure b/src/configure index 385728c..9fce91a 100755 --- a/src/configure +++ b/src/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for pSync 2.12. +# Generated by GNU Autoconf 2.69 for pSync 2.13. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='pSync' PACKAGE_TARNAME='psync' -PACKAGE_VERSION='2.12' -PACKAGE_STRING='pSync 2.12' +PACKAGE_VERSION='2.13' +PACKAGE_STRING='pSync 2.13' PACKAGE_BUGREPORT='kobayasy@kobayasy.com' PACKAGE_URL='http://kobayasy.com/psync/' @@ -1242,7 +1242,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures pSync 2.12 to adapt to many kinds of systems. +\`configure' configures pSync 2.13 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1307,7 +1307,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of pSync 2.12:";; + short | recursive ) echo "Configuration of pSync 2.13:";; esac cat <<\_ACEOF @@ -1394,7 +1394,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -pSync configure 2.12 +pSync configure 2.13 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1763,7 +1763,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by pSync $as_me 2.12, which was +It was created by pSync $as_me 2.13, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4760,7 +4760,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by pSync $as_me 2.12, which was +This file was extended by pSync $as_me 2.13, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4823,7 +4823,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -pSync config.status 2.12 +pSync config.status 2.13 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/src/configure.ac b/src/configure.ac index 400233c..e196d2c 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -1,4 +1,4 @@ -# configure.ac - Last modified: 18-Jul-2021 (kobayasy) +# configure.ac - Last modified: 31-Jul-2021 (kobayasy) # # Copyright (c) 2018-2021 by Yuichi Kobayashi # @@ -23,7 +23,7 @@ # SOFTWARE. AC_PREREQ(2.69) -AC_INIT([pSync], [2.12], [kobayasy@kobayasy.com], [psync], [http://kobayasy.com/psync/]) +AC_INIT([pSync], [2.13], [kobayasy@kobayasy.com], [psync], [http://kobayasy.com/psync/]) AC_CONFIG_SRCDIR([psync.c]) AC_CONFIG_AUX_DIR([conf]) @@ -33,14 +33,10 @@ AC_PROG_INSTALL AC_SYS_LARGEFILE AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC"]) -AC_CHECK_FUNC([clock_gettime], - [], - [AC_CHECK_LIB([rt], [clock_gettime])] ) -AC_CHECK_HEADERS([termcap.h], - [AC_CHECK_FUNC([tgetent], - [AC_DEFINE([HAVE_TGETENT], [1], [Define to 1 if you have the tgetent() function.])], - [AC_SEARCH_LIBS([tgetent], [tinfo ncurses], - [AC_DEFINE([HAVE_TGETENT], [1])] )] )] ) +AC_CHECK_FUNC([clock_gettime], [], [AC_CHECK_LIB([rt], [clock_gettime])]) +AC_CHECK_HEADERS([termcap.h], [AC_CHECK_FUNC([tgetent], + [AC_DEFINE([HAVE_TGETENT], [1], [Define to 1 if you have the tgetent() function.])], + [AC_SEARCH_LIBS([tgetent], [tinfo ncurses], [AC_DEFINE([HAVE_TGETENT], [1])])] )]) AC_CONFIG_HEADERS([config.h]) AH_TOP([#ifndef _INCLUDE_config_h diff --git a/src/psync.c b/src/psync.c index 47a1a6b..fe2a069 100644 --- a/src/psync.c +++ b/src/psync.c @@ -1,4 +1,4 @@ -/* psync.c - Last modified: 01-Jul-2021 (kobayasy) +/* psync.c - Last modified: 31-Jul-2021 (kobayasy) * * Copyright (c) 2018-2021 by Yuichi Kobayashi * @@ -172,7 +172,7 @@ static int progress_update(PROGRESS *progress, intmax_t update) { struct timespec now; if (progress->fd != -1) { - progress->update = update; + progress->update += update; if (progress->update != progress->data) { if (clock_gettime(CLOCK_REALTIME, &now) == -1) goto error; @@ -777,7 +777,6 @@ static int make_fsynced_get_func(SETS sets, FLIST *flocal, FLIST *fremote, void static int preload(PRIV *priv) { int status = INT_MIN; - intmax_t uploadsize; PROGRESS progress; char pathname[PATH_MAX], *name; char loadname[PATH_MAX], *p; @@ -786,7 +785,7 @@ static int preload(PRIV *priv) { char buffer[SYMLINK_MAX]; ONSTOP(priv->stop, ERROR_STOP); - progress_init(&progress, priv->info, PROGRESS_INTERVAL, "U%+jd\n", uploadsize = 0); + progress_init(&progress, priv->info, PROGRESS_INTERVAL, "U%+jd\n", 0); name = pathname, name += sprintf(name, "%s/", priv->dirname); p = loadname, p += sprintf(p, "%s/"SYNCDIR"/"LOCKDIR"/", priv->dirname); count = 0; @@ -820,7 +819,7 @@ static int preload(PRIV *priv) { switch (fsynced->st.flags & (FST_DNLD|FST_RTYPE)) { case FST_DNLD|FST_RREG: case FST_DNLD|FST_RLNK: - progress_update(&progress, uploadsize += fsynced->st.size); + progress_update(&progress, fsynced->st.size); break; } } @@ -899,7 +898,6 @@ static int upload(PRIV *priv) { static int download(PRIV *priv) { int status = INT_MIN; - intmax_t downloadsize; PROGRESS progress; char loadname[PATH_MAX], *p; unsigned long count; @@ -911,7 +909,7 @@ static int download(PRIV *priv) { struct timeval tv[2]; ONSTOP(priv->stop, ERROR_STOP); - progress_init(&progress, priv->info, PROGRESS_INTERVAL, "D%+jd\n", downloadsize = 0); + progress_init(&progress, priv->info, PROGRESS_INTERVAL, "D%+jd\n", 0); p = loadname, p += sprintf(p, "%s/"SYNCDIR"/"LOCKDIR"/", priv->dirname); count = 0; for (fsynced = priv->fsynced.next; *fsynced->name; fsynced = fsynced->next) { @@ -940,7 +938,7 @@ static int download(PRIV *priv) { goto error; } size -= n; - progress_update(&progress, downloadsize += n); + progress_update(&progress, n); } close(fd), fd = -1; if (chmod(loadname, fsynced->st.mode & (S_IRWXU|S_IRWXG|S_IRWXO)) == -1) { @@ -962,7 +960,7 @@ static int download(PRIV *priv) { status = ERROR_FWRITE; goto error; } - progress_update(&progress, downloadsize += size); + progress_update(&progress, size); break; } tv[0].tv_sec = fsynced->st.mtime, tv[0].tv_usec = 0;