Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 575742 Details for
Bug 806426
curl --progress-bar is too verbose on s390 (x3270 terminal)
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
work in progress
0001-curl-tool-do-not-print-r-to-dumb-terminals.patch (text/plain), 11.38 KB, created by
Kamil Dudka
on 2012-04-06 13:09:51 UTC
(
hide
)
Description:
work in progress
Filename:
MIME Type:
Creator:
Kamil Dudka
Created:
2012-04-06 13:09:51 UTC
Size:
11.38 KB
patch
obsolete
>From 815f58821a83398e16fc4884fa9eeb6dea1f6ea5 Mon Sep 17 00:00:00 2001 >From: Kamil Dudka <kdudka@redhat.com> >Date: Wed, 4 Apr 2012 14:19:16 +0200 >Subject: [PATCH] curl tool: do not print \r to dumb terminals > >... if built with tinfo support. >--- > configure | 220 ++++++++++++++++++++++++++++++++++++++++++++++++++ > configure.ac | 50 +++++++++++ > lib/curl_config.h.in | 9 ++ > src/tool_cb_prg.c | 35 ++++++++- > src/tool_cb_prg.h | 2 + > 5 files changed, 314 insertions(+), 2 deletions(-) > >diff --git a/configure b/configure >index 48358e4..9e83a49 100755 >--- a/configure >+++ b/configure >@@ -892,6 +892,7 @@ with_libssh2 > with_librtmp > enable_versioned_symbols > with_libidn >+with_tinfo > enable_nonblocking > enable_threaded_resolver > enable_verbose >@@ -1681,6 +1682,7 @@ Optional Packages: > --without-librtmp disable LIBRTMP > --with-libidn=PATH Enable libidn usage > --without-libidn Disable libidn usage >+ --with-tinfo Enable tinfo support if available > > Some influential environment variables: > CC C compiler command >@@ -23899,6 +23901,224 @@ fi > > > >+OPT_TINFO=no >+ >+ >+# Check whether --with-tinfo was given. >+if test "${with_tinfo+set}" = set; then : >+ withval=$with_tinfo; OPT_TINFO=$withval >+fi >+ >+ >+if test "x$OPT_TINFO" != xno; then >+ if test "x$OPT_TINFO" = xyes; then >+ >+ >+ PKGCONFIG="no" >+ >+ if test x$cross_compiling = xyes; then >+ # Extract the first word of "${host}-pkg-config", so it can be a program name with args. >+set dummy ${host}-pkg-config; ac_word=$2 >+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 >+$as_echo_n "checking for $ac_word... " >&6; } >+if test "${ac_cv_path_PKGCONFIG+set}" = set; then : >+ $as_echo_n "(cached) " >&6 >+else >+ case $PKGCONFIG in >+ [\\/]* | ?:[\\/]*) >+ ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. >+ ;; >+ *) >+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR >+as_dummy="$PATH:/usr/bin:/usr/local/bin" >+for as_dir in $as_dummy >+do >+ IFS=$as_save_IFS >+ test -z "$as_dir" && as_dir=. >+ for ac_exec_ext in '' $ac_executable_extensions; do >+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then >+ ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" >+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 >+ break 2 >+ fi >+done >+ done >+IFS=$as_save_IFS >+ >+ test -z "$ac_cv_path_PKGCONFIG" && ac_cv_path_PKGCONFIG="no" >+ ;; >+esac >+fi >+PKGCONFIG=$ac_cv_path_PKGCONFIG >+if test -n "$PKGCONFIG"; then >+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 >+$as_echo "$PKGCONFIG" >&6; } >+else >+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 >+$as_echo "no" >&6; } >+fi >+ >+ >+ fi >+ >+ if test x$PKGCONFIG = xno; then >+ # Extract the first word of "pkg-config", so it can be a program name with args. >+set dummy pkg-config; ac_word=$2 >+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 >+$as_echo_n "checking for $ac_word... " >&6; } >+if test "${ac_cv_path_PKGCONFIG+set}" = set; then : >+ $as_echo_n "(cached) " >&6 >+else >+ case $PKGCONFIG in >+ [\\/]* | ?:[\\/]*) >+ ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. >+ ;; >+ *) >+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR >+as_dummy="$PATH:/usr/bin:/usr/local/bin" >+for as_dir in $as_dummy >+do >+ IFS=$as_save_IFS >+ test -z "$as_dir" && as_dir=. >+ for ac_exec_ext in '' $ac_executable_extensions; do >+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then >+ ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" >+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 >+ break 2 >+ fi >+done >+ done >+IFS=$as_save_IFS >+ >+ test -z "$ac_cv_path_PKGCONFIG" && ac_cv_path_PKGCONFIG="no" >+ ;; >+esac >+fi >+PKGCONFIG=$ac_cv_path_PKGCONFIG >+if test -n "$PKGCONFIG"; then >+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 >+$as_echo "$PKGCONFIG" >&6; } >+else >+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 >+$as_echo "no" >&6; } >+fi >+ >+ >+ fi >+ >+ if test x$PKGCONFIG != xno; then >+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tinfo options with pkg-config" >&5 >+$as_echo_n "checking for tinfo options with pkg-config... " >&6; } >+ itexists=` >+ if test -n ""; then >+ PKG_CONFIG_LIBDIR="" >+ export PKG_CONFIG_LIBDIR >+ fi >+ $PKGCONFIG --exists tinfo >/dev/null 2>&1 && echo 1` >+ >+ if test -z "$itexists"; then >+ PKGCONFIG="no" >+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 >+$as_echo "no" >&6; } >+ else >+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 >+$as_echo "found" >&6; } >+ fi >+ fi >+ >+ if test "$PKGCONFIG" != "no" ; then >+ addlib=`$PKGCONFIG --libs tinfo` >+ addcflags=`$PKGCONFIG --cflags tinfo` >+ else >+ # fallback to default >+ addlib="-ltinfo" >+ addcflags="" >+ fi >+ else >+ # Without pkg-config, we'll kludge in some defaults >+ addlib="-L$OPT_TINFO/lib -ltinfo" >+ addcflags="-I$OPT_TINFO/include" >+ fi >+ >+ CLEANLIBS="$LIBS" >+ CLEANCPPFLAGS="$CPPFLAGS" >+ >+ LIBS="$LIBS $addlib" >+ if test "$addcflags" != "-I/usr/include"; then >+ CPPFLAGS="$CPPFLAGS $addcflags" >+ fi >+ >+ for ac_header in term.h >+do : >+ ac_fn_c_check_header_mongrel "$LINENO" "term.h" "ac_cv_header_term_h" "$ac_includes_default" >+if test "x$ac_cv_header_term_h" = x""yes; then : >+ cat >>confdefs.h <<_ACEOF >+#define HAVE_TERM_H 1 >+_ACEOF >+ >+fi >+ >+done >+ >+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltinfo" >&5 >+$as_echo_n "checking for tgetent in -ltinfo... " >&6; } >+if test "${ac_cv_lib_tinfo_tgetent+set}" = set; then : >+ $as_echo_n "(cached) " >&6 >+else >+ ac_check_lib_save_LIBS=$LIBS >+LIBS="-ltinfo $LIBS" >+cat confdefs.h - <<_ACEOF >conftest.$ac_ext >+/* end confdefs.h. */ >+ >+ >+#ifdef __cplusplus >+extern "C" >+#endif >+char tgetent (); >+int main (void) >+{ >+return tgetent (); >+ ; >+ return 0; >+} >+_ACEOF >+if ac_fn_c_try_link "$LINENO"; then : >+ ac_cv_lib_tinfo_tgetent=yes >+else >+ ac_cv_lib_tinfo_tgetent=no >+fi >+rm -f core conftest.err conftest.$ac_objext \ >+ conftest$ac_exeext conftest.$ac_ext >+LIBS=$ac_check_lib_save_LIBS >+fi >+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_tgetent" >&5 >+$as_echo "$ac_cv_lib_tinfo_tgetent" >&6; } >+if test "x$ac_cv_lib_tinfo_tgetent" = x""yes; then : >+ cat >>confdefs.h <<_ACEOF >+#define HAVE_LIBTINFO 1 >+_ACEOF >+ >+ LIBS="-ltinfo $LIBS" >+ >+fi >+ >+ if test $ac_cv_header_term_h = yes && >+ test $ac_cv_lib_tinfo_tgetent = yes; then >+ CURL_LIBS="$CURL_LIBS $addlib" >+ >+$as_echo "#define USE_TINFO 1" >>confdefs.h >+ >+ else >+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: tinfo not found" >&5 >+$as_echo "$as_me: WARNING: tinfo not found" >&2;} >+ CPPFLAGS="$CLEANCPPFLAGS" >+ fi >+ >+ LIBS="$CLEANLIBS" >+fi >+ >+ >+ > > > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 >diff --git a/configure.ac b/configure.ac >index 631563d..88bc346 100644 >--- a/configure.ac >+++ b/configure.ac >@@ -2566,6 +2566,56 @@ if test "$want_idn" = "yes"; then > fi > > >+dnl ********************************************************************** >+dnl If --with-tinfo was specified, check for its presence and usability. >+dnl ********************************************************************** >+ >+OPT_TINFO=no >+ >+AC_ARG_WITH(tinfo, >+AC_HELP_STRING([--with-tinfo],[Enable tinfo support if available]), >+ [OPT_TINFO=$withval]) >+ >+if test "x$OPT_TINFO" != xno; then >+ if test "x$OPT_TINFO" = xyes; then >+ CURL_CHECK_PKGCONFIG(tinfo) >+ if test "$PKGCONFIG" != "no" ; then >+ addlib=`$PKGCONFIG --libs tinfo` >+ addcflags=`$PKGCONFIG --cflags tinfo` >+ else >+ # fallback to default >+ addlib="-ltinfo" >+ addcflags="" >+ fi >+ else >+ # Without pkg-config, we'll kludge in some defaults >+ addlib="-L$OPT_TINFO/lib -ltinfo" >+ addcflags="-I$OPT_TINFO/include" >+ fi >+ >+ CLEANLIBS="$LIBS" >+ CLEANCPPFLAGS="$CPPFLAGS" >+ >+ LIBS="$LIBS $addlib" >+ if test "$addcflags" != "-I/usr/include"; then >+ CPPFLAGS="$CPPFLAGS $addcflags" >+ fi >+ >+ AC_CHECK_HEADERS([term.h]) >+ AC_CHECK_LIB(tinfo, tgetent) >+ if test $ac_cv_header_term_h = yes && >+ test $ac_cv_lib_tinfo_tgetent = yes; then >+ CURL_LIBS="$CURL_LIBS $addlib" >+ AC_DEFINE(USE_TINFO, 1, [if TINFO is enabled]) >+ else >+ AC_MSG_WARN([tinfo not found]) >+ CPPFLAGS="$CLEANCPPFLAGS" >+ fi >+ >+ LIBS="$CLEANLIBS" >+fi >+ >+ > dnl Let's hope this split URL remains working: > dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \ > dnl genprogc/thread_quick_ref.htm >diff --git a/lib/curl_config.h.in b/lib/curl_config.h.in >index 5823939..e4a0c88 100644 >--- a/lib/curl_config.h.in >+++ b/lib/curl_config.h.in >@@ -385,6 +385,9 @@ > /* Define to 1 if you have the `ldap_url_parse' function. */ > #undef HAVE_LDAP_URL_PARSE > >+/* Define to 1 if you have the `tinfo' library (-ltinfo). */ >+#undef HAVE_LIBTINFO >+ > /* Define to 1 if you have the <libgen.h> header file. */ > #undef HAVE_LIBGEN_H > >@@ -743,6 +746,9 @@ > /* Define to 1 if you have the <termio.h> header file. */ > #undef HAVE_TERMIO_H > >+/* Define to 1 if you have the <term.h> header file. */ >+#undef HAVE_TERM_H >+ > /* Define to 1 if you have the <time.h> header file. */ > #undef HAVE_TIME_H > >@@ -996,6 +1002,9 @@ > /* If you want to build curl with the built-in manual */ > #undef USE_MANUAL > >+/* if TINFO is enabled */ >+#undef USE_TINFO >+ > /* if NSS is enabled */ > #undef USE_NSS > >diff --git a/src/tool_cb_prg.c b/src/tool_cb_prg.c >index 457c1a7..b3c2002 100644 >--- a/src/tool_cb_prg.c >+++ b/src/tool_cb_prg.c >@@ -32,6 +32,10 @@ > > #include "memdebug.h" /* keep this as LAST include */ > >+#ifdef USE_TINFO >+# include <term.h> >+#endif >+ > /* > ** callback for CURLOPT_PROGRESSFUNCTION > */ >@@ -85,11 +89,27 @@ int tool_progress_cb(void *clientp, > num = (int) (((double)barwidth) * frac); > if(num > MAX_BARLENGTH) > num = MAX_BARLENGTH; >+ >+ if(bar->dummy_term) { >+ const int diff = num - bar->cnt_printed; >+ if(0 < diff) { >+ bar->cnt_printed = num; >+ num = diff; >+ } >+ else >+ num = 0; >+ } >+ > for(i = 0; i < num; i++) > line[i] = '#'; > line[i] = '\0'; >- snprintf(format, sizeof(format), "\r%%-%ds %%5.1f%%%%", barwidth); >- fprintf(bar->out, format, line, percent); >+ >+ if(bar->dummy_term) >+ fputs(line, bar->out); >+ else { >+ snprintf(format, sizeof(format), "\r%%-%ds %%5.1f%%%%", barwidth); >+ fprintf(bar->out, format, line, percent); >+ } > } > fflush(bar->out); > bar->prev = point; >@@ -105,6 +125,9 @@ void progressbarinit(struct ProgressData *bar, > int scr_size[2]; > #endif > char *colp; >+#ifdef USE_TINFO >+ char *term; >+#endif > > memset(bar, 0, sizeof(struct ProgressData)); > >@@ -143,6 +166,14 @@ void progressbarinit(struct ProgressData *bar, > bar->width = scr_size[0] - 1; > #endif > >+#ifdef USE_TINFO >+ term = curlx_getenv("TERM"); >+ if(term) { >+ bar->dummy_term = (1 != tgetent(NULL, term)) || !tgetstr("cr", NULL); >+ free(term); >+ } >+#endif >+ > bar->out = config->errors; > } > >diff --git a/src/tool_cb_prg.h b/src/tool_cb_prg.h >index f64335a..c0e29fd 100644 >--- a/src/tool_cb_prg.h >+++ b/src/tool_cb_prg.h >@@ -32,6 +32,8 @@ struct ProgressData { > int width; > FILE *out; /* where to write everything to */ > curl_off_t initial_size; >+ bool dummy_term; >+ int cnt_printed; > }; > > void progressbarinit(struct ProgressData *bar, >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 806426
: 575742