Commits

Mathias Panzenböck committed 3110a2a

better algorithm from appname handling and added README

  • Participants
  • Parent commits 4b0c596

Comments (0)

Files changed (3)

File CMakeLists.txt

 
 target_link_libraries(crc
   ${Boost_SYSTEM_LIBRARY}
+  ${Boost_FILESYSTEM_LIBRARY}
   ${Boost_PROGRAM_OPTIONS_LIBRARY}
 )
 

File README.markdown

+CRC
+===
+Print or check CRC checksums.
+
+Usage
+-----
+	crc [OPTION...] FILE...
+
+	With no FILE, or when FILE is -, read standard input.
+
+	Options:
+	  -b [ --binary ]        read in binary mode
+	  -c [ --check ]         read CRC sums from the FILEs and check them
+	  -t [ --text ]          read in text mode (default)
+	  -a [ --algorithm ] arg CRC algorithm to use. can be: CRC16, CCIT, XMODEM or 
+	                         CRC32
+	  --quiet                don't print OK for each successfully verified file
+	  --status               don't output anything, status code shows success
+	  -w [ --warn ]          warn about improperly formatted checksum lines
+	  -h [ --help ]          display this help and exit
+	  -v [ --version ]       output version information and exit
+	
+	Note: There is no difference between binary and text mode option on GNU system.
+	
+	The options --quiet, --status and --warn are useful only when verifying checksums.
+	
+	The sums are computed using Boosts CRC library.  When checking, the input
+	should be a former output of this program.  The default mode is to print
+	a line with checksum, a character indicating type (`*' for binary, ` ' for
+	text), and name for each FILE.
+
+Setup
+-----
+### Download
+	wget https://bitbucket.org/panzi/crc/get/tip.tar.bz2 -O crc.tar.bz2
+	tar xvjf crc.tar.bz2
+	cd repos*
+
+### Or Clone
+	hg clone https://bitbucket.org/panzi/crc
+	cd crc
+
+### Build and Install
+	mkdir build
+	cd build
+	cmake -DCMAKE_INSTALL_PREFIX=/usr ..
+	make -j2 && sudo make install
+
+This will install a binary called `crc` to `${CMAKE_INSTALL_PREFIX}/bin` and
+create the following symlinks in the same directory:
+
+ * `crc16 -> crc`
+ * `crc32 -> crc`
+ * `ccit -> crc`
+ * `xmodem -> crc`
+
+When using this program through one of these symlinks the `--algorithm` option
+is optional. The algortihm to use is then derived from the symlink name.
+
+Dependencies
+------------
+This project uses following components of the [Boost][1] C++ library:
+
+ * `system`
+ * `filesystem`
+ * `program_options`
+
+[1]: http://www.boost.org/
 int main(int argc, char *argv[]) {
 	appname = argc < 1 ? "crc" : argv[0];
 
-	Alagorithm algorithm = get_algorithm(appname);
+	Alagorithm algorithm = get_algorithm(fs::path(appname).filename());
 	
 	po::options_description desc("Options");
 	desc.add_options()
 		"\n" <<
 		desc <<
 		"\n"
+		"Note: There is no difference between binary and text mode option on GNU system.\n"
+		"\n"
+		"The options --quiet, --status and --warn are useful only when verifying checksums.\n"
+		"\n"
 		"The sums are computed using Boosts CRC library.  When checking, the input\n"
 		"should be a former output of this program.  The default mode is to print\n"
 		"a line with checksum, a character indicating type (`*' for binary, ` ' for\n"