Commit 002b104f authored by Michal Vrabel's avatar Michal Vrabel
Browse files

Pridanie funckcie PrintCopymasterOptions, oprava preklepu ParseCopymater -> ParseCopymaster.

parent 9b863c26
......@@ -7,11 +7,12 @@
void FatalError(char c, const char* msg, int exit_status);
void PrintCopymasterOptions(struct CopymasterOptions* cpm_options);
int main(int argc, char* argv[])
{
struct CopymasterOptions cpm_options = ParseCopymaterOptions(argc, argv);
struct CopymasterOptions cpm_options = ParseCopymasterOptions(argc, argv);
//-------------------------------------------------------------------
// Kontrola hodnot prepinacov
......@@ -19,43 +20,7 @@ int main(int argc, char* argv[])
// Vypis hodnot prepinacov odstrante z finalnej verzie
printf("infile: %s\n", cpm_options.infile);
printf("outfile: %s\n", cpm_options.outfile);
printf("fast: %d\n", cpm_options.fast);
printf("slow: %d\n", cpm_options.slow);
printf("create: %d\n", cpm_options.create);
printf("create_mode: %o\n", (unsigned int)cpm_options.create_mode);
printf("overwrite: %d\n", cpm_options.overwrite);
printf("append: %d\n", cpm_options.append);
printf("lseek: %d\n", cpm_options.lseek);
printf("lseek_options.x: %d\n", cpm_options.lseek_options.x);
printf("lseek_options.pos1: %ld\n", cpm_options.lseek_options.pos1);
printf("lseek_options.pos2: %ld\n", cpm_options.lseek_options.pos2);
printf("lseek_options.num: %lu\n", cpm_options.lseek_options.num);
printf("directory: %d\n", cpm_options.directory);
printf("delete_opt: %d\n", cpm_options.delete_opt);
printf("chmod: %d\n", cpm_options.chmod);
printf("chmod_mode: %o\n", (unsigned int)cpm_options.chmod_mode);
printf("inode: %d\n", cpm_options.inode);
printf("inode_number: %lu\n", cpm_options.inode_number);
printf("umask:\t%d\n", cpm_options.umask);
for(unsigned int i=0; i<kUMASK_OPTIONS_MAX_SZ; ++i) {
if (cpm_options.umask_options[i][0] == 0) {
// dosli sme na koniec zoznamu nastaveni umask
break;
}
printf("umask_options[%u]: %s\n", i, cpm_options.umask_options[i]);
}
printf("link: %d\n", cpm_options.link);
printf("truncate: %d\n", cpm_options.truncate);
printf("truncate_size: %ld\n", cpm_options.truncate_size);
printf("sparse: %d\n", cpm_options.sparse);
PrintCopymasterOptions(&cpm_options);
//-------------------------------------------------------------------
// Osetrenie prepinacov pred kopirovanim
......@@ -103,3 +68,45 @@ void FatalError(char c, const char* msg, int exit_status)
exit(exit_status);
}
void PrintCopymasterOptions(struct CopymasterOptions* cpm_options)
{
if (cpm_options == 0)
return;
printf("infile: %s\n", cpm_options->infile);
printf("outfile: %s\n", cpm_options->outfile);
printf("fast: %d\n", cpm_options->fast);
printf("slow: %d\n", cpm_options->slow);
printf("create: %d\n", cpm_options->create);
printf("create_mode: %o\n", (unsigned int)cpm_options->create_mode);
printf("overwrite: %d\n", cpm_options->overwrite);
printf("append: %d\n", cpm_options->append);
printf("lseek: %d\n", cpm_options->lseek);
printf("lseek_options.x: %d\n", cpm_options->lseek_options.x);
printf("lseek_options.pos1: %ld\n", cpm_options->lseek_options.pos1);
printf("lseek_options.pos2: %ld\n", cpm_options->lseek_options.pos2);
printf("lseek_options.num: %lu\n", cpm_options->lseek_options.num);
printf("directory: %d\n", cpm_options->directory);
printf("delete_opt: %d\n", cpm_options->delete_opt);
printf("chmod: %d\n", cpm_options->chmod);
printf("chmod_mode: %o\n", (unsigned int)cpm_options->chmod_mode);
printf("inode: %d\n", cpm_options->inode);
printf("inode_number: %lu\n", cpm_options->inode_number);
printf("umask:\t%d\n", cpm_options->umask);
for(unsigned int i=0; i<kUMASK_OPTIONS_MAX_SZ; ++i) {
if (cpm_options->umask_options[i][0] == 0) {
// dosli sme na koniec zoznamu nastaveni umask
break;
}
printf("umask_options[%u]: %s\n", i, cpm_options->umask_options[i]);
}
printf("link: %d\n", cpm_options->link);
printf("truncate: %d\n", cpm_options->truncate);
printf("truncate_size: %ld\n", cpm_options->truncate_size);
printf("sparse: %d\n", cpm_options->sparse);
}
......@@ -8,7 +8,7 @@
#include "options.h"
struct CopymasterOptions ParseCopymaterOptions(int argc, char *argv[])
struct CopymasterOptions ParseCopymasterOptions(int argc, char *argv[])
{
extern int optind;
extern char* optarg;
......
......@@ -37,7 +37,7 @@ struct CopymasterOptions {
int sparse;
};
struct CopymasterOptions ParseCopymaterOptions(int argc, char *argv[]);
struct CopymasterOptions ParseCopymasterOptions(int argc, char *argv[]);
void FatalError(char c, const char* msg, int exit_status);
......
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