40 strESC+
"[30m", strESC+
"[31m", strESC+
"[32m", strESC+
"[33m",
41 strESC+
"[34m", strESC+
"[35m", strESC+
"[36m", strESC+
"[37m"
46 : promptSetting(prompt), promptString(
""), nColumn(80),
48 currentCommandDir(
"/")
128 if(absPath.length()==0)
return NULL;
129 if(absPath[absPath.length()-1] !=
'/')
return NULL;
130 if(absPath==
"/")
return cmdTree;
132 for(
G4int indx=1; indx<
G4int(absPath.length())-1; ) {
134 if(jslash !=
G4int(G4String::npos)) {
136 cmdTree= cmdTree-> GetTree(
G4String(absPath(0,jslash+1)));
141 if(cmdTree == NULL)
return NULL;
149 if(apath.empty())
return apath;
154 if(apath[(
size_t)0] !=
'/') bpath= currentCommandDir + apath;
158 for(
G4int indx=1; indx<=
G4int(bpath.length())-1; ) {
164 if(jslash !=
G4int(G4String::npos)) {
165 if(bpath.substr(indx,jslash-indx) ==
".."){
170 if(absPath.length() >= 2) {
171 absPath.
remove(absPath.length()-1);
173 if(jpre !=
G4int(G4String::npos)) absPath.
remove(jpre+1);
175 }
else if(bpath.substr(indx,jslash-indx) ==
"."){
177 if( !(jslash==indx && bpath(indx)==
'/') )
178 absPath+= bpath(indx, jslash-indx+1);
195 if(apath.empty())
return apath;
197 G4int lstr= apath.length();
201 if(apath[(
size_t)(lstr-1)]==
'/') Qsla=
TRUE;
205 for(
G4int i=lstr-1; i>=0; i--) {
206 if(Qsla && apath[(
size_t)i]!=
'/') Qsla=
FALSE;
207 if(apath[(
size_t)i]==
'/' && !Qsla) {
213 if(indx==-1)
return apath;
215 if(indx==0 && lstr==1) {
221 newPath= newPath(indx+1,lstr-indx-1);
243 if(! input.empty()) {
245 for(
G4int i=len-1; i>=0; i--) {
246 if(input[(
size_t)i]==
'/') {
252 if(indx != -1) vpath= GetAbsCommandDirPath(input(0,indx+1));
253 if(!(indx==0 && len==1)) vcmd= input(indx+1,len-indx-1);
260 if(GetCommandTree(tmpstr) != NULL) {
269 G4cout <<
"<" << input <<
">: No such directory" <<
G4endl;
277 G4int Ndir= atree-> GetTreeEntry();
278 G4int Ncmd= atree-> GetCommandEntry();
279 if(Ndir==0 && Ncmd==0)
return;
282 for(
G4int idir=1; idir<=Ndir; idir++) {
283 if(idir==1 && lsColorFlag) stream+= TermColorString[directoryColor];
284 G4String fpdir= atree-> GetTree(idir)-> GetPathName();
286 if(candidate.empty()) {
287 if(vcmd==
"" || fpdir==inputpath) {
288 stream+= GetCommandPathTail(fpdir); stream+=
" ";
292 if( fpdir.
index(candidate, 0) == 0) {
293 stream+= GetCommandPathTail(fpdir); stream+=
" ";
299 for(
G4int icmd=1; icmd<=Ncmd; icmd++){
300 if(icmd==1 && lsColorFlag) stream+= TermColorString[commandColor];
301 G4String fpcmd= atree-> GetPathName() +
302 atree-> GetCommand(icmd) -> GetCommandName();
304 if(candidate.empty()) {
305 if(vcmd==
"" || fpcmd==inputpath) {
306 stream+= GetCommandPathTail(fpcmd); stream+=
"* ";
310 if( fpcmd.
index(candidate, 0) == 0) {
311 stream+= GetCommandPathTail(fpcmd); stream+=
"* ";
317 if(!isMatch && candidate.empty())
319 <<
">: No such directory or command" << std::flush;
323 arrayString.
Show(nColumn);