use pcSubst
This commit is contained in:
parent
8be10a4cb3
commit
83494c23b9
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.35 2007-10-17 09:57:42 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.36 2007-10-27 08:40:07 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -28,6 +28,7 @@ static char rcsid[] = "@(#$Id: internfile.cpp,v 1.35 2007-10-17 09:57:42 dockes
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <map>
|
||||||
#ifndef NO_NAMESPACES
|
#ifndef NO_NAMESPACES
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#endif /* NO_NAMESPACES */
|
#endif /* NO_NAMESPACES */
|
||||||
@ -62,26 +63,12 @@ static bool uncompressfile(RclConfig *conf, const string& ifn,
|
|||||||
list<string>::const_iterator it = cmdv.begin();
|
list<string>::const_iterator it = cmdv.begin();
|
||||||
++it;
|
++it;
|
||||||
list<string> args;
|
list<string> args;
|
||||||
|
map<char, string> subs;
|
||||||
|
subs['f'] = ifn;
|
||||||
|
subs['t'] = tdir;
|
||||||
for (; it != cmdv.end(); it++) {
|
for (; it != cmdv.end(); it++) {
|
||||||
string s = *it;
|
|
||||||
string ns;
|
string ns;
|
||||||
string::const_iterator it1;
|
pcSubst(*it, ns, subs);
|
||||||
for (it1 = s.begin(); it1 != s.end();it1++) {
|
|
||||||
if (*it1 == '%') {
|
|
||||||
if (++it1 == s.end()) {
|
|
||||||
ns += '%';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (*it1 == '%')
|
|
||||||
ns += '%';
|
|
||||||
if (*it1 == 'f')
|
|
||||||
ns += ifn;
|
|
||||||
if (*it1 == 't')
|
|
||||||
ns += tdir;
|
|
||||||
} else {
|
|
||||||
ns += *it1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
args.push_back(ns);
|
args.push_back(ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user