|
a/src/internfile/internfile.cpp |
|
b/src/internfile/internfile.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.38 2008-05-27 05:40:58 dockes Exp $ (C) 2004 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.39 2008-08-26 07:33:05 dockes Exp $ (C) 2004 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
45 |
|
45 |
|
46 |
// The internal path element separator. This can't be the same as the rcldb
|
46 |
// The internal path element separator. This can't be the same as the rcldb
|
47 |
// file to ipath separator : "|"
|
47 |
// file to ipath separator : "|"
|
48 |
static const string isep(":");
|
48 |
static const string isep(":");
|
49 |
|
49 |
|
|
|
50 |
bool FileInterner::getEnclosing(const string &url, const string &ipath,
|
|
|
51 |
string &eurl, string &eipath)
|
|
|
52 |
{
|
|
|
53 |
eurl = url;
|
|
|
54 |
eipath = ipath;
|
|
|
55 |
string::size_type colon;
|
|
|
56 |
LOGDEB(("FileInterner::getEnclosing(): [%s]\n", eipath.c_str()));
|
|
|
57 |
if (eipath.empty())
|
|
|
58 |
return false;
|
|
|
59 |
if ((colon = eipath.find_last_of(isep)) != string::npos) {
|
|
|
60 |
eipath.erase(colon);
|
|
|
61 |
} else {
|
|
|
62 |
eipath.erase();
|
|
|
63 |
}
|
|
|
64 |
LOGDEB(("FileInterner::getEnclosing() after: [%s]\n", eipath.c_str()));
|
|
|
65 |
return true;
|
|
|
66 |
}
|
|
|
67 |
|
50 |
// Execute the command to uncompress a file into a temporary one.
|
68 |
// Execute the command to uncompress a file into a temporary one.
|
51 |
static bool uncompressfile(RclConfig *conf, const string& ifn,
|
69 |
static bool uncompressfile(RclConfig *conf, const string& ifn,
|
52 |
const list<string>& cmdv, const string& tdir,
|
70 |
const list<string>& cmdv, const string& tdir,
|
53 |
string& tfile)
|
71 |
string& tfile)
|
54 |
{
|
72 |
{
|
|
... |
|
... |
608 |
}
|
626 |
}
|
609 |
|
627 |
|
610 |
static int op_flags;
|
628 |
static int op_flags;
|
611 |
#define OPT_q 0x1
|
629 |
#define OPT_q 0x1
|
612 |
|
630 |
|
|
|
631 |
RclConfig *config;
|
|
|
632 |
RclConfig *RclConfig::getMainConfig()
|
|
|
633 |
{
|
|
|
634 |
return config;
|
|
|
635 |
}
|
613 |
int main(int argc, char **argv)
|
636 |
int main(int argc, char **argv)
|
614 |
{
|
637 |
{
|
615 |
thisprog = argv[0];
|
638 |
thisprog = argv[0];
|
616 |
argc--; argv++;
|
639 |
argc--; argv++;
|
617 |
|
640 |
|
|
... |
|
... |
637 |
if (argc >= 1) {
|
660 |
if (argc >= 1) {
|
638 |
ipath.append(*argv++);
|
661 |
ipath.append(*argv++);
|
639 |
argc--;
|
662 |
argc--;
|
640 |
}
|
663 |
}
|
641 |
string reason;
|
664 |
string reason;
|
642 |
RclConfig *config = recollinit(0, 0, reason);
|
665 |
config = recollinit(0, 0, reason);
|
643 |
|
666 |
|
644 |
if (config == 0 || !config->ok()) {
|
667 |
if (config == 0 || !config->ok()) {
|
645 |
string str = "Configuration problem: ";
|
668 |
string str = "Configuration problem: ";
|
646 |
str += reason;
|
669 |
str += reason;
|
647 |
fprintf(stderr, "%s\n", str.c_str());
|
670 |
fprintf(stderr, "%s\n", str.c_str());
|