make dir_hier_move and dir_hier_path output a help-string

svn path=/trunk/boinc/; revision=11857
This commit is contained in:
Reinhard Prix 2007-01-14 23:04:27 +00:00
parent 240d733a41
commit d377d47a6e
3 changed files with 31 additions and 3 deletions

View File

@ -533,5 +533,11 @@ Rom 13 Jan 2007
Reinhard 14 Jan 2007
- install validate_util.h for external building of validators
- make dir_hier_move and dir_hier_path output help/usage strings
sched/
Makefile.am
tools/
dir_hier_move.C
dir_hier_path.C

View File

@ -32,6 +32,10 @@
#include "util.h"
#include "sched_util.h"
const char *usage =
"\nUsage: dir_hier_move <src_dir> <dst_dir> <fanout>\n"
"Moves files from <src_dir> (flat) into <dst_dir> (hierarchical) with the given <fanout>\n\n";
int main(int argc, char** argv) {
char* src_dir, *dst_dir;
int fanout=0;
@ -39,11 +43,17 @@ int main(int argc, char** argv) {
char dst_path[256], src_path[256];
int retval;
if (argc != 4) exit(1);
if ( (argc == 1) || !strcmp(argv[1], "-h") || !strcmp(argv[1],"--help") || (argc != 4) ) {
printf (usage);
exit(1);
}
src_dir = argv[1];
dst_dir = argv[2];
fanout = atoi(argv[3]);
if (!fanout) exit(1);
if (!fanout) {
printf ( usage );
exit(1);
}
DirScanner scanner(src_dir);
while (scanner.scan(filename)) {

View File

@ -30,11 +30,23 @@
#include "sched_config.h"
#include "sched_util.h"
int main(int /*argc*/, char** argv) {
const char *usage =
"\nUsage: dir_hier_path <filename>\n"
" Run this in a project's root directory.\n"
" Prints the absolute path of the file in the download hierarchy,\n"
" and creates the directory if needed.\n\n";
int main(int argc, char** argv) {
SCHED_CONFIG config;
char path[256];
int retval;
if ( (argc == 1) || !strcmp(argv[1], "-h") || !strcmp(argv[1],"--help") || (argc != 2) ) {
printf (usage);
exit(1);
}
retval = config.parse_file(".");
if (retval) {
fprintf(stderr, "Can't find config.xml; run this in project root dir\n");