Skip to content

Commit

Permalink
make dir_hier_move and dir_hier_path output a help-string
Browse files Browse the repository at this point in the history
svn path=/trunk/boinc/; revision=11857
  • Loading branch information
ReinhardPrix committed Jan 14, 2007
1 parent 240d733 commit d377d47
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
6 changes: 6 additions & 0 deletions checkin_notes
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 12 additions & 2 deletions tools/dir_hier_move.C
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,28 @@
#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;
std::string filename;
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)) {
Expand Down
14 changes: 13 additions & 1 deletion tools/dir_hier_path.C
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit d377d47

Please sign in to comment.