This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH setup 3/4] Log errors from archive_tar.cc


archive_tar.cc contains some output directly using fprintf(stderr,), convert
that to using the printf-style log adaptors.
---
 ChangeLog      |  5 +++++
 archive_tar.cc | 25 +++++++++----------------
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 472030e..bc47a54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2015-03-04  Jon TURNEY  <jon.turney@dronecode.org.uk>
 
+	* archive_tar.cc (archive_tar): Convert from fprintf(stderr, ...)
+	to LogBabblePrintf() or LogPlainPrintf() as appropriate.
+
+2015-03-04  Jon TURNEY  <jon.turney@dronecode.org.uk>
+
 	* msg.cc (msg): Remove.
 	* msg.h (msg): Ditto.
 	* compress_xz.cc (read, bid_xz, bid_lzma): Convert from msg() to
diff --git a/archive_tar.cc b/archive_tar.cc
index 71dcb57..e81efeb 100644
--- a/archive_tar.cc
+++ b/archive_tar.cc
@@ -46,18 +46,11 @@ static int err;
 
 static char buf[512];
 
-int _tar_verbose = 0;
-FILE *_tar_vfile = 0;
-#define vp if (_tar_verbose) fprintf
-#define vp2 if (_tar_verbose>1) fprintf
-
 archive_tar::archive_tar (io_stream * original)
 {
   archive_children = 0;
-  if (_tar_vfile == 0)
-    _tar_vfile = stderr;
 
-  vp2 (_tar_vfile, "tar: open `%p'\n", original);
+  LogBabblePrintf("tar: open `%p'\n", original);
 
   if (!original)
     {
@@ -170,8 +163,8 @@ archive_tar::next_file_name ()
   sscanf (state.tar_header.size, "%Io", &state.file_length);
   state.file_offset = 0;
 
-//  vp2 (_tar_vfile, "%c %9d %s\n", state.tar_header.typeflag,
-//      state.file_length, state.filename);
+  LogBabblePrintf ("%c %9d %s\n", state.tar_header.typeflag,
+                   state.file_length, state.filename);
 
   switch (state.tar_header.typeflag)
     {
@@ -182,8 +175,8 @@ archive_tar::next_file_name ()
       if (state.file_length > CYG_PATH_MAX)
 	{
 	  skip_file ();
-	  fprintf (stderr, "error: long file name exceeds %d characters\n",
-		   CYG_PATH_MAX);
+	  LogPlainPrintf( "error: long file name exceeds %d characters\n",
+                          CYG_PATH_MAX);
 	  err++;
 	  state.parent->read (&state.tar_header, 512);
 	  sscanf (state.tar_header.size, "%Io", &state.file_length);
@@ -215,8 +208,8 @@ archive_tar::next_file_name ()
     case '3':			/* char */
     case '4':			/* block */
     case '6':			/* fifo */
-      fprintf (stderr, "warning: not extracting special file %s\n",
-	       state.filename);
+      LogPlainPrintf ("warning: not extracting special file %s\n",
+                      state.filename);
       err++;
       return next_file_name ();
 
@@ -233,8 +226,8 @@ archive_tar::next_file_name ()
       return state.filename;
 
     default:
-      fprintf (stderr, "error: unknown (or unsupported) file type `%c'\n",
-	       state.tar_header.typeflag);
+      LogPlainPrintf ("error: unknown (or unsupported) file type `%c'\n",
+                      state.tar_header.typeflag);
       err++;
       skip_file ();
       return next_file_name ();
-- 
2.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]