Hi

After the help I received improving my backup script, I noticed that
afio 2.4.5 outputs it's backup log to stderr under -o mode, and the
output from -z when used with -o goes the stdout - however, when using
the -t mode to read the tape, the log output goes to stdout, while the
output from -z goes to stderr.

Now, I don't know if there's a reason for this which affects afio's
functionality, I'm not a c programmer, however I thought I'd have a
crack at making simple changes to the code to change this behaviour.

With the attached patch to afio 2.4.5 the behavior of the -o mode
mimics the behaviour of the -t mode, as far as the destination of the
output from the -z and -v options is concerned.

I'm not sure if 2.4.5 is the latest version, but these changes should
be pretty simple to make to any version.

Hope someone finds this useful.

-- 
Pete

[EMAIL PROTECTED]
----------------------------------------------------------------
Linux Registered User # 100652 - Uptime 99 hours, and counting...

-- Awful tagline deleted --
diff -u ./afio.2.4.5/afio.c ./afio.2.4.5-1/afio.c
--- ./afio.2.4.5/afio.c Thu Mar 18 23:35:35 1999
+++ ./afio.2.4.5-1/afio.c       Wed Mar 17 22:07:47 1999
@@ -513,7 +513,7 @@
     {
       reg FILE *stream;
 
-      stream = fn == toc || fn == copyin || arfd == STDOUT ? stderr : stdout;
+      stream = fn == toc || fn == copyin || fn == out || arfd == STDOUT ? stderr : 
+stdout;
       VOID fprintf (stream, "%s: ", myname);
       prsize (stream, total);
       VOID fprintf (stream, " bytes %s in %lu seconds. %s\n",
@@ -791,12 +791,12 @@
        {
           /* we cast to double and print as floating point because
              %Lu printing is buggy above 4G (at least with my C library). */
-         if(printbytepos) fprintf(stderr,"%.0f ",(double)bytepos);
+         if(printbytepos) fprintf(stdout,"%.0f ",(double)bytepos);
 
          if (*uncompto)
-           res = fprintf (stderr, "%s -- uncompressed\n", uncompto);
+           res = fprintf (stdout, "%s -- uncompressed\n", uncompto);
          else
-           res = fprintf (stderr, "%s -- okay\n", name);
+           res = fprintf (stdout, "%s -- okay\n", name);
 
           /* check for broken pipe on stderr */
           if(res<0) {
@@ -2929,12 +2929,12 @@
        
        if (vflag)
        {
-           if(printbytepos) fprintf(stderr,"%.0f ",(double)bytepos);
+           if(printbytepos) fprintf(stdout,"%.0f ",(double)bytepos);
            
            if ((name[0] == '/') && !abspaths && (name[1]!=0))
-               fprintf (stderr, "%s -- ", &name[1]); 
+               fprintf (stdout, "%s -- ", &name[1]); 
            else
-               fprintf (stderr, "%s -- ", name); 
+               fprintf (stdout, "%s -- ", name); 
            
            /* We do not check for a broken pipe on stderr, we wouldn't want
               to stop making the archive if this happens.
@@ -2945,7 +2945,7 @@
        { int i; i=dup(0); close(i); fprintf(stderr,"%d",i); }
 #endif
            if ((fd==ZIPFD)||(fd==MEMFD))
-               VOID fprintf (stderr, "(%02d%%)\n", compression);
+               VOID fprintf (stdout, "(%02d%%)\n", compression);
            else
                VOID fputs ("okay\n", stderr);
        }
@@ -3352,9 +3352,9 @@
       if (vflag)
        {
          if (*uncompto)
-           VOID fprintf (stderr, "%s -- uncompressed\n", uncompto);
+           VOID fprintf (stdout, "%s -- uncompressed\n", uncompto);
          else
-           VOID fprintf (stderr, "%s -- okay\n", name);
+           VOID fprintf (stdout, "%s -- okay\n", name);
        }
     }
 }
Common subdirectories: ./afio.2.4.5/script1 and ./afio.2.4.5-1/script1
Common subdirectories: ./afio.2.4.5/script2 and ./afio.2.4.5-1/script2
Common subdirectories: ./afio.2.4.5/script3 and ./afio.2.4.5-1/script3
Common subdirectories: ./afio.2.4.5/script4 and ./afio.2.4.5-1/script4

Reply via email to