Index: /trunk/Makefile
===================================================================
--- /trunk/Makefile	(revision 104)
+++ /trunk/Makefile	(revision 105)
@@ -30,4 +30,11 @@
 LIBS = $(CFITSIOLIB) -lm
 CINC=  $(CFITSIOINC)
+
+USE_PVO_HH = $(BASE)/pvoconesearch.o\
+	$(BASE)/pvotapesummary.o\
+	$(BASE)/pvoconvert.o\
+	$(BASE)/pvo-FITS.o\
+	$(BASE)/pvo-metadata.o\
+	$(BASE)/pvosummary.o
 
 USE_METADATA_HH = $(BASE)/pvo-metadata.o\
@@ -159,4 +166,5 @@
 
 
+$(USE_PVO_HH) : $(BASE)/pvo.hh
 $(USE_UTILS_HH) : $(BASE)/pvo-utils.hh
 $(USE_HEADER_HH) : $(BASE)/pvo-header.hh
Index: /trunk/src/pvo-FITS.cc
===================================================================
--- /trunk/src/pvo-FITS.cc	(revision 104)
+++ /trunk/src/pvo-FITS.cc	(revision 105)
@@ -5,4 +5,5 @@
 #include <time.h>
 #include <fitsio.h>
+#include "pvo.hh"
 #include "pvo-FITS.hh"
 #include "pvo-utils.hh"
@@ -146,22 +147,40 @@
     
   
-    //------------------------------------------------------------------------  
-
-    void PSRFits::setCommandLine(int argc, char *argv[])
-    {
-      std::stringstream ss;
+    //------------------------------------------------------------------------
+
+    void PSRFits::setCommandLine(char *executable, std::string inputFile)
+    {
+      /**
+       *  Generates a string showing what the effective shell command
+       *  was to generate the FITS file. The executable name has any
+       *  leading directories stripped off. The input name inputFile
+       *  is assigned the PSRFits::oldFilename string. No change is
+       *  made to this name (i.e. no leading directories are removed).
+       *
+       * \param executable The name of the executable from the command
+       *                    line. Can be argv[0] from 
+       *                    main(int argc, char *argv[]).
+       * \param inputFile The name of the input file.
+       */
+
+
+      //the stringstream to produce the commandLine string
+      std::stringstream ss; 
 
       // strip off any leading directory from the executable.
-      std::string exec = argv[0];
+      std::string exec = executable;
       unsigned int found = exec.rfind("/");
       if(found != std::string::npos){
 	exec = exec.substr(found+1,exec.size()-1);
       }
-
-      ss << exec;
-      for(int i=1;i<argc;i++){
-	if(i>0) ss << " ";
-	ss << argv[i];
-      }
+      // write the executable to the string
+      ss << exec << " ";
+
+      // write the input filename after the executable.
+      //  This avoids problems with wildcards or the use of the -D option.
+      this->setOldFilename(inputFile);
+      ss << this->oldFilename;
+
+      // write the string to this->commandLine
       this->commandLine = ss.str();
 
Index: /trunk/src/pvo-FITS.hh
===================================================================
--- /trunk/src/pvo-FITS.hh	(revision 104)
+++ /trunk/src/pvo-FITS.hh	(revision 105)
@@ -269,7 +269,7 @@
 
       /** Dealing with the command line arguments */
-      void        setCommandLine(int argc, char *argv[]);
-
-      /** Storing the name of the old-format data file */
+      void        setCommandLine(char *executable, std::string inputFile);
+
+      /** Storing the name of the old-format (input) data file */
       void        setOldFilename(std::string filename){oldFilename = filename;};
       /** Report a CFITSIO error, along with the offending function. */
Index: /trunk/src/pvo-metadata.cc
===================================================================
--- /trunk/src/pvo-metadata.cc	(revision 104)
+++ /trunk/src/pvo-metadata.cc	(revision 105)
@@ -4,4 +4,5 @@
 #include <vector>
 #include <unistd.h>
+#include "pvo.hh"
 #include "pvo-metadata.hh"
 #include "pvo-FITS.hh"
Index: /trunk/src/pvo-metadata.hh
===================================================================
--- /trunk/src/pvo-metadata.hh	(revision 104)
+++ /trunk/src/pvo-metadata.hh	(revision 105)
@@ -3,4 +3,5 @@
 #include <fitsio.h>
 #include <string>
+#include "pvo.hh"
 #include "pvo-FITS.hh"
 #include "pvo-utils.hh"
Index: /trunk/src/pvo-utils.hh
===================================================================
--- /trunk/src/pvo-utils.hh	(revision 104)
+++ /trunk/src/pvo-utils.hh	(revision 105)
@@ -8,130 +8,4 @@
 {
 
-  /** Standard NULL value for strings. */
-  const std::string nullString = "NULL";
-
-  /** Standard NULL value for floats. */
-  const float       nullFloat = -9999.;
-
-  /** Standard NULL value for ints. */
-  const int         nullInt = -9999;
-
-  /** Help text for pvoconvert -h */
-  const std::string pvoconvert_usage_text = 
-"Usage: pvoconvert [options] <survey file(s)> ...\n\
-  Options:\n\
-  -D <dir>          Run pvoconvert on all files in the stated directory.\n\
-  --directory <dir>\n\
-                     No <survey file> needs to be given in this case.\n\
-  -H                Use the PH (High Latitude) Survey settings, rather than\n\
-  --highlat          those for the PM/Multibeam Survey\n\
-  -h                Display this help page.\n\
-  --help\n\
-  -v                Verbose mode for error/warning messages.\n\
-  --verbose\n\
----------\n\n\
- PVOConvert converts pulsar survey data into PSRFITS format.\n\
- It can distinguish between the 70cm data and 21cm Multibeam data, but to\n\
-  specify particular data as coming from the High Latitude survey rather\n\
-  than the standard Multibeam survey, use the -h option.\n\
- Note that more than one input file can be given.\n\
- Output files will be encoded according to the survey type and date & time\n\
-  of observation.\n";
-  /** Brief help text for pvoconvert -h */
-  const std::string pvoconvert_usage_text_short = 
-"Usage: pvoconvert [options] <survey file(s)>\n\
-  Options:\n\
-  -D <dir>          Run pvoconvert on all files in the stated directory.\n\
-  --directory <dir>\n\
-                     No <survey file> needs to be given in this case.\n\
-  -H                Use the PH (High Latitude) Survey settings, rather than\n\
-  --highlat          those for the PM/Multibeam Survey\n\
-  -h                Display this help page.\n\
-  --help\n\
-  -v                Verbose mode for error/warning messages.\n\
-  --verbose\n";
-
-  /** Help text for pvosummary -h */
-  const std::string pvosummary_usage_text = 
-"Usage:\n\
-  1. pvosummary [options]\n\
-  2. pvosummary [options] <FILE>\n\
----------\n\
- pvosummary  prints out some basic metadata for either all FITS files in the\n\
-  current directory (example 1), or a single FITS file (example 2).\n\
- The parameters printed out are:\n\
-   FILENAME, SRC_NAME, RAJ, DECJ, BEAM FWHM, OBSFREQ, SCANLEN, DATE-OBS\n\
- If a keyword is not present, "+nullString+" is printed.\n\
- The full set of parameters can be written in csv format to a file using the\n\
-   -c or --csv option.\n\
- The list of parameters can be obtained by using the -p option.\n\
- FITS files are assumed to have suffixes of .fits or .rf\n\n\
- Options:\n\
- -c <file>    Write all parameters in csv format to the specified file.\n\
- --csv <file>\n\
- -p           List all parameters\n\
- -q           Quiet mode -- nothing printed to screen\n\
-               (used in conjunction with -c)\n\
- -h           Print this help message.\n\
- --help \n\
- -v           Verbose mode for error/warning messages.\n\
- --verbose\n\
----------\n\
-";
-  /** Brief help text for pvosummary -h */
-  const std::string pvosummary_usage_text_short = 
-"Usage:\n\
-  1. pvosummary [options]\n\
-  2. pvosummary [options] <FILE>\n\
- Options:\n\
- -c <file>    Write all parameters in csv format to the specified file.\n\
- --csv <file>\n\
- -p           List all parameters\n\
- -q           Quiet mode -- nothing printed to screen\n\
-               (used in conjunction with -c)\n\
- -h           Print a help message.\n\
- --help\n\
- -v           Verbose mode for error/warning messages.\n\
- --verbose\n";
-
-  /** Help text for pvotapesummary -h */
-  const std::string pvotapesummary_usage_text = 
-"Usage:\n\
-  1. pvotapesummary [FILE] ...\n\
-  2. pvotapesummary -d <DIR>\n\
----------\n\
- pvotapesummary  prints out some basic metadata for either all tape survey files\n\
-  provided as arguments (#1), or all files in the specified directory (#2).\n\
- You can optionally specify individual files: the alternative is to examine each\n\
-  file in the directory.\n\
- The metadata is taken just from the first block in the tape file.\n\
- The parameters printed out are:\n\
-   FILENAME, RA, DEC, OBSFREQ, SCANLEN, MOVE, DATE-OBS\n\
----------\n\
-";
-
-  /** Help text for pvoconesearch -h */
-  const std::string pvoconesearch_usage_text = 
-"Usage:\n\
-  1. pvoconesearch ra dec radius\n\
-  2. pvoconesearch -h\n\
----------\n\
-  1. Prints RA, DEC, BEAM FWHM, OBSFREQ, DATE-OBS, OFFSET for all FITS files\n\
-     that lie within \"radius\" of the position given by ra, dec.\n\
-     OFFSET is angular offset from query position.\n\
-  2. Prints this help information.\n\n\
- The valid files are listed in order of increasing angular separation from\n\
-  the query position.\n\
- The RA and DEC can be in the form hh:mm:ss.ss etc or in decimal degrees.\n\
- The search radius is in degrees. The beam size is also taken into account,\n\
-  so the effective search radius becomes (radius + 0.5*beamFWHM).\n\
- Note that if a keyword is not present, NULL is printed.\n\
- FITS files are assumed to have suffixes of .fits or .rf\n";
-  /** Brief help text for pvoconesearch -h */
-  const std::string pvoconesearch_usage_text_short = 
-"Usage:\n\
-  1. pvoconesearch ra dec radius\n\
-  2. pvoconesearch -h\n";
-
   /** Report a general error, along with the offending function. */
   void PVOError(std::string subroutine, std::string error);
@@ -140,7 +14,4 @@
   inline std::string getPSRFITSdefn(){ 
     return getenv("PSRFITSDEFN"); 
-
-    //   std::cerr << "Using local PSRFITS definition! --> $PVO/templates/psrheader_20070209.fits\n"; 
-    //   return "/DATA/SITAR_1/whi550/VO/PulsarVO/templates/psrheader_20070209.fits"; 
   };
 
Index: /trunk/src/pvo.hh
===================================================================
--- /trunk/src/pvo.hh	(revision 105)
+++ /trunk/src/pvo.hh	(revision 105)
@@ -0,0 +1,160 @@
+#ifndef PVO_HH_
+#define PVO_HH_
+#include <iostream>
+
+namespace PVO
+{
+
+  /** Version number of PVO programs */
+  const std::string PVO_VERSION = "1.0";
+  
+  const std::string PVOCONVERT = "pvoconvert";
+  const std::string PVOSUMMARY = "pvosummary";
+  const std::string PVOCONESEARCH = "pvoconesearch";
+  const std::string PVOTAPESUMMARY = "pvotapesummary";
+
+  /** Standard NULL value for strings. */
+  const std::string nullString = "NULL";
+
+  /** Standard NULL value for floats. */
+  const float       nullFloat = -9999.;
+
+  /** Standard NULL value for ints. */
+  const int         nullInt = -9999;
+
+  /** Help text for pvoconvert -h */
+  const std::string pvoconvert_usage_text = 
+"Usage: pvoconvert [options] <survey file(s)> ...\n\
+  Running options:\n\
+  -D <dir>          Run pvoconvert on all files in the stated directory.\n\
+  --directory <dir>\n\
+                     No <survey file> needs to be given in this case.\n\
+  -H                Use the PH (High Latitude) Survey settings, rather than\n\
+  --highlat          those for the PM/Multibeam Survey\n\
+  -V                Verbose mode for error/warning messages.\n\
+  --verbose\n\
+\n\
+  Other options:\n\
+  -h                Display this help page.\n\
+  --help\n\
+  -v                Display the version number.\n\
+  --version\n\
+---------\n\n\
+ PVOConvert converts pulsar survey data into PSRFITS format.\n\
+ It can distinguish between the 70cm data and 21cm Multibeam data, but to\n\
+  specify particular data as coming from the High Latitude survey rather\n\
+  than the standard Multibeam survey, use the -h option.\n\
+ Note that more than one input file can be given.\n\
+ Output files will be encoded according to the survey type and date & time\n\
+  of observation.\n";
+  /** Brief help text for pvoconvert -h */
+  const std::string pvoconvert_usage_text_short = 
+"Usage: pvoconvert [options] <survey file(s)> ...\n\
+  Running options:\n\
+  -D <dir>          Run pvoconvert on all files in the stated directory.\n\
+  --directory <dir>\n\
+                     No <survey file> needs to be given in this case.\n\
+  -H                Use the PH (High Latitude) Survey settings, rather than\n\
+  --highlat          those for the PM/Multibeam Survey\n\
+  -V                Verbose mode for error/warning messages.\n\
+  --verbose\n\
+\n\
+  Other options:\n\
+  -h                Display the help page.\n\
+  --help\n\
+  -v                Display the version number.\n\
+  --version\n";
+
+  /** Help text for pvosummary -h */
+  const std::string pvosummary_usage_text = 
+"Usage:\n\
+  1. pvosummary [options]\n\
+  2. pvosummary [options] <FILE>\n\
+---------\n\
+ pvosummary  prints out some basic metadata for either all FITS files in the\n\
+  current directory (example 1), or a single FITS file (example 2).\n\
+ The parameters printed out are:\n\
+   FILENAME, SRC_NAME, RAJ, DECJ, BEAM FWHM, OBSFREQ, SCANLEN, DATE-OBS\n\
+ If a keyword is not present, "+nullString+" is printed.\n\
+ The full set of parameters can be written in csv format to a file using the\n\
+   -c or --csv option.\n\
+ The list of parameters can be obtained by using the -p option.\n\
+ FITS files are assumed to have suffixes of .fits or .rf\n\n\
+ Running options:\n\
+ -c <file>    Write all parameters in csv format to the specified file.\n\
+ --csv <file>\n\
+ -p           List all parameters\n\
+ -q           Quiet mode -- nothing printed to screen\n\
+               (used in conjunction with -c)\n\
+ -V           Verbose mode for error/warning messages.\n\
+ --verbose\n\
+  Other options:\n\
+ -h           Print this help message.\n\
+ --help \n\
+ -v           Print the version number.\n\
+ --version \n\
+---------\n\
+";
+  /** Brief help text for pvosummary -h */
+  const std::string pvosummary_usage_text_short = 
+"Usage:\n\
+  1. pvosummary [options]\n\
+  2. pvosummary [options] <FILE>\n\
+ Running options:\n\
+ -c <file>    Write all parameters in csv format to the specified file.\n\
+ --csv <file>\n\
+ -p           List all parameters\n\
+ -q           Quiet mode -- nothing printed to screen\n\
+               (used in conjunction with -c)\n\
+ -v           Verbose mode for error/warning messages.\n\
+ --verbose\n\
+ Other options:\n\
+ -h           Print a help message.\n\
+ --help\n\
+ -v           Print the version number.\n\
+ --version \n";
+
+  /** Help text for pvotapesummary -h */
+  const std::string pvotapesummary_usage_text = 
+"Usage:\n\
+  1. pvotapesummary [FILE] ...\n\
+  2. pvotapesummary -d <DIR>\n\
+---------\n\
+ pvotapesummary  prints out some basic metadata for either all tape survey files\n\
+  provided as arguments (#1), or all files in the specified directory (#2).\n\
+ You can optionally specify individual files: the alternative is to examine each\n\
+  file in the directory.\n\
+ The metadata is taken just from the first block in the tape file.\n\
+ The parameters printed out are:\n\
+   FILENAME, RA, DEC, OBSFREQ, SCANLEN, MOVE, DATE-OBS\n\
+---------\n\
+";
+
+  /** Help text for pvoconesearch -h */
+  const std::string pvoconesearch_usage_text = 
+"Usage:\n\
+  1. pvoconesearch ra dec radius\n\
+  2. pvoconesearch -h\n\
+---------\n\
+  1. Prints RA, DEC, BEAM FWHM, OBSFREQ, DATE-OBS, OFFSET for all FITS files\n\
+     that lie within \"radius\" of the position given by ra, dec.\n\
+     OFFSET is angular offset from query position.\n\
+  2. Prints this help information.\n\n\
+ The valid files are listed in order of increasing angular separation from\n\
+  the query position.\n\
+ The RA and DEC can be in the form hh:mm:ss.ss etc or in decimal degrees.\n\
+ The search radius is in degrees. The beam size is also taken into account,\n\
+  so the effective search radius becomes (radius + 0.5*beamFWHM).\n\
+ Note that if a keyword is not present, NULL is printed.\n\
+ FITS files are assumed to have suffixes of .fits or .rf\n";
+  /** Brief help text for pvoconesearch -h */
+  const std::string pvoconesearch_usage_text_short = 
+"Usage:\n\
+  1. pvoconesearch ra dec radius\n\
+  2. pvoconesearch -h\n";
+
+
+
+}
+
+#endif // PVO_HH_
Index: /trunk/src/pvoconesearch.cc
===================================================================
--- /trunk/src/pvoconesearch.cc	(revision 104)
+++ /trunk/src/pvoconesearch.cc	(revision 105)
@@ -5,4 +5,5 @@
 #include <string>
 #include <glob.h>
+#include "pvo.hh"
 #include "pvo-block.hh"
 #include "pvo-header.hh"
Index: /trunk/src/pvoconvert.cc
===================================================================
--- /trunk/src/pvoconvert.cc	(revision 104)
+++ /trunk/src/pvoconvert.cc	(revision 105)
@@ -7,4 +7,5 @@
 #include <getopt.h>
 #include <glob.h>
+#include "pvo.hh"
 #include "pvo-block.hh"
 #include "pvo-header.hh"
@@ -69,8 +70,10 @@
       {"highlat", 0, 0, 'H'},
       {"directory", 1, 0, 'D'},
+      {"verbose", 1, 0, 'V'},
+      {"version", 1, 0, 'v'},
       {0, 0, 0, 0}
     };
 
-    c = getopt_long (argc, argv, "D:Hvh",
+    c = getopt_long (argc, argv, "D:HVvh",
 		     long_options, &option_index);
 
@@ -96,6 +99,14 @@
       }
       break;
-    case 'v': // use verbose mode
+    case 'v': // return version number
+      std::cout << PVO::PVOCONVERT << " version " << PVO::PVO_VERSION << "\n";
+      return 0;
+      break;
+    case 'V': // use verbose mode
       verbFlag = true;
+      if(argc==2){
+	std::cout << PVO::pvoconvert_usage_text_short;
+	return 1;
+      }
       break;
     case 'h': // give help statement
@@ -170,6 +181,6 @@
       PSRFits fitsfile;
       fitsfile.setVerbosity(verbFlag);
-      fitsfile.setOldFilename(fname);
-      fitsfile.setCommandLine(argc,argv);
+      //      fitsfile.setOldFilename(fname);
+      fitsfile.setCommandLine(argv[0],fname);
 
       if(fitsfile.initialise(block) == FAILURE){
Index: /trunk/src/pvosummary.cc
===================================================================
--- /trunk/src/pvosummary.cc	(revision 104)
+++ /trunk/src/pvosummary.cc	(revision 105)
@@ -7,4 +7,5 @@
 #include <unistd.h>
 #include <getopt.h>
+#include "pvo.hh"
 #include "pvo-block.hh"
 #include "pvo-header.hh"
@@ -70,8 +71,10 @@
       {"help", 0, 0, 'h'},
       {"csv", 1, 0, 'c'},
+      {"verbose", 1, 0, 'V'},
+      {"version", 1, 0, 'v'},
       {0, 0, 0, 0}
     };
 
-    c = getopt_long (argc, argv, "c:hpqv",
+    c = getopt_long (argc, argv, "c:hpqvV",
 		     long_options, &option_index);
 
@@ -95,5 +98,9 @@
       return 0;
       break;
-    case 'v': // verbose mode -- full verbosity for error messages
+    case 'v': // return version number
+      std::cout << PVO::PVOSUMMARY << " version " << PVO::PVO_VERSION << "\n";
+      return 0;
+      break;
+    case 'V': // use verbose mode -- full verbosity for error messages
       verboseflag = true;
       break;
Index: /trunk/src/pvotapesummary.cc
===================================================================
--- /trunk/src/pvotapesummary.cc	(revision 104)
+++ /trunk/src/pvotapesummary.cc	(revision 105)
@@ -7,4 +7,5 @@
 #include <unistd.h>
 #include <getopt.h>
+#include "pvo.hh"
 #include "pvo-block.hh"
 #include "pvo-header.hh"
