Skip to content

Commit

Permalink
Supports builds without config.h
Browse files Browse the repository at this point in the history
  • Loading branch information
kobayasy committed Jul 5, 2021
1 parent 8619926 commit b57e696
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 30 deletions.
2 changes: 1 addition & 1 deletion NOTE_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
バックグラウンドで psync を自動実行させる場合、パスワード入力をどうやって自動化させるかが問題になる。
そんな時は、ssh 用パスワード自動入力コマンドの sshpass で解決できる。

例えば、同期先のホスト名が example.com、ユーザー名が guest で パスワードが password の場合、下記のように実行する。
例えば、同期先のホスト名が `example.com`、ユーザー名が `guest` で パスワードが `password` の場合、下記のように実行する。

```
shpass -p password psync guest@example.com
Expand Down
6 changes: 3 additions & 3 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,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.7/psync-2.7.tar.gz
tar xzf psync-2.7.tar.gz
cd psync-2.7
curl -LOJs https://github.com/kobayasy/pSync/releases/download/2.8/psync-2.8.tar.gz
tar xzf psync-2.8.tar.gz
cd psync-2.8
./configure --prefix=$HOME
make install
```
Expand Down
6 changes: 3 additions & 3 deletions README_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
ローカルホストを含めた全ての同期ホストに対してこの作業が必要です。
1. 以下の手順でビルドとインストールを行ないます。
```
curl -LOJs https://github.com/kobayasy/pSync/releases/download/2.7/psync-2.7.tar.gz
tar xzf psync-2.7.tar.gz
cd psync-2.7
curl -LOJs https://github.com/kobayasy/pSync/releases/download/2.8/psync-2.8.tar.gz
tar xzf psync-2.8.tar.gz
cd psync-2.8
./configure --prefix=$HOME
make install
```
Expand Down
4 changes: 2 additions & 2 deletions src/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.7.tar.gz
cd psync-2.7
tar xzf psync-2.8.tar.gz
cd psync-2.8
./configure --prefix=$HOME
make install
---
Expand Down
6 changes: 3 additions & 3 deletions src/config.h.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/* config.h.in. Generated from configure.ac by autoheader. */

/* Define to 1 if you have the tgetent() function. */
#undef HAVE_FUNCTGETENT

/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

Expand Down Expand Up @@ -39,6 +36,9 @@
/* Define to 1 if you have the <termcap.h> header file. */
#undef HAVE_TERMCAP_H

/* Define to 1 if you have the tgetent() function. */
#undef HAVE_TGETENT

/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

Expand Down
22 changes: 11 additions & 11 deletions src/configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for pSync 2.7.
# Generated by GNU Autoconf 2.69 for pSync 2.8.
#
# Report bugs to <kobayasy@kobayasy.com>.
#
Expand Down Expand Up @@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='pSync'
PACKAGE_TARNAME='psync'
PACKAGE_VERSION='2.7'
PACKAGE_STRING='pSync 2.7'
PACKAGE_VERSION='2.8'
PACKAGE_STRING='pSync 2.8'
PACKAGE_BUGREPORT='kobayasy@kobayasy.com'
PACKAGE_URL='http://kobayasy.com/psync/'

Expand Down Expand Up @@ -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.7 to adapt to many kinds of systems.
\`configure' configures pSync 2.8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1307,7 +1307,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of pSync 2.7:";;
short | recursive ) echo "Configuration of pSync 2.8:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1394,7 +1394,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
pSync configure 2.7
pSync configure 2.8
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -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.7, which was
It was created by pSync $as_me 2.8, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
Expand Down Expand Up @@ -4180,7 +4180,7 @@ _ACEOF
ac_fn_c_check_func "$LINENO" "tgetent" "ac_cv_func_tgetent"
if test "x$ac_cv_func_tgetent" = xyes; then :

$as_echo "#define HAVE_FUNCTGETENT 1" >>confdefs.h
$as_echo "#define HAVE_TGETENT 1" >>confdefs.h

else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5
Expand Down Expand Up @@ -4236,7 +4236,7 @@ $as_echo "$ac_cv_search_tgetent" >&6; }
ac_res=$ac_cv_search_tgetent
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
$as_echo "#define HAVE_FUNCTGETENT 1" >>confdefs.h
$as_echo "#define HAVE_TGETENT 1" >>confdefs.h

fi

Expand Down Expand Up @@ -4757,7 +4757,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.7, which was
This file was extended by pSync $as_me 2.8, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -4820,7 +4820,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.7
pSync config.status 2.8
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Expand Down
16 changes: 9 additions & 7 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* main.c - Last modified: 27-Jun-2021 (kobayasy)
/* main.c - Last modified: 05-Jul-2021 (kobayasy)
*
* Copyright (c) 2018-2021 by Yuichi Kobayashi <kobayasy@kobayasy.com>
*
Expand All @@ -25,6 +25,8 @@

#ifdef HAVE_CONFIG_H
#include "config.h"
#else /* #ifdef HAVE_CONFIG_H */
#define PACKAGE_STRING "pSync"
#endif /* #ifdef HAVE_CONFIG_H */

#include <ctype.h>
Expand All @@ -40,9 +42,9 @@
#include <pthread.h>
#include <unistd.h>
#include <sys/wait.h>
#ifdef HAVE_FUNCTGETENT
#ifdef HAVE_TGETENT
#include <termcap.h>
#endif /* #ifdef HAVE_FUNCTGETENT */
#endif /* #ifdef HAVE_TGETENT */
#include "psync_utils.h"
#include "psync_psp1.h"
#include "popen3.h"
Expand Down Expand Up @@ -240,7 +242,7 @@ static int strfnum(char *str, size_t size, intmax_t num) {
return status;
}

#ifdef HAVE_FUNCTGETENT
#ifdef HAVE_TGETENT
static char *progress_format(int *columns) {
char *format = NULL;
char ent[1024];
Expand Down Expand Up @@ -270,7 +272,7 @@ static char *progress_format(int *columns) {
error:
return format;
}
#endif /* #ifdef HAVE_FUNCTGETENT */
#endif /* #ifdef HAVE_TGETENT */

static char *progress_bar(char *buffer, const char *format,
const char *text, intmax_t current, intmax_t goal ) {
Expand Down Expand Up @@ -741,9 +743,9 @@ int main(int argc, char *argv[]) {
if (ISERR(status))
goto run;
priv.length = status;
#ifdef HAVE_FUNCTGETENT
#ifdef HAVE_TGETENT
priv.format = progress_format(&priv.columns);
#endif /* #ifdef HAVE_FUNCTGETENT */
#endif /* #ifdef HAVE_TGETENT */
status = get_opts(argv, &opts);
run:
switch (status) {
Expand Down

0 comments on commit b57e696

Please sign in to comment.