gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 110f50c: Minor corrections in Fits program's -


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 110f50c: Minor corrections in Fits program's --verify info
Date: Sun, 30 Dec 2018 20:56:08 -0500 (EST)

branch: master
commit 110f50c1984707b0ad6d260c56bb6eba2f847e7c
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Minor corrections in Fits program's --verify info
    
    In the book, it was added that with the `--quiet' option, users can supress
    the extra information that is printed with the `--verify' option. Also, in
    the program, the extra information was made to be more clear (with every
    extra line being printed above the final verify outputs (not before and
    after it).
---
 bin/fits/keywords.c | 33 +++++++++++++++++++--------------
 doc/gnuastro.texi   |  4 ++++
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/bin/fits/keywords.c b/bin/fits/keywords.c
index 27717ad..61c3c68 100644
--- a/bin/fits/keywords.c
+++ b/bin/fits/keywords.c
@@ -29,6 +29,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #include <stdlib.h>
 
 #include <gnuastro/fits.h>
+#include <gnuastro-internal/timing.h>
 
 #include <gnuastro-internal/checkset.h>
 
@@ -307,21 +308,25 @@ keywords_verify(struct fitsparams *p, fitsfile **fptr)
   if( fits_verify_chksum(*fptr, &dataok, &hduok, &status) )
     gal_fits_io_error(status, NULL);
 
-  /* Print the verification result. */
-  printf("DATASUM:  %s\n", ( dataok==1
-                             ? "Verified"
-                             : ( dataok==0 ? "NOT-PRESENT" : "INCORRECT" )));
-  printf("CHECKSUM: %s\n", ( hduok==1
-                             ? "Verified"
-                             : ( hduok==0  ? "NOT-PRESENT" : "INCORRECT" )));
-
-  /* Some further information. */
+  /* Print some introduction: */
   if(!p->cp.quiet)
-    printf("\n--------\n"
-           " - DATASUM:  calculated only from the HDU/extension's data (not "
-           "keywords).\n"
-           " - CHECKSUM: calculated from the full header (data and "
-           "keywords).\n\n");
+    printf("%s\n"
+           "Checking integrity of %s (hdu %s)\n"
+           "%s"
+           "--------\n"
+           "Basic info (remove all extra info with `--quiet'):\n"
+           "    - DATASUM: verifies only the data (not keywords).\n"
+           "    - CHECKSUM: verifies data and keywords.\n"
+           "They can be added-to/updated-in an extension/HDU with:\n"
+           "    $ astfits %s -h%s --write=checksum\n"
+           "--------\n", PROGRAM_STRING, p->filename, p->cp.hdu,
+           ctime(&p->rawtime), p->filename, p->cp.hdu);
+
+  /* Print the verification result. */
+  printf("DATASUM:  %s\n",
+         dataok==1 ? "Verified" : ( dataok==0 ? "NOT-PRESENT" : "INCORRECT") );
+  printf("CHECKSUM: %s\n",
+         hduok==1  ? "Verified" : ( hduok==0  ? "NOT-PRESENT" : "INCORRECT") );
 
   /* Return failure if any of the keywords are not verified. */
   return (dataok==-1 || hduok==-1) ? EXIT_FAILURE : EXIT_SUCCESS;
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 3638245..53e2900 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -10401,6 +10401,10 @@ will print @code{NOT-PRESENT}, and if they cannot be 
verified it will print
 @code{INCORRECT}. In the latter case (when the keyword values exist but
 can't be verified), the Fits program will also return with a failure.
 
+By default this function will also print a short description of the
address@hidden AND @code{CHECKSUM} keywords. You can supress this extra
+information with @code{--quiet} option.
+
 @item -Q
 @itemx --quitonerror
 Quit if any of the operations above are not successful. By default if



reply via email to

[Prev in Thread] Current Thread [Next in Thread]