Commit 0c8890a0 authored by David Cotton's avatar David Cotton
Browse files

Altered the help messages to match what really happens. Also made them much...

Altered the help messages to match what really happens. Also made them much more verbose and described the usage of the utility in muchmore detail.

	Made it handle <escape> presses during recursion better.
	Added the -single flag to the archive CRC creation and check lines.
	Srccommitt'ed.

Version 0.02. Not tagged
parent 872f2e29
...@@ -159,6 +159,20 @@ void tidy_memory(void) ...@@ -159,6 +159,20 @@ void tidy_memory(void)
} }
void display_help_message(void)
{
printf("Usage: DirScan [[-r <Root Path>] [-a <archive name>] [-v] [-maxlen <Maximum Length>]..]\n");
printf("\n");
printf(" -r is the path of the directory to be archived.\n");
printf(" -a is the name of the archive to be created. If a CD is to be blown, then this should be under 8 characters in length.\n");
printf(" -maxlen sets the maximum length of permissible filename. It has a default value of 100 and a minimum of 50.");
printf(" -v switches on verbose output. this displays all the files to be placed inside the archive and their path lengths.");
printf("\n");
printf(" TarExtend can be used to overcome a limitation in the RiscOS implementation of Tar which only allows path lengths of 100 characters or less. TarExtend improves this situation by renaming any directory structures that pass this limit to less than it by renaming directories inside the structure. It also performs CRC checks on the finished archive and all the individual files, allowing verification of the archive.\n");
printf(" It outputs three files; arc, dearc and manual. Arc can be run to archive the required files; drarc can be run to dearchive them, and manual describes the renames performed (if any).\n");
printf("\n");
}
int main( int argc, char **argv ) int main( int argc, char **argv )
{ {
...@@ -174,7 +188,7 @@ int main( int argc, char **argv ) ...@@ -174,7 +188,7 @@ int main( int argc, char **argv )
MemCheck_RegisterArgs( argc, argv); // Tell MemCheck that strings in argv[0...argc-1] are ok to read. MemCheck_RegisterArgs( argc, argv); // Tell MemCheck that strings in argv[0...argc-1] are ok to read.
#endif // MemCheck_MEMCHECK #endif // MemCheck_MEMCHECK
printf("Archive script writer version 0.01.\n"); printf("Archive script writer version 0.02.\n");
atexit(tidy_memory); atexit(tidy_memory);
gstrans(argv); gstrans(argv);
...@@ -238,25 +252,25 @@ int main( int argc, char **argv ) ...@@ -238,25 +252,25 @@ int main( int argc, char **argv )
--argc; --argc;
} }
printf("Tar Extension Utility Version 0.01 (%s)\n", __DATE__ ); printf("Tar Extension Utility Version 0.02 (%s)\n", __DATE__ );
if (max_filename_length < 50) if (max_filename_length < 50)
{ {
printf("The maximum length given must have a value greater than 50.\n"); printf("The maximum length given must have a value greater than 50.\n");
printf("Usage: DirScan [-d <directory> [-a <Root Path>] [-v] [-maxlen <Maximum Length>]..]\n"); display_help_message();
} }
if (!archive_name) /* no archive name has been given. */ if (!archive_name) /* no archive name has been given. */
{ {
printf("No name given for archive. Use the -a flag to set it.\n"); printf("No name given for archive. Use the -a flag to set it.\n");
printf("Usage: DirScan [-d <directory> [-a <Root Path>] [-v] [-maxlen <Maximum Length>]..]\n"); display_help_message();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (!root_filename) /* no root filename has been given. */ if (!root_filename) /* no root filename has been given. */
{ {
printf("No name given for root filename. Use the -r flag to set it.\n"); printf("No name given for root filename. Use the -r flag to set it.\n");
printf("Usage: DirScan [[-r <Root Path>] [-a <archive name>] [-v] [-maxlen <Maximum Length>]..]\n"); display_help_message();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
...@@ -264,7 +278,7 @@ int main( int argc, char **argv ) ...@@ -264,7 +278,7 @@ int main( int argc, char **argv )
if (!file_exists(root_filename)) if (!file_exists(root_filename))
{ {
printf("File %s does not exist.\n", root_filename); printf("File %s does not exist.\n", root_filename);
printf("Usage: DirScan [[-r <Root Path>] [-a <archive name>] [-v] [-maxlen <Maximum Length>]..]\n"); display_help_message();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
......
...@@ -382,7 +382,7 @@ void reccheckdir( ...@@ -382,7 +382,7 @@ void reccheckdir(
{ {
printf("Unexpected error"); printf("Unexpected error");
printf("Error: [%x] (%s)", fail->errnum,fail->errmess); printf("Error: [%x] (%s)", fail->errnum,fail->errmess);
assert(1!=1); // End execution and give file and line info. exit(EXIT_FAILURE);
} }
// DBUG_PRINTF("reccheckdir(): SWI called. %d entries read.\n", numread); // DBUG_PRINTF("reccheckdir(): SWI called. %d entries read.\n", numread);
...@@ -791,7 +791,7 @@ BOOL output_archiver_file(char* archiver_filename) ...@@ -791,7 +791,7 @@ BOOL output_archiver_file(char* archiver_filename)
// Filecrc the archive. // Filecrc the archive.
output << endl << "| Generating CRC for the archive..." << endl; output << endl << "| Generating CRC for the archive..." << endl;
output << endl << "dir dr" << endl; output << endl << "dir dr" << endl;
output << "*do filecrc -create -d " << archive_name << " -f ^.CRCs.ArcCRC" << endl; output << "*do filecrc -single -create -d " << archive_name << " -f ^.CRCs.ArcCRC" << endl;
DBUG_PRINTF("output_archiver_file(char*): Here #9\n",); DBUG_PRINTF("output_archiver_file(char*): Here #9\n",);
// Finally set the filetype of arclist to text // Finally set the filetype of arclist to text
...@@ -842,7 +842,7 @@ BOOL output_dearchiver_file(char* dearchiver_filename) ...@@ -842,7 +842,7 @@ BOOL output_dearchiver_file(char* dearchiver_filename)
output << endl << "| Checking CRC for the archive..." << endl; output << endl << "| Checking CRC for the archive..." << endl;
output << "echo Checking CRC for the archive" << endl; output << "echo Checking CRC for the archive" << endl;
output << "dir <cdname$dir>.dr" << endl; output << "dir <cdname$dir>.dr" << endl;
output << "*do filecrc -d " << archive_name << " -f ^.CRCs.ArcCRC" << endl; output << "*do filecrc -single -d " << archive_name << " -f ^.CRCs.ArcCRC" << endl;
// Dearchive the tarfile. // Dearchive the tarfile.
output << endl << "| Dearchiving the archive." << endl; output << endl << "| Dearchiving the archive." << endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment