pax_global_header00006660000000000000000000000064111704103720014506gustar00rootroot0000000000000052 comment=544da8c27b3b7791f2a1df0f8d40d9f495d77a6a cksfv-1.3.14/000077500000000000000000000000001117041037200127105ustar00rootroot00000000000000cksfv-1.3.14/AUTHORS000066400000000000000000000006231117041037200137610ustar00rootroot00000000000000Heikki Orsila : current maintainer Bryan Call : original author Minor modifications: Mike Appelman : Nautilus 2 CheckSFV script Dieter Baron : checksuming for a subset of files in sfv Tobias Nygren : remove useless computations from crc32() Durk van Veen : added directory recursion cksfv-1.3.14/COPYING000066400000000000000000000430761117041037200137550ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. cksfv-1.3.14/ChangeLog000066400000000000000000000255061117041037200144720ustar00rootroot000000000000002009-04-12 Heikki Orsila * Version 1.3.14 - Install the man page with proper permissions - Fix buffer underflow [CORRECTIVE] - Cleanup and fix sfv reading [CORRECTIVE] [PREVENTIVE] - Fix test script reporting [CORRECTIVE] - Consistent return value (1) for exit() [PREVENTIVE] 2008-08-24 Heikki Orsila * Version 1.3.13 - Bug fixes - Documentation improvements 2007-08-12 Heikki Orsila * Version 1.3.12 - Code cleanups - Documentation improvements - Added -g option that replaces -f in most cases. Instead of running cksfv -C foo -f foo/bar.sfv one can just run: cksfv -g foo/bar.sfv 2007-07-11 Heikki Orsila * Version 1.3.11 - Nautilus 2 CheckSFV script - 64 bit file offset support for some platforms 2007-07-11 Heikki Orsila - Added a bash script (scripts/CheckSFV) for checking SFV files with Nautilus 2. You can install the script manually by: cp scripts/CheckSFV ~/.gnome2/nautilus-scripts/ Contributed by Mike Appelman . 2007-05-24 Heikki Orsila - Added -D_FILE_OFFSET_BITS=64 for some 32 bit platforms to support files large files properly (Catalin Boie) [PERFECTIVE] [ADAPTIVE] - Change log and version control log will from now use 1-4 tags, which are: [PREVENTIVE], [PERFECTIVE], [ADAPTIVE] and [CORRECTIVE]. [PREVENTIVE] means preventive maintenance actions, such as assertions and self-tests. [PERFECTIVE] means actions improving program quality or adding features. [ADAPTIVE] means changes to adapt to certain run-time environment. [CORRECTIVE] means bug fixes. 2007-03-25 Heikki Orsila * Version 1.3.10 - Added an option (-c) for remote programs to monitor sfv checking more easily - MinGW fixes 2007-03-25 Heikki Orsila - Added -c option to force progress and final resolution prints to stdout. See the man page. 2006-07-01 Heikki Orsila - Merged experimental support for MinGW build process from Yar Tikhiy . I did some modifications to the patch submitted by Yar and did not test the result, so expect this doesn't work yet. - Fixed MinGW OS recognition in configure script (hopefully works this time) 2006-03-07 Heikki Orsila * Version 1.3.9 - Fixed large file support for Solaris (Mark Niggemann ) - Added an option that converts backslashes to slashes. It is useful for checking sfv files generated by Windows systems. The feature was implemented by Tero Halla-aho . 2006-03-06 Heikki Orsila - If uname matches SunOS, add -D_FILE_OFFSET_BITS=64 to support files bigger than 2 GiB. Thanks to Mark Niggemann for finding and fixing the problem. 2006-02-15 Heikki Orsila - Added an option that converts backslashes to slashes. It is useful for checking sfv files generated by Windows systems. The feature was implemented by Tero Halla-aho . 2006-01-01 Heikki Orsila * Version 1.3.8 - configure and Makefile cleanups and fixes. 2005-10-24 Heikki Orsila - Mike Frysinger pointed out several things about the build procedure: - -W/-O flags are useless in header checks in the configure script - $compiler was not used for header checks in the configure script - Cleaned CFLAGS handling so that if CFLAGS is set by the environment, the default -O2 is stripped away from the src/Makefile.in. 2005-10-23 Heikki Orsila * Version 1.3.7 - Fixed INSTALL documentation. The INSTALL file documented the old behaviour, where editing Makefile was required for installing to an alternative path. - Fixed 'configure --help' to report usage properly. '--prefix dir' => '--prefix=dir'. - Shortened cksfv output to print only 2 lines to the beginning of a newly created sfv file. cksfv version, date, time, and the project web site URL. - A stack corruption and localtime error fix by T. Farago - Added -b option to the command line help. 2005-10-03 Heikki Orsila - Fixed a stack corruption error and localtime error in prsfv_head() / print.c. The fix was provided by T. Farago . - Fixed command line help. It missed explanation of -b option. 2005-08-08 Heikki Orsila * version 1.3.6 - Portability fix for Solaris (Stefan Alfredsson ) 2005-08-03 Heikki Orsila - A configure script bug was fixed that prevented inttypes.h from being detected if stdint.h doesn't exist. This bug seems affect some Solaris systems (they had inttypes.h but no stdint.h). Thanks to Stefan Alfredsson for the fix. - Added optimization into the configure script. Now inttypes.h is not checked if stdint.h exists. 2005-06-07 Heikki Orsila * version 1.3.5 - recursive SFV checking support by Travis Poppe - portability fix for OpenBSD 2005-05-22 Heikki Orsila * version 1.3.5-pre2 - portable integer type #include fix for OpenBSD and possibly others. thanks to Daniel Kĺkneryd for pointing out the problem. (shd) 2005-05-12 Heikki Orsila * version 1.3.5-pre1 - (copied from 2005-05-11) feature that prints out sfv files with broken files and broken sfv files when recursive sfv checking is enabled. this is useful because print out in recursive mode can be long. one sees those sfv files that failed at the end of the output. Thanks to Travis Poppe for suggesting this feature (shd) 2005-05-11 Heikki Orsila - feature that prints out sfv files with broken files and broken sfv files when recursive sfv checking is enabled. this is useful because print out in recursive mode can be long. one sees those sfv files that failed at the end of the output. Thanks to Travis Poppe for suggesting this feature (shd) 2005-04-04 Heikki Orsila * version 1.3.4 - compatibility fixes - recursive sfv file checking support by Durk van Veen 2005-03-26 Heikki Orsila - trivial fix for 'make check'. It wasn't posix sh compatible. On bash "==" is the same as "=". 2005-03-26 Heikki Orsila * version 1.3.4-pre5 - added recursion support from Durk van Veen 2005-03-21 Heikki Orsila - fixed 'make install' bug. Man dir was not created properly. Thanks to Durk van Veen for finding this. 2005-02-21 Heikki Orsila * version 1.3.4-pre1 - consistent policy for BSD and Linux systems. Trying to checksum a directory lead to different actions. Also, trying to verify checksum of a directory bugged. 2005-02-06 Heikki Orsila - 'make check' executes tests. 'make tests' doesn't. 2005-02-04 Heikki Orsila * version 1.3.3 - lots of changes. see previous changelog entries. 2005-02-04 Heikki Orsila - configure script now ignore unknown arguments (but gives a warning) - configure allows setting mandir and compiler. Examples: --mandir=/usr/man --compiler=/opt/experimental/gcc-4/bin/gcc - fixed wording in man file (Thomas Klausner) - -b option: print only basenames of the given files when creating an sfv. 2005-02-03 Heikki Orsila - fixed O_LARGEFILE for macosx - Thomas Klausner submitted partial sfv checking patch by Dieter Baron . Now cksfv -f foo.sfv [FILE1 FILE2 ...] checks only given FILES. - Thomas Klausner submitted patch by Tobias Nygren to avoid calculating CRC twice per file (read once, compute twice). 2005-02-03 Heikki Orsila * version 1.3.2 - solaris printf workaround. use %lu tu print filesizes. works best on 64-bit architectures (with compilers assuming sizeof(long) == sizeof(size_t)). GNU/Linux support %zu which is the appropriate modifier for this case, but can't have it everywhere. - doesn't print directory infos into catalogues when creating sfvs - see other modifications since 1.3.1 (many of them) 2005-01-26 Heikki Orsila - fixed output (displayed only 32-bit file sizes, and months wrong) OLD: ; 100663296 14:54.37 2005-00-25 zeros NEW: ; 4395630592 14:54.37 2005-01-25 zeros - lots of code cleanups - solaris fixes 2005-01-25 Heikki Orsila * no new version - Added and edited man page from Debian distribution - Fixed Makefile issues for -jx - Added a simple configure script for more consistent compilation - Removed b0rken rpm creation from Makefile - Removed spam messages (when creating and verifying checksums) - Added test cases (make tests) - added fake and lousy stdint.h generation (OS that don't have it should be upgraded) 2005-01-24 Heikki Orsila * no new version - I decided to start maintaining the program since Bryan Call is unreachable. 2004-05-25 Heikki Orsila * version 1.3.1 - Fixed 64-bit issues. Went into Gentoo portage. 2000-12-28 Bryan Call * version 1.3 - Fixed the problem with ignoring case. Lots of people have mentioned it (used the patch from Harold Gutch). - Now will compile on RedHat 7.1. 2000-12-28 Bryan Call * version 1.2 - Fixed the a problem when making a new sfv it was not being zero padded (found by Justin Head and Andre Tertling). - Added the idea, when insensitive matching is activated, it will treat "_" and " " equal. For example it will treat "foo_bar.txt" and "Foo Bar.txt" the same (suggested and patch given by Andree Borrmann). - Made it so it will not choke on blank lines. 2000-05-18 Bryan Call * version 1.1 - Added verbose to the program. Now the program will list what file it is working on and the status of the file. When it is finished it will display a final result, if it encountered any errors or not, and it will print the bell character. You can turn this off with the -q option (quiet). - Moved some functions around a some other minor stuff. 2000-05-16 Bryan Call * version 1.0 - This is the first version that has been released for public consumption. Hopefully, I have worked out most of the bugs. I have this working on FreeBSD 3.4 and Redhat 6.1 (i386). cksfv-1.3.14/INSTALL000066400000000000000000000012461117041037200137440ustar00rootroot000000000000001. Unpack the source somewhere, and go to the new directory. 2. Configure the program: $ ./configure You may use ./configure --help to find out which possible configure parameters are possible. Most important parameters are: --prefix=dir Set installation path prefix (default is /usr/local) --package-prefix=dir Prefix installed file names with 3. Compile the program: $ make 4. To install the program, type as root: # make install Optionally you may run some tests to verify that the program works correctly with your system. After compiling the program, you may issue: $ make check 'make check' will report if the compiled program fails any standard tests. cksfv-1.3.14/Makefile.in000066400000000000000000000020771117041037200147630ustar00rootroot00000000000000# Makefile for cksfv (Check SFV) # Copyright (C) 2000 Bryan Call # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. BINDIR={BINDIR} MANDIR={MANDIR} all: cd src && $(MAKE) install: all mkdir -p "$(BINDIR)" "$(MANDIR)/man1/" install src/cksfv "$(BINDIR)" install -m 644 cksfv.1 "$(MANDIR)/man1/" clean: rm -f *.o *~ *.core core rm -f rpm/*.o rpm/*~ rpm/*.core rpm/core cd src && $(MAKE) clean check: all cd test && ./test.sh cksfv-1.3.14/README000066400000000000000000000006171117041037200135740ustar00rootroot00000000000000== Introduction == cksfv is a tool verifying CRC32 checksums. Read cksfv.1 man page for instructions. See AUTHORS and COPYING files for copyright information. == A note about the program creator == A note from Heikki Orsila : It seems Bryan Call has gone underground. New versions (mainly bug fixes) of the program can be obtained from: http://www.iki.fi/shd/foss/cksfv/ cksfv-1.3.14/README.win32000066400000000000000000000013401117041037200145270ustar00rootroot00000000000000INTRODUCTION This version of cksfv can be built with MinGW to produce a native MS Windows console application. It will require no additional DLL beyond the standard environment provided by MS Windows 95/98/ME/2000/XP/2003 or newer. PREREQUISITES MinGW gcc-core, mingw-runtime, mingw32-make, and w32api are required to build cksfv. The commands, gcc and mingw32-make, should be in PATH. Unix utilities are required in PATH to run tests from the cksfv distribution. UnxUtils is known to work. GnuWin32 and MSYS are unverified, but they are likely to work, too. BUILDING AND INSTALLING Read INSTALL. Some compatibility source files are copied from win32/ to src/ directory otherwise the build process is similar to UNIX systems. cksfv-1.3.14/TODO000066400000000000000000000007061117041037200134030ustar00rootroot00000000000000- Add the ability to have a comments file when creating .sfv files. - Better README this will have to be a constant upgrade. - Make verbose by default a compile time option. - More meaningfull exit values. - Show an estimated time to complete checks and the creation of new sfv files. - fix rpm creation - add deb support - exit with error on first false checksum or fault - Fix case insensitive file scanning. Affects names with / in sfv files. cksfv-1.3.14/cksfv.1000066400000000000000000000065141117041037200141140ustar00rootroot00000000000000.TH CKSFV 1 .\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection .\" other parms are allowed: see man(7), man(1) .SH NAME cksfv \- tests and creates simple file verification (SFV) listings .SH SYNOPSIS .B cksfv .I "[-bciqrL] [-C dir] [-f file] [-g path] [file ...]" .br .SH "DESCRIPTION" .BR cksfv is a tool for verifying CRC32 checksums of files. CRC32 checksums are used to verify that files are not corrupted. The algorithm is cryptographically crippled so it can not be used for security purposes. .BR md5sum (1) or .BR sha1sum (1) are much better tools for checksuming files. cksfv should only be used for compatibility with other systems. cksfv has two operation modes: checksum creation and checksum verification In .BR checksum\ creation\ mode cksfv outputs CRC32 checksums of files to to stdout, normally redirected to an .sfv file. In .BR checksum\ verification\ mode cksfv reads filenames from an sfv file, and compares the recorded checksum values against recomputed checksums of files. .SH OPTIONS These options are available .TP .B \-b Strip dirnames from filenames that are checksumed. loads the files from original positions, but prints only basenames to catalogue in sfv file. .TP .B \-c Use stdout for printing progress and final resolution (files OK or some errors detected). This is useful for external programs analysing output of cksfv. This also forces fflushes on the output when needed. .TP .B \-C dir .BR Change current directory before proceeding with a verification operation. This option is mostly obsoleted with -g option. Earlier this was used to verify checksums in a different directory: cksfv -C foo -f foo/bar.sfv .TP .B \-f file Verify checksums in the sfv file .TP .B \-g path Go to the path name directory and verify checksums in the sfv file .TP .B \-i Ignore case in filenames. This is used in the checksum verification mode. .TP .B \-L Follow symlinks when recursing subdirectories. This option is used with the -r option. .TP .B \-q Enable QUIET mode (instead of verbose mode), only error messages are printed .TP .B \-v Enable VERBOSE mode, this is the default mode .TP .B \-r recurse directories and check the .sfv files in each. Symlinks are not followed by default. This option cannot be used with -f and -g options. .SH EXAMPLES .nf Verify checksums of files listed in 'foo/files.sfv': .ft B cksfv -g foo/files.sfv .ft R Create checksums for a set of files: .ft B cksfv *.gz > files.sfv .ft R Verify checksums of case-insensitive filenames listed in 'files.sfv'. This is sometimes useful with files created by operating systems that have case-insensitive filesystem names. .ft B cksfv -i -g files.sfv .ft R Check checksums of files 'foo' and 'bar' listed in 'files.sfv': .ft B cksfv -g files.sfv foo bar .ft R Create checksums of files matching /foo/bar/* and strip dirnames away: .ft B cksfv -b /foo/bar/* > files.sfv .ft R Recursively scan /foo/bar and verify each .sfv file: .ft B cksfv -C /foo/bar -r .ft R Same as previous, but starting from the current working directory and also following symlinks during recursion: .ft B cksfv -r -L .SH "SEE ALSO" .BR basename (1) .BR dirname (1) .BR md5sum (1) .BR sha1sum (1) .SH AUTHOR This manual page was originally written by Stefan Alfredsson . It was later modified by Heikki Orsila and Durk van Veen . cksfv-1.3.14/configure000077500000000000000000000076161117041037200146310ustar00rootroot00000000000000#!/bin/sh version="1.3.14" prefix="/usr/local" packageprefix="" have_mandir="no" have_bindir="no" compiler="gcc" if test -n "$CC" ; then compiler="$CC" fi for opt in "$@" ; do case $opt in --prefix=*) prefix=`echo $opt | sed -n 's/--prefix=\(.*\)/\1/p'` ;; --package-prefix=*) packageprefix=`echo $opt | sed -n 's|--package-prefix=\(.*\)|\1|p'` ;; --bindir=*) bindir=`echo $opt | sed -n 's|--bindir=\(.*\)|\1|p'` have_bindir="yes" ;; --mandir=*) mandir=`echo $opt | sed -n 's|--mandir=\(.*\)|\1|p'` have_mandir="yes" ;; --compiler=*) compiler=`echo $opt | sed -n 's|--compiler=\(.*\)|\1|p'` ;; --help) echo "" echo "valid options are:" echo "--prefix=dir install to prefix 'dir'" echo "--package-prefix=dest pretend to install to the prefix," echo " but copy files to 'dest/prefix' on make install" echo "--bindir=dir install program to 'dir' (PREFIX/bin/)" echo "--mandir=dir install man page to 'dir' (PREFIX/share/man/)" echo "--compiler=program compile with 'program' (gcc)" exit ;; *) echo "unknown configure argument:" "$opt" "(ignoring)" ;; esac done if test -n "$packageprefix" ; then packageprefix="$packageprefix/" fi if test "$have_bindir" = "no" ; then bindir="$prefix/bin" fi if test "$have_mandir" = "no" ; then mandir="$prefix/share/man" fi packagebindir="$packageprefix$bindir" packagemandir="$packageprefix$mandir" sed -e "s|{BINDIR}|$packagebindir|g" \ -e "s|{MANDIR}|$packagemandir|g" \ < Makefile.in > Makefile if test -z "$CFLAGS" ; then CFLAGS="-O2" fi EXTRASOURCES="" os="`uname`" echo $os |grep MINGW32 > /dev/null if test "$?" = "0" ; then os="MinGW" fi if test "$os" = "MinGW" ; then EXTRASOURCES="$EXTRASOURCES basename.c" cp win32/libgen.h win32/basename.c src/ fi sed -e "s|{CC}|$compiler|" \ -e "s|{CFLAGS}|$CFLAGS|" \ -e "s|{EXTRASOURCES}|$EXTRASOURCES|" \ < src/Makefile.in > src/Makefile echo "" > "src/config.h" echo "#ifndef CKSFV_CONFIG_H" >> "src/config.h" echo "#define CKSFV_CONFIG_H" >> "src/config.h" echo "#define VERSION \"$version\"" >> src/config.h has_stdint="no" has_inttypes="no" cat > tmpfile.c < #include #include int main(void) {return 0;} EOF $compiler -o tmpfile tmpfile.c >/dev/null 2>/dev/null if test "$?" = "0" ; then has_stdint="yes" fi # A slight optimization: test inttypes.h only if there is no stdint.h if test "$has_stdint" = "no" ; then cat > tmpfile.c < #include #include int main(void) {return 0;} EOF $compiler -o tmpfile tmpfile.c >/dev/null 2>/dev/null if test "$?" = "0"; then has_inttypes="yes" fi fi rm -f tmpfile tmpfile.c if test "$has_stdint" = "yes" ; then echo "#include " >> src/config.h elif test "$has_inttypes" = "yes"; then echo "#include " >> src/config.h else # no stdint.h or inttypes.h. obsolete environment. but we may hope.. echo "#include " >> src/config.h has_stdint="no (compilation will probably fail)" fi echo "#endif" >> "src/config.h" echo "" echo " prefix directory: $prefix" echo " package prefix: $packageprefix" echo " binary directory: $bindir" echo " man directory: $mandir" echo " compiler: $compiler" echo " has stdint.h: $has_stdint" echo " has inttypes.h: $has_inttypes" have_nautilus="no" if test -n "$(zenity --version 2>/dev/null)" ; then if test -n "$(nautilus --version 2>/dev/null)" ; then have_natilus="yes" fi fi if test "$have_nautilus" = "yes" ; then echo "" echo "It seems you have Nautilus, you can copy scripts/CheckSFV" echo "Nautilus script into:" echo "" echo " ~/.gnome2/nautilus-scripts" else echo " nautilus support: no" fi echo "" echo "configure succesful." cksfv-1.3.14/gentoo/000077500000000000000000000000001117041037200142035ustar00rootroot00000000000000cksfv-1.3.14/gentoo/cksfv-1.3.2.ebuild000066400000000000000000000013251117041037200171450ustar00rootroot00000000000000# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /build/git/uade-cvsroot/cksfv/gentoo/cksfv-1.3.2.ebuild,v 1.1 2005/02/03 02:12:15 shd Exp $ inherit eutils DESCRIPTION="SFV checksum utility (simple file verification)" HOMEPAGE="http://www.iki.fi/shd/foss/cksfv/" SRC_URI="http://www.iki.fi/shd/foss/cksfv/files/${P}.tar.bz2" LICENSE="GPL-2" SLOT="0" KEYWORDS="x86 ppc sparc alpha amd64" IUSE="" DEPEND="virtual/libc" src_compile() { cd ${S} ./configure --prefix=/usr --package-prefix="${D}" || die "configure failed" emake || die "compilation failed" } src_install() { dobin src/cksfv || die dodoc ChangeLog INSTALL README TODO doman cksfv.1 } cksfv-1.3.14/gentoo/cksfv-1.3.3.ebuild000066400000000000000000000012511117041037200171440ustar00rootroot00000000000000# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /build/git/uade-cvsroot/cksfv/gentoo/cksfv-1.3.3.ebuild,v 1.1 2005/02/04 18:02:20 shd Exp $ inherit eutils DESCRIPTION="SFV checksum utility (simple file verification)" HOMEPAGE="http://www.iki.fi/shd/foss/cksfv/" SRC_URI="http://www.iki.fi/shd/foss/cksfv/files/${P}.tar.bz2" LICENSE="GPL-2" SLOT="0" KEYWORDS="x86 ppc sparc alpha amd64" IUSE="" DEPEND="virtual/libc" src_compile() { cd ${S} econf || die "configure failed" emake || die "compilation failed" } src_install() { dobin src/cksfv || die dodoc ChangeLog INSTALL README TODO doman cksfv.1 } cksfv-1.3.14/rpm/000077500000000000000000000000001117041037200135065ustar00rootroot00000000000000cksfv-1.3.14/rpm/cksfv-1.0-makefile.patch000066400000000000000000000003721117041037200177140ustar00rootroot00000000000000--- src/Makefile.orig Mon May 22 14:30:58 2000 +++ src/Makefile Mon May 22 14:31:05 2000 @@ -24,7 +24,7 @@ gcc $(CFLAGS) -o $(PROG) $(SRCS) install: cksfv - cp $(PROG) /usr/local/bin + cp $(PROG) /usr/bin clean: rm -f *.o *~ *.core $(PROG) cksfv-1.3.14/rpm/cksfv-makefile.patch000066400000000000000000000003721117041037200174200ustar00rootroot00000000000000--- src/Makefile.orig Mon May 22 14:30:58 2000 +++ src/Makefile Mon May 22 14:31:05 2000 @@ -24,7 +24,7 @@ gcc $(CFLAGS) -o $(PROG) $(SRCS) install: cksfv - cp $(PROG) /usr/local/bin + cp $(PROG) /usr/bin clean: rm -f *.o *~ *.core $(PROG) cksfv-1.3.14/rpm/cksfv.spec000066400000000000000000000053321117041037200155010ustar00rootroot00000000000000# $Revision: 1.2 $, $Date: 2005/02/04 18:00:51 $ Summary: Test archives using information from .sfv Summary(pl): Testowanie archiwów z użyciem informacji z plików .sfv Name: cksfv Version: 1.3.2 Release: 1 License: GPL Vendor: Bryan Call Group: Applications/Archiving Source0: http://www.modeemi.fi/~shd/foss/cksfv/files/%{name}-%{version}.tar.bz2 # Source0-md5: e24b27c2f4ae36c1223b6be846ec98db URL: http://www.modeemi.fi/~shd/foss/cksfv/ BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) %description Utility to test .sfv files. These files are commonly used to ensure the correct retrieval or storage of data. %description -l pl Narzędzie do testowania plików .sfv. Te pliki są często używane w celu upewnienia się o poprawnym przesyle danych poprzez sieć. %prep %setup -q %build ./configure \ --prefix=/usr \ --package-prefix=$RPM_BUILD_ROOT %{__make} \ CFLAGS="%{rpmcflags}" %install rm -rf $RPM_BUILD_ROOT %{__make} install %clean rm -rf $RPM_BUILD_ROOT %files %defattr(644,root,root,755) %doc ChangeLog README TODO %attr(755,root,root) %{_bindir}/* %{_mandir}/man1/* %define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`) %changelog * %{date} PLD Team All persons listed below can be reached at @pld-linux.org $Log: cksfv.spec,v $ Revision 1.2 2005/02/04 18:00:51 shd *** empty log message *** Revision 1.17 2005/02/04 11:36:43 areq - 1.3.2 - new URL Revision 1.16 2004/02/05 17:59:35 qboosh - pl fix, cosmetics Revision 1.15 2004/02/04 23:38:49 baggins - release 3 - merged alpha and LFS patches (it all comes to types) Revision 1.14 2004/02/04 22:31:45 baggins - release 2 - added large file support Revision 1.13 2003/08/06 16:46:54 kloczek - może wrescie ktoś wykasuje to konto ? Revision 1.12 2003/05/26 16:24:48 malekith - massive attack: adding Source-md5 Revision 1.11 2003/05/25 05:46:17 misi3k - massive attack s/pld.org.pl/pld-linux.org/ Revision 1.10 2002/10/10 12:40:25 marcus - use new %%doc Revision 1.9 2002/04/25 16:05:33 arturs fixed a small typo Revision 1.8 2002/02/23 01:33:40 kloczek - adapterized. Revision 1.7 2002/02/22 23:28:45 kloczek - removed all Group fields translations (our rpm now can handle translating Group field using gettext). Revision 1.6 2002/01/18 02:12:34 kloczek perl -pi -e "s/pld-list\@pld.org.pl/feedback\@pld.org.pl/" Revision 1.5 2001/11/02 15:54:16 baggins - added VERSION to make Revision 1.4 2001/11/01 20:35:36 areq - 1.3, STBR Revision 1.3 2001/10/12 14:21:13 baggins - release 2 - added fixes for int/long size on alpha Revision 1.2 2001/05/02 02:43:01 qboosh - adapterized and made spec %%debug ready or added using %%rpm*flags macros Revision 1.1 2001/01/07 01:02:06 misiek new spec cksfv-1.3.14/scripts/000077500000000000000000000000001117041037200143775ustar00rootroot00000000000000cksfv-1.3.14/scripts/CheckSFV000077500000000000000000000041741117041037200157270ustar00rootroot00000000000000#!/bin/bash # # +---------------------------------------+ # | == CheckSFV == | # | This is a GNOME Nautilus script. | # | Save it in the scripts dir: | # | ~/.gnome2/nautilus-scripts | # | | # | DEPENDENCIES | # | - zenity | # | - cksfv | # | | # | When you have made it executable, | # | right click an SFV file, | # | select CheckSFV from the Script | # | menu and let it check | # | the CRCs inside the file! | # | | # | Copyright (C) 2007 Mike Appelman | # | [chokuchou@gmail.com] | # | | # | License: GNU GPL v2 and later | # +---------------------------------------+ function temp_file_error() { zenity --error --text="Could not get a temporary file" --title="No temporary file" exit 1 } if [ $# -ne 1 ] ; then zenity --error --text="Can check only one file at a time!" --title="Too many files" exit 1 elif [ ${1##*.} != 'sfv' ] ; then zenity --error --text="File \'$1\' doesn't have .sfv extension and will not be checked." --title="Wrong extension" exit 1 fi declare -i x=0 while [ $x -lt $(cat "$1" | wc -l) ] ; do declare -i let x=x+1 head -n $x "$1" | tail -n 1 > /dev/null done ( declare -i p=0 while [ $p -lt $x ] ; do p=$((p+1)) tmpfile1=$(tempfile) if test "$?" != "0" ; then temp_file_error fi tmpfile2=$(tempfile) if test "$?" != "0" ; then temp_file_error fi head -n $p "$1" | tail -n 1 > "$tmpfile1" cksfv -f "$tmpfile1" 2> "$tmpfile2" check=$? file=$(tail -n 3 "$tmpfile2" | head -n 1 | awk '{ print $1 }') if [ $check -ne 0 ] ; then zenity --error --text="CRC Check failed: \'$file\'" --title="Check failed" exit 1 else percent=$(((100 * p) / x)) echo "$percent%" echo '#'"Checking \'$file\' ... $percent%" fi done )| zenity --progress --text="Loading \'$1\'..." --title="Checking..." --auto-close exit 0 cksfv-1.3.14/src/000077500000000000000000000000001117041037200134775ustar00rootroot00000000000000cksfv-1.3.14/src/Makefile.in000066400000000000000000000020231117041037200155410ustar00rootroot00000000000000# Makefile for cksfv (Check SFV) # Copyright (C) 2000 Bryan Call # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. CC= {CC} PROG= cksfv CFLAGS= -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. {CFLAGS} SRCS= cksfv.c print.c crc32.c readsfv.c newsfv.c {EXTRASOURCES} $(PROG): $(SRCS) config.h $(CC) $(CFLAGS) -o $(PROG) $(SRCS) $(LDFLAGS) clean: rm -f *.o *~ *.core core $(PROG) cksfv-1.3.14/src/cksfv.c000066400000000000000000000065351117041037200147700ustar00rootroot00000000000000/* cksfv (Check SFV) - This program is can create sfv (checksum) listings and test already created sfv files. Copyright (C) 2000 Bryan Call This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include "cksfv.h" /* config variables for other modules */ int use_basename = 0; int be_quiet = 0; int be_caseinsensitive = 0; int be_backslashinsensitive = 0; FILE *progress_file; int main(int argc, char *argv[]) { int ch, rval; int rsfvflag = 0; char dir[PATH_MAX] = "."; char sfvfile[PATH_MAX]; int follow = 0; int i; int dir_set = 0; int recurse = 0; progress_file = stderr; while ((ch = getopt(argc, argv, "icC:f:g:qvbrLs")) != -1) switch (ch) { case 'i': be_caseinsensitive = 1; break; case 's': be_backslashinsensitive = 1; break; case 'c': progress_file = stdout; break; case 'C': strncpy(dir, optarg, sizeof(dir)); dir[sizeof(dir) - 1] = 0; dir_set = 1; break; case 'f': strncpy(sfvfile, optarg, sizeof(sfvfile)); sfvfile[sizeof(sfvfile) - 1] = 0; rsfvflag = 1; break; case 'g': strncpy(sfvfile, optarg, sizeof(sfvfile)); sfvfile[sizeof(sfvfile) - 1] = 0; rsfvflag = 2; break; case 'L': #ifndef WIN32 follow = 1; #else fprintf(stderr, "cksfv: ignoring -L in Windows\n"); #endif break; case 'q': be_quiet++; break; case 'v': be_quiet = 0; break; case 'b': use_basename = 1; break; case 'r': recurse = 1; break; case '?': default: pusage(); } argc -= optind; argv += optind; if (recurse && rsfvflag) { fprintf(stderr, "cksfv: you may not specify both -r and -f/-g\n"); exit(1); } if (dir_set && rsfvflag == 2) { fprintf(stderr, "cksfv: you may not specify both -C and -g\n"); exit(1); } if (recurse) { rval = recursivereadsfv(dir, follow, argc, argv); } else if (rsfvflag) { if (rsfvflag == 1) { rval = readsfv(sfvfile, dir, argc, argv); } else if (rsfvflag == 2) { char *newdir; /* Get directory name of sfv file */ strcpy(dir, sfvfile); newdir = strrchr(dir, '/'); if (newdir) *newdir = 0; else strcpy(dir, "."); rval = readsfv(sfvfile, dir, argc, argv); } else { fprintf(stderr, "rsfvflag > 2. Please report this bug!\n"); exit(1); } } else { if (argc < 1) pusage(); rval = newsfv(argv); } if (!TOTALLY_QUIET && recurse && sfv_broken) { fprintf(stderr, "\nList of sfv files with broken files (or broken sfv files):\n"); for (i = 0; i < sfv_broken; i++) fprintf(stderr, "%s\n", sfv_broken_list[i]); } exit(rval); } cksfv-1.3.14/src/cksfv.h000066400000000000000000000014771117041037200147750ustar00rootroot00000000000000#ifndef _CKSFV_H_ #define _CKSFV_H_ #include #include #include #include #include "config.h" #ifndef PATH_MAX #define PATH_MAX (2048) #endif #ifndef O_LARGEFILE #define O_LARGEFILE (0) #endif extern int use_basename; extern int be_quiet; extern int be_caseinsensitive; extern int be_backslashinsensitive; extern char **sfv_broken_list; extern int sfv_broken; extern FILE *progress_file; int readsfv(char *filename, char *dir, int argc, char **argv); int recursivereadsfv(char *dir, int follow, int argc, char **argv); int newsfv(char **); void pusage(void); void pnsfv_head(); void pfileinfo(char **); void pcrc(char *fn, uint32_t val); int crc32(int fd, uint32_t * val); void prsfv_head(char *fn); #define QUIET (be_quiet >= 1) #define TOTALLY_QUIET (be_quiet >= 2) #endif cksfv-1.3.14/src/crc32.c000066400000000000000000000111761117041037200145650ustar00rootroot00000000000000/* crc32.c - the crc check algorithm for cksfv Copyright (C) 2000 Bryan Call This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include "config.h" #define BUFFERSIZE 16384 /* (16k) buffer size for reading from the file */ static const uint32_t crctable[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, }; int crc32(int fd, uint32_t * main_val) { char buf[BUFFERSIZE]; char *p; int nr; uint32_t crc = ~0; while (1) { if ((nr = read(fd, buf, sizeof(buf))) < 0) { if (errno == EINTR || errno == EAGAIN) continue; break; } if (nr == 0) break; for (p = buf; nr--; ++p) crc = (crc >> 8) ^ crctable[(crc ^ *p) & 0xff]; } if (nr < 0) return 1; *main_val = ~crc; return 0; } cksfv-1.3.14/src/newsfv.c000066400000000000000000000041051117041037200151530ustar00rootroot00000000000000/* newsfv.c - creates a new checksum listing Copyright (C) 2000 Bryan Call This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include "cksfv.h" #include "config.h" #ifndef WIN32 #define O_BINARY (0) #endif int newsfv(char **argv) { int fd, rval = 0; char *fn; uint32_t val; char *tmpname; struct stat st; pnsfv_head(); pfileinfo(argv); while (*argv) { fn = *argv++; if ((fd = open(fn, O_RDONLY | O_LARGEFILE | O_BINARY, 0)) < 0) { if (!TOTALLY_QUIET) fprintf(stderr, "cksfv: %s: %s\n", fn, strerror(errno)); rval = 1; continue; } if (fstat(fd, &st)) { if (!TOTALLY_QUIET) fprintf(stderr, "cksfv: can not fstat %s: %s\n", fn, strerror(errno)); rval = 1; goto next; } if (S_ISDIR(st.st_mode)) { if (!TOTALLY_QUIET) fprintf(stderr, "cksfv: %s: Is a directory\n", fn); rval = 1; goto next; } if (crc32(fd, &val)) { if (!TOTALLY_QUIET) fprintf(stderr, "cksfv: %s: %s\n", fn, strerror(errno)); rval = 1; } else { if (use_basename) { if ((tmpname = strdup(fn)) == NULL) { if (!TOTALLY_QUIET) fprintf(stderr, "out of memory\n"); exit(1); } pcrc(basename(tmpname), val); free(tmpname); } else { pcrc(fn, val); } } next: close(fd); } return rval; } cksfv-1.3.14/src/print.c000066400000000000000000000100051117041037200147730ustar00rootroot00000000000000/* print.c - displays checksum listing Copyright (C) 2000 Bryan Call This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include "cksfv.h" #include "config.h" #define WEBSITE "http://www.iki.fi/shd/foss/cksfv/" void pnsfv_head(void) { time_t clock; struct tm *timeinfo; struct tm ti; clock = time(NULL); timeinfo = localtime(&clock); if (timeinfo == NULL) { memset(&ti, 0, sizeof(ti)); ti.tm_year = 70; timeinfo = &ti; } printf("; Generated by cksfv v%s on ", VERSION); printf("%02d-%02d-%02d at %02d:%02d.%02d\n", timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); printf("; Project web site: %s\n", WEBSITE); } void pfileinfo(char **argv) { char *fn; struct stat sb; struct tm *timeinfo; char *tmpname; char *fname; printf(";\n"); while (*argv) { fn = *argv++; if (!(stat(fn, &sb))) { if (!S_ISDIR(sb.st_mode)) { tmpname = NULL; if (use_basename) { if ((tmpname = strdup(fn)) == NULL) { if (!TOTALLY_QUIET) fprintf(stderr, "out of memory\n"); exit(1); } fname = basename(tmpname); } else { fname = fn; } timeinfo = localtime(&sb.st_mtime); printf(";%13lu %02d:%02d.%02d %02d-%02d-%02d %s\n", (unsigned long) sb.st_size, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec, timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, timeinfo->tm_mday, fname); if (use_basename) free(tmpname); } } } } void pcrc(char *fn, uint32_t val) { printf("%s %.8X\n", fn, val); } void prsfv_head(char *fn) { char head[82], *p; int len; /* this is b0rken. assumes terminal and filename widths. however, this won't cause the program to fail in the real purpose */ snprintf(head, 80, "--( Verifying: %s", fn); len = strlen(head); if (len < 76) { p = head + len; *p++ = ' '; *p++ = ')'; for (p = head + len + 2, len = 78 - len; len--; p++) *p = '-'; } else { p = head + 76; *p++ = ' '; *p++ = ')'; *p++ = '-'; *p++ = '-'; } head[80] = '\n'; head[81] = '\0'; fprintf(stderr, "%s", head); } void pusage(void) { printf("cksfv v%s: %s\n", VERSION, WEBSITE); printf("\n" "usage: cksfv [-bciq] [-C dir] [-f file] [-g path] [file ...]\n" "\n" " -b\t\tprint only the basename when creating an sfv (no directory\n" "\t\tcomponent)\n" " -c\t\tuse stdout for printing progress and final resolution (useful\n" "\t\tfor external tools analysing cksfv output)\n" " -C dir\t\tchange to directory for processing\n" " -f file\tVerify the sfv file\n" " -g path\tGo to the path name directory and verify the sfv file.\n" "\t\tYou probably want this option instead of -f.\n" " -i\t\tignore case on filenames\n" " -L\t\tfollow symlinks in recursive mode\n" " -q\t\tquiet, only prints error messages\n" " -r\t\trecursively check .sfv files in subdirectories\n" " -s\t\treplace backslashes with slashes on filenames\n" " -v\t\tverbose, by default this option is on\n" "\n" "Example 1: Verify an sfv file in directory foo/\n" "\n" "\tcksfv -g foo/bar.sfv\n" "\n"); exit(1); } cksfv-1.3.14/src/readsfv.c000066400000000000000000000230571117041037200153040ustar00rootroot00000000000000/* readsfv.c - reads from an existing checksum listing and verifies that the files are good Copyright (C) 2000 Bryan Call This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include "cksfv.h" #include "config.h" #ifndef WIN32 #define O_BINARY (0) #endif static int find_file(char *filename, char *dir); char **sfv_broken_list = NULL; int sfv_broken = 0; /* add broken sfv to the list */ static void add_broken_entry(char *fn, char *dir) { char sfvname[PATH_MAX + 1]; char **new_broken; sfv_broken++; new_broken = realloc(sfv_broken_list, sfv_broken * sizeof(char **)); if (new_broken) { sfv_broken_list = new_broken; snprintf(sfvname, sizeof(sfvname), "%s/%s", dir, fn); sfv_broken_list[sfv_broken - 1] = strdup(sfvname); } else { fprintf(stderr, "cksfv: very annoying... no space for broken list...\n"); sfv_broken--; } } int readsfv(char *fn, char *dir, int argc, char **argv) { FILE *fd; char buf[PATH_MAX + 256]; /* enough for name and checksum */ char *filename; int file, rval = 0; uint32_t sfvcrc; uint32_t val; size_t i; size_t checksumstart; size_t checksumend; size_t linelen; int j; int check; struct stat st; if (!QUIET) prsfv_head(fn); fd = fopen(fn, "r"); if (fd == NULL) { if (!TOTALLY_QUIET) fprintf(stderr, "cksfv: %s: %s\n", fn, strerror(errno)); return 1; } if (chdir(dir) != 0) { if (!TOTALLY_QUIET) fprintf(stderr, "cksfv: %s: %s\n", dir, strerror(errno)); goto error; } while (1) { if (fgets(buf, sizeof(buf), fd) == NULL) { if (feof(fd)) break; continue; } /* comment in the sfv file ignore */ if (buf[0] == ';' || buf[0] == '\n' || buf[0] == '\r') continue; linelen = strlen(buf); /* Skip whitespace in the end of the line */ i = linelen - 1; while (isspace(buf[i]) && i > 0) i--; if (!i) continue; /* empty line */ /* First byte after the checksum (zeroed later) */ checksumend = i + 1; /* Scan past the hex digits (or fail) */ while (i > 0) { if (!isxdigit(buf[i])) break; i--; } checksumstart = i + 1; if (i == 0 || (checksumend - checksumstart) != 8) { if (!TOTALLY_QUIET) fprintf(stderr, "cksfv: checksum should contain 8 hexdigits: %s\n", buf); goto error; } /* i should point to the last character before the checksum */ buf[i] = '\0'; /* zero between filename and checksum */ buf[checksumend] = '\0'; /* zero after checksum */ sfvcrc = strtoul(&buf[checksumstart], NULL, 16); filename = buf; if (argc) { check = 0; for (j = 0; j < argc; j++) { if (argv[j] == NULL) continue; if ((be_caseinsensitive != 0 && strcasecmp(argv[j], filename) == 0) || (be_caseinsensitive == 0 && strcmp(argv[j], filename) == 0)) { check = 1; argv[j] = NULL; break; } } if (check == 0) continue; } if (strlen(filename) >= PATH_MAX) { if (!TOTALLY_QUIET) fprintf(stderr, "cksfv: filename too long\n"); rval = 1; continue; } /* Replace backslashes with slashes */ if (be_backslashinsensitive == 1) { j = 0; for (j = 0; filename[j] != 0; j++) { if (filename[j] == '\\') filename[j] = '/'; } } if (!QUIET) { fprintf(progress_file, "%-49s ", filename); fflush(progress_file); } /* can we open the file */ if ((file = open(filename, O_RDONLY | O_LARGEFILE | O_BINARY, 0)) < 0) { if (be_caseinsensitive == 1) { /* try to search for it if ingore case is set */ find_file(filename, dir); file = open(filename, O_RDONLY | O_LARGEFILE | O_BINARY, 0); } } /* if the file could not be opened */ if (file < 0) { if (!QUIET) fprintf(stderr, "%s\n", strerror(errno)); else if (!TOTALLY_QUIET) fprintf(stderr, "cksfv: %s: %s\n", filename, strerror(errno)); rval = 1; continue; } if (fstat(file, &st)) { if (!QUIET) { fprintf(stderr, "can not fstat\n"); } else if (!TOTALLY_QUIET) { fprintf(stderr, "cksfv: can not fstat %s: %s\n", filename, strerror(errno)); } rval = 1; goto next; } if (S_ISDIR(st.st_mode)) { if (!QUIET) { fprintf(stderr, "Is a directory\n"); } else if (!TOTALLY_QUIET) { fprintf(stderr, "cksfv: %s: Is a directory\n", filename); } rval = 1; goto next; } if (crc32(file, &val)) { /* file error */ if (!QUIET) fprintf(stderr, "%s\n", strerror(errno)); else if (!TOTALLY_QUIET) fprintf(stderr, "cksfv: %s: %s\n", filename, strerror(errno)); rval = 1; } else { if (val != sfvcrc) { if (!QUIET) { fprintf(progress_file, "different CRC\n"); fflush(progress_file); } else if (!TOTALLY_QUIET) fprintf(stderr, "cksfv: %s: Has a different CRC\n", filename); rval = 1; } else if (!QUIET) { fprintf(progress_file, "OK\n"); fflush(progress_file); } } next: close(file); } fclose(fd); if (argc) { for (j = 0; j < argc; j++) { if (argv[j]) { if (!QUIET) { fprintf(stderr, "%-49s not found in sfv\n", argv[j]); } else if (!TOTALLY_QUIET) { fprintf(stderr, "cksfv: %s: not found in sfv\n", argv[j]); } rval = 1; } } } if (!QUIET) { fprintf(stderr, "--------------------------------------------------------------------------------\n"); fprintf(progress_file, "%s\a\n", rval == 0 ? "Everything OK" : "Errors Occured"); fflush(progress_file); } if (rval) add_broken_entry(fn, dir); return rval; error: fclose(fd); add_broken_entry(fn, dir); return 1; } static int find_file(char *filename, char *dir) { DIR *dirp; struct dirent *dirinfo; char *foo; char *bar; dirp = opendir("."); if (dirp == NULL) { if (!QUIET) { fprintf(stderr, "%s", strerror(errno)); } else if (!TOTALLY_QUIET) { fprintf(stderr, "cksfv: %s: %s\n", dir, strerror(errno)); } return 0; } while ((dirinfo = readdir(dirp)) != NULL) { for (foo = filename, bar = dirinfo->d_name; *foo != '\0' || *bar != '\0'; foo++, bar++) { if (*foo != *bar) { if (isalpha((int) *foo) && isalpha((int) *bar)) { if (tolower((int) *foo) != tolower((int) *bar)) { break; } } else { if (!((*foo == '_' || *foo == ' ') && (*bar == '_' || *bar == ' '))) { break; } } } } if (*foo == '\0' && *bar == '\0') strcpy(filename, dirinfo->d_name); } rewinddir(dirp); return 1; } int recursivereadsfv(char *dir, int follow, int argc, char **argv) { DIR *dirp; struct dirent *dirinfo; char cwd[PATH_MAX + 1]; struct stat dirstat; int ret; int finalret = 0; if (!getcwd(cwd, sizeof(cwd))) { if (!QUIET) { fprintf(stderr, "getcwd:\n"); } else if (!TOTALLY_QUIET) { fprintf(stderr, "getcwd: %s\n", strerror(errno)); } return 1; } if (dir && strcmp(dir, ".") != 0) { if (chdir(dir) == -1) { if (!QUIET) { fprintf(stderr, "chdir:\n"); } else if (!TOTALLY_QUIET) { fprintf(stderr, "cksfv: cannot chdir to %s: %s\n", dir, strerror(errno)); } return 1; } } dirp = opendir("."); if (dirp == NULL) { if (!QUIET) { fprintf(stderr, "%s", strerror(errno)); } else if (!TOTALLY_QUIET) { fprintf(stderr, "cksfv: %s: %s\n", dir, strerror(errno)); } return 1; } while ((dirinfo = readdir(dirp)) != NULL) { if (strcmp(dirinfo->d_name, ".") == 0) continue; if (strcmp(dirinfo->d_name, "..") == 0) continue; #ifndef WIN32 if (!follow) ret = lstat(dirinfo->d_name, &dirstat); else #endif ret = stat(dirinfo->d_name, &dirstat); if (ret == -1) { if (!QUIET) { fprintf(stderr, "cannot fstat\n"); } else if (!TOTALLY_QUIET) { fprintf(stderr, "cksfv: cannot stat %s: %s\n", dirinfo->d_name, strerror(errno)); } closedir(dirp); return 1; } if (S_ISDIR(dirstat.st_mode)) { /* Recursive descent into a directory */ if (recursivereadsfv(dirinfo->d_name, follow, argc, argv)) finalret = 1; } else if (S_ISREG(dirstat.st_mode) && strlen(dirinfo->d_name) > 4 && (strcasecmp(dirinfo->d_name + strlen(dirinfo->d_name) - 4, ".sfv") == 0)) { /* Read an sfv file */ char processdir[PATH_MAX]; if (!getcwd(processdir, sizeof(processdir))) { if (!QUIET) { fprintf(stderr, "getcwd:\n"); } else if (!TOTALLY_QUIET) { fprintf(stderr, "getcwd: %s\n", strerror(errno)); } closedir(dirp); return 1; } if (!QUIET) fprintf(stderr, "Entering directory: %s\n", processdir); if (readsfv(dirinfo->d_name, processdir, argc, argv)) finalret = 1; } } if (chdir(cwd) == -1) { if (!QUIET) { fprintf(stderr, "chdir:\n"); } else if (!TOTALLY_QUIET) { fprintf(stderr, "cksfv: cannot chdir to %s: %s\n", cwd, strerror(errno)); } return 1; } closedir(dirp); return finalret; } cksfv-1.3.14/test/000077500000000000000000000000001117041037200136675ustar00rootroot00000000000000cksfv-1.3.14/test/a000066400000000000000000000000021117041037200140220ustar00rootroot00000000000000a cksfv-1.3.14/test/b000066400000000000000000000000021117041037200140230ustar00rootroot00000000000000b cksfv-1.3.14/test/c000066400000000000000000000000021117041037200140240ustar00rootroot00000000000000c cksfv-1.3.14/test/c1.sfv000066400000000000000000000004211117041037200147070ustar00rootroot00000000000000; Generated by cksfv v1.3.1 on 2005-00-24 at 21:10.27 ; Written by Bryan Call - http://www.fodder.org/cksfv ; ; 2 21:10.03 2005-00-24 a ; 2 21:10.06 2005-00-24 b ; 2 21:10.12 2005-00-24 c a DDEAA107 b F6C7F2C4 c EFDCC385 cksfv-1.3.14/test/c2.sfv000066400000000000000000000004211117041037200147100ustar00rootroot00000000000000; Generated by cksfv v1.3.1 on 2005-00-24 at 21:10.27 ; Written by Bryan Call - http://www.fodder.org/cksfv ; ; 2 21:10.03 2005-00-24 a ; 2 21:10.06 2005-00-24 b ; 2 21:10.12 2005-00-24 c a DDEAA107 b F6C7F2C4 c EFDCC386 cksfv-1.3.14/test/c3.sfv000066400000000000000000000004211117041037200147110ustar00rootroot00000000000000; Generated by cksfv v1.3.1 on 2005-00-24 at 21:10.27 ; Written by Bryan Call - http://www.fodder.org/cksfv ; ; 2 21:10.03 2005-00-24 a ; 2 21:10.06 2005-00-24 b ; 2 21:10.12 2005-00-24 c a DDEAA107 B F6C7F2C4 c EFDCC385 cksfv-1.3.14/test/c4.sfv000066400000000000000000000004211117041037200147120ustar00rootroot00000000000000; Generated by cksfv v1.3.1 on 2005-00-24 at 21:10.27 ; Written by Bryan Call - http://www.fodder.org/cksfv ; ; 2 21:10.03 2005-00-24 a ; 2 21:10.06 2005-00-24 b ; 2 21:10.12 2005-00-24 c a xDEAA107 B F6C7F2C4 c EFDCC385 cksfv-1.3.14/test/c5.sfv000066400000000000000000000004201117041037200147120ustar00rootroot00000000000000; Generated by cksfv v1.3.1 on 2005-00-24 at 21:10.27 ; Written by Bryan Call - http://www.fodder.org/cksfv ; ; 2 21:10.03 2005-00-24 a ; 2 21:10.06 2005-00-24 b ; 2 21:10.12 2005-00-24 c a DDEAA107 B 6C7F2C4 c EFDCC385 cksfv-1.3.14/test/c6.sfv000066400000000000000000000004221117041037200147150ustar00rootroot00000000000000; Generated by cksfv v1.3.1 on 2005-00-24 at 21:10.27 ; Written by Bryan Call - http://www.fodder.org/cksfv ; ; 2 21:10.03 2005-00-24 a ; 2 21:10.06 2005-00-24 b ; 2 21:10.12 2005-00-24 c a DDEAA1071 B 6C7F2C41 c EFDCC385 cksfv-1.3.14/test/c7.sfv000066400000000000000000000002511117041037200147160ustar00rootroot00000000000000; Generated by cksfv v1.3.8 on 2006-02-15 at 10:56.08 ; Project web site: http://www.iki.fi/shd/foss/cksfv/ ; ; 2 10:56.00 2006-02-15 dir5\a dir5\a DDEAA107 cksfv-1.3.14/test/dir1/000077500000000000000000000000001117041037200145265ustar00rootroot00000000000000cksfv-1.3.14/test/dir1/subdir1/000077500000000000000000000000001117041037200160775ustar00rootroot00000000000000cksfv-1.3.14/test/dir1/subdir1/a000066400000000000000000000000021117041037200162320ustar00rootroot00000000000000a cksfv-1.3.14/test/dir1/subdir1/b000066400000000000000000000000021117041037200162330ustar00rootroot00000000000000b cksfv-1.3.14/test/dir1/subdir1/c000066400000000000000000000000021117041037200162340ustar00rootroot00000000000000c cksfv-1.3.14/test/dir1/subdir1/c1.sfv000066400000000000000000000004211117041037200171170ustar00rootroot00000000000000; Generated by cksfv v1.3.1 on 2005-00-24 at 21:10.27 ; Written by Bryan Call - http://www.fodder.org/cksfv ; ; 2 21:10.03 2005-00-24 a ; 2 21:10.06 2005-00-24 b ; 2 21:10.12 2005-00-24 c a DDEAA107 b F6C7F2C4 c EFDCC385 cksfv-1.3.14/test/dir1/subdir2/000077500000000000000000000000001117041037200161005ustar00rootroot00000000000000cksfv-1.3.14/test/dir1/subdir2/a000066400000000000000000000000021117041037200162330ustar00rootroot00000000000000a cksfv-1.3.14/test/dir1/subdir2/b000066400000000000000000000000021117041037200162340ustar00rootroot00000000000000b cksfv-1.3.14/test/dir1/subdir2/c000066400000000000000000000000021117041037200162350ustar00rootroot00000000000000c cksfv-1.3.14/test/dir1/subdir2/c1.sfv000066400000000000000000000004211117041037200171200ustar00rootroot00000000000000; Generated by cksfv v1.3.1 on 2005-00-24 at 21:10.27 ; Written by Bryan Call - http://www.fodder.org/cksfv ; ; 2 21:10.03 2005-00-24 a ; 2 21:10.06 2005-00-24 b ; 2 21:10.12 2005-00-24 c a DDEAA107 b F6C7F2C4 c EFDCC385 cksfv-1.3.14/test/dir2/000077500000000000000000000000001117041037200145275ustar00rootroot00000000000000cksfv-1.3.14/test/dir2/subdir1/000077500000000000000000000000001117041037200161005ustar00rootroot00000000000000cksfv-1.3.14/test/dir2/subdir1/a000066400000000000000000000000021117041037200162330ustar00rootroot00000000000000a cksfv-1.3.14/test/dir2/subdir1/b000066400000000000000000000000021117041037200162340ustar00rootroot00000000000000b cksfv-1.3.14/test/dir2/subdir1/c000066400000000000000000000000021117041037200162350ustar00rootroot00000000000000c cksfv-1.3.14/test/dir2/subdir1/c2.sfv000066400000000000000000000004211117041037200171210ustar00rootroot00000000000000; Generated by cksfv v1.3.1 on 2005-00-24 at 21:10.27 ; Written by Bryan Call - http://www.fodder.org/cksfv ; ; 2 21:10.03 2005-00-24 a ; 2 21:10.06 2005-00-24 b ; 2 21:10.12 2005-00-24 c a DDEAA107 b F6C7F2C4 c EFDCC386 cksfv-1.3.14/test/dir2/subdir2/000077500000000000000000000000001117041037200161015ustar00rootroot00000000000000cksfv-1.3.14/test/dir2/subdir2/a000066400000000000000000000000021117041037200162340ustar00rootroot00000000000000a cksfv-1.3.14/test/dir2/subdir2/b000066400000000000000000000000021117041037200162350ustar00rootroot00000000000000b cksfv-1.3.14/test/dir2/subdir2/c000066400000000000000000000000021117041037200162360ustar00rootroot00000000000000c cksfv-1.3.14/test/dir2/subdir2/c1.sfv000066400000000000000000000004211117041037200171210ustar00rootroot00000000000000; Generated by cksfv v1.3.1 on 2005-00-24 at 21:10.27 ; Written by Bryan Call - http://www.fodder.org/cksfv ; ; 2 21:10.03 2005-00-24 a ; 2 21:10.06 2005-00-24 b ; 2 21:10.12 2005-00-24 c a DDEAA107 b F6C7F2C4 c EFDCC385 cksfv-1.3.14/test/dir3/000077500000000000000000000000001117041037200145305ustar00rootroot00000000000000cksfv-1.3.14/test/dir3/a000066400000000000000000000000021117041037200146630ustar00rootroot00000000000000a cksfv-1.3.14/test/dir3/b000066400000000000000000000000021117041037200146640ustar00rootroot00000000000000b cksfv-1.3.14/test/dir3/c000066400000000000000000000000021117041037200146650ustar00rootroot00000000000000c cksfv-1.3.14/test/dir3/c1.sfv000066400000000000000000000004211117041037200155500ustar00rootroot00000000000000; Generated by cksfv v1.3.1 on 2005-00-24 at 21:10.27 ; Written by Bryan Call - http://www.fodder.org/cksfv ; ; 2 21:10.03 2005-00-24 a ; 2 21:10.06 2005-00-24 b ; 2 21:10.12 2005-00-24 c a DDEAA107 b F6C7F2C4 c EFDCC385 cksfv-1.3.14/test/dir4/000077500000000000000000000000001117041037200145315ustar00rootroot00000000000000cksfv-1.3.14/test/dir4/a000066400000000000000000000000021117041037200146640ustar00rootroot00000000000000a cksfv-1.3.14/test/dir4/b000066400000000000000000000000021117041037200146650ustar00rootroot00000000000000b cksfv-1.3.14/test/dir4/c000066400000000000000000000000021117041037200146660ustar00rootroot00000000000000c cksfv-1.3.14/test/dir4/c2.sfv000066400000000000000000000004211117041037200155520ustar00rootroot00000000000000; Generated by cksfv v1.3.1 on 2005-00-24 at 21:10.27 ; Written by Bryan Call - http://www.fodder.org/cksfv ; ; 2 21:10.03 2005-00-24 a ; 2 21:10.06 2005-00-24 b ; 2 21:10.12 2005-00-24 c a DDEAA107 b F6C7F2C4 c EFDCC386 cksfv-1.3.14/test/dir5/000077500000000000000000000000001117041037200145325ustar00rootroot00000000000000cksfv-1.3.14/test/dir5/a000066400000000000000000000000021117041037200146650ustar00rootroot00000000000000a cksfv-1.3.14/test/test.sh000077500000000000000000000077561117041037200152240ustar00rootroot00000000000000#!/bin/sh cksfv="../src/cksfv" ret="0" $cksfv -f c1.sfv >/dev/null 2>/dev/null if test "$?" != "0" ; then echo "test case 1 unsuccessful. should report correct checksum." ret="1" else echo "test case 1 successful" fi $cksfv -f c2.sfv >/dev/null 2>/dev/null if test "$?" = "0" ; then echo "test case 2 unsuccessful. should report incorrect checksum." ret="1" else echo "test case 2 successful" fi $cksfv a b c > tmp.sfv 2> /dev/null if test "$?" != "0" ; then echo "test case 3 unsuccessful. sfv creation failed." ret="1" else echo "test case 3 successful" fi $cksfv -f tmp.sfv >/dev/null 2>/dev/null if test "$?" != "0" ; then echo "test case 4 unsuccessful. sfv checking failed." ret="1" else echo "test case 4 successful" fi $cksfv a d >/dev/null 2>/dev/null if test "$?" = "0" ; then echo "test case 5 unsuccessful. sfv creation should have failed." ret="1" else echo "test case 5 successful" fi $cksfv -i -f c3.sfv >/dev/null 2>/dev/null if test "$?" != "0" ; then echo "test case 6 unsuccessful. in-casesensitive checking failed." ret="1" else echo "test case 6 successful" fi $cksfv -q -f c1.sfv 2>/dev/null > tmpfile $cksfv -q -f c2.sfv 2>/dev/null >> tmpfile $cksfv -q -i -f c3.sfv 2>/dev/null >> tmpfile rm -f emptyfile touch emptyfile if test "`wc -l < tmpfile`" != "`wc -l < emptyfile`" ; then echo "test case 7 unsuccessful. tmpfile not empty." ret="1" else echo "test case 7 successful" fi # Checksum code with illegal characters $cksfv -f c4.sfv >/dev/null 2>/dev/null if test "$?" = "0" ; then echo "test case 8 unsuccessful." ret="1" else echo "test case 8 successful" fi # Checksum code with one too few characters $cksfv -f c5.sfv >/dev/null 2>/dev/null if test "$?" = "0" ; then echo "test case 9 unsuccessful." ret="1" else echo "test case 9 successful" fi # Checksum code with one too many characters $cksfv -f c6.sfv >/dev/null 2>/dev/null if test "$?" = "0" ; then echo "test case 10 unsuccessful." ret="1" else echo "test case 10 successful" fi # Partial checks $cksfv a b c > tmp.sfv 2> /dev/null $cksfv -f tmp.sfv a b d > /dev/null 2> /dev/null if test "$?" = "0" ; then echo "test case 11 unsuccessful." ret="1" else echo "test case 11 successful" fi # Partial checks $cksfv -f tmp.sfv c > /dev/null 2> /dev/null if test "$?" != "0" ; then echo "test case 12 unsuccessful." ret="1" else echo "test case 12 successful" fi ln -sfn ../dir4 dir1/link 2> /dev/null ln -sfn ../dir3 dir2/link 2> /dev/null # Recursive without symlinks, successful $cksfv -C dir1 -r > /dev/null 2> /dev/null if test "$?" != "0" ; then echo "test case 13 unsuccessful. should report correct checksum." ret="1" else echo "test case 13 successful" fi # Recursive without symlinks, unsuccessful $cksfv -C dir2 -r > /dev/null 2> /dev/null if test "$?" = 0 ; then echo "test case 14 unsuccessful. should report incorrect checksum." ret="1" else echo "test case 14 successful" fi # Recursive with symlinks, unsuccessful $cksfv -C dir1 -r -L > /dev/null 2> /dev/null if test "$?" = "0" ; then echo "test case 15 unsuccessful. should report correct checksum." ret="1" else echo "test case 15 successful" fi # Recursive with symlinks, unsuccessful $cksfv -C dir2 -r -L > /dev/null 2> /dev/null if test "$?" = 0 ; then echo "test case 16 unsuccessful. should report incorrect checksum." ret="1" else echo "test case 16 successful" fi # Test backslash transformation $cksfv -s -f c7.sfv > /dev/null 2> /dev/null if test "$?" != 0 ; then echo "test case 17 unsuccessful. should report incorrect behavior." ret="1" else echo "test case 17 successful" fi $cksfv -g dir3/c1.sfv >/dev/null 2>/dev/null if test "$?" != "0" ; then echo "test case 18 unsuccessful. should report correct checksum." ret="1" else echo "test case 18 successful" fi if test "$ret" != "0" ; then echo "One or more of the tests were unsuccessful. Please report." exit 1 fi cksfv-1.3.14/win32/000077500000000000000000000000001117041037200136525ustar00rootroot00000000000000cksfv-1.3.14/win32/basename.c000066400000000000000000000052071117041037200155750ustar00rootroot00000000000000/* * Copyright (c) 1997 Todd C. Miller * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #if 0 #ifndef lint static char rcsid[] = "$OpenBSD: basename.c,v 1.4 1999/05/30 17:10:30 espie Exp $"; #endif /* not lint */ #include __FBSDID("$FreeBSD: src/lib/libc/gen/basename.c,v 1.7 2002/12/30 01:41:14 marcel Exp $"); #endif #include #include #include #include #include char * basename(path) const char *path; { static char *bname = NULL; const char *endp, *startp; if (bname == NULL) { bname = (char *)malloc(MAXPATHLEN); if (bname == NULL) return(NULL); } /* Empty or NULL string gets treated as "." */ if (path == NULL || *path == '\0') { (void)strcpy(bname, "."); return(bname); } /* Strip trailing slashes */ endp = path + strlen(path) - 1; while (endp > path && *endp == '/') endp--; /* All slashes becomes "/" */ if (endp == path && *endp == '/') { (void)strcpy(bname, "/"); return(bname); } /* Find the start of the base */ startp = endp; while (startp > path && *(startp - 1) != '/') startp--; if (endp - startp + 2 > MAXPATHLEN) { errno = ENAMETOOLONG; return(NULL); } (void)strncpy(bname, startp, endp - startp + 1); bname[endp - startp + 1] = '\0'; return(bname); } cksfv-1.3.14/win32/libgen.h000066400000000000000000000033221117041037200152630ustar00rootroot00000000000000/* $OpenBSD: libgen.h,v 1.4 1999/05/28 22:00:22 espie Exp $ */ /* $FreeBSD: src/include/libgen.h,v 1.2 2002/03/23 17:24:53 imp Exp $ */ /* * Copyright (c) 1997 Todd C. Miller * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _LIBGEN_H_ #define _LIBGEN_H_ char *basename(const char *); char *dirname(const char *); #endif /* _LIBGEN_H_ */