userlibandfileserver/fileserver/etshell/ts_com.cpp
changeset 90 947f0dc9f7a8
parent 33 0173bcd7697c
child 127 e408fc570bb5
equal deleted inserted replaced
52:2d65c2f76d7b 90:947f0dc9f7a8
    41 //	TShellCommand(_L("BLANK"),_L("Help"),_L("-?"),TShellCommand::EDSwitch,ShellFunction::BLANK),
    41 //	TShellCommand(_L("BLANK"),_L("Help"),_L("-?"),TShellCommand::EDSwitch,ShellFunction::BLANK),
    42 	TShellCommand(_L("ATTRIB"),_L("Displays or changes file attributes"),_L("[drive:][path][filename] [+R | -R] [+H |-H] [+S | -S] [+A | -A] [/p]\n\n  /p - Pause after each screen of information"), TShellCommand::EPSwitch, ShellFunction::Attrib),
    42 	TShellCommand(_L("ATTRIB"),_L("Displays or changes file attributes"),_L("[drive:][path][filename] [+R | -R] [+H |-H] [+S | -S] [+A | -A] [/p]\n\n  /p - Pause after each screen of information"), TShellCommand::EPSwitch, ShellFunction::Attrib),
    43 	TShellCommand(_L("CD"),_L("Change the current directory for a drive"),_L("[path] [/d]\n\n  /d - Change drive"),TShellCommand::EDSwitch,ShellFunction::Cd),
    43 	TShellCommand(_L("CD"),_L("Change the current directory for a drive"),_L("[path] [/d]\n\n  /d - Change drive"),TShellCommand::EDSwitch,ShellFunction::Cd),
    44 	TShellCommand(_L("CHKDEPS"),_L("Check the dependencies of an executable or a Dll (ARM only)"),_L("[Filename.EXE] or [Filename.DLL]"),0,ShellFunction::ChkDeps),
    44 	TShellCommand(_L("CHKDEPS"),_L("Check the dependencies of an executable or a Dll (ARM only)"),_L("[Filename.EXE] or [Filename.DLL]"),0,ShellFunction::ChkDeps),
    45 	TShellCommand(_L("CHKDSK"),_L("Check disk for corruption"),_L("[drive:] [/s][/f|/u]\n\n/s - start ScanDrive instead of CheckDisk\n/f - finalise drive\n/u - unfinalise drive"),TShellCommand::ESSwitch|TShellCommand::EFSwitch|TShellCommand::EUSwitch,ShellFunction::ChkDsk),
    45 	TShellCommand(_L("CHKDSK"),_L("Check disk for corruption"),_L("[drive:] [/s][/f|/u]\n\n/s - start ScanDrive instead of CheckDisk\n/f - finalise drive\n/u - unfinalise drive"),TShellCommand::ESSwitch|TShellCommand::EFSwitch|TShellCommand::EUSwitch,ShellFunction::ChkDsk),
    46 	TShellCommand(_L("COPY"),_L("Copy one (or more) file(s)"),_L("source [destination]"),TShellCommand::ESSwitch,ShellFunction::Copy),
    46 	TShellCommand(_L("COPY"),_L("Copy one (or more) file(s), overwriting existing one(s)"),_L("source [destination]"),TShellCommand::ESSwitch,ShellFunction::Copy),
    47 	TShellCommand(_L("DEL"),_L("Delete one file"),_L("[drive:][path][filename]"),TShellCommand::ESSwitch,ShellFunction::Del),
    47 	TShellCommand(_L("DEL"),_L("Delete one file"),_L("[drive:][path][filename]"),TShellCommand::ESSwitch,ShellFunction::Del),
    48 	TShellCommand(_L("DIR"),_L("Show directory contents"),_L("[drive:][path][filename] [/p][/w]\n\n  /p - Pause after each screen of information\n  /w - Wide format"),TShellCommand::EPSwitch|TShellCommand::EWSwitch|TShellCommand::EASwitch,ShellFunction::Dir),
    48 	TShellCommand(_L("DIR"),_L("Show directory contents"),_L("[drive:][path][filename] [/p][/w]\n\n  /p - Pause after each screen of information\n  /w - Wide format"),TShellCommand::EPSwitch|TShellCommand::EWSwitch|TShellCommand::EASwitch,ShellFunction::Dir),
    49 //	TShellCommand(_L("EDLIN"),_L("Edit a text file"),_L("[drive:][path][filename] [/p]\n\n  /p - Pause after each screen of information"),TShellCommand::EPSwitch,ShellFunction::Edit),
    49 //	TShellCommand(_L("EDLIN"),_L("Edit a text file"),_L("[drive:][path][filename] [/p]\n\n  /p - Pause after each screen of information"),TShellCommand::EPSwitch,ShellFunction::Edit),
    50     TShellCommand(_L("FORMAT"),_L("Format a disk"),ptrFormatHelp,TShellCommand::EQSwitch|TShellCommand::ESSwitch|TShellCommand::EESwitch|TShellCommand::EFSwitch,ShellFunction::Format),
    50     TShellCommand(_L("FORMAT"),_L("Format a disk"),ptrFormatHelp,TShellCommand::EQSwitch|TShellCommand::ESSwitch|TShellCommand::EESwitch|TShellCommand::EFSwitch,ShellFunction::Format),
    51     TShellCommand(_L("GOBBLE"),_L("Create a file"),_L("[filename] size [/e]\n\n /e - create an empty file, without writing any data"),TShellCommand::EESwitch,ShellFunction::Gobble),
    51     TShellCommand(_L("GOBBLE"),_L("Create a file"),_L("[filename] size [/e]\n\n /e - create an empty file, without writing any data"),TShellCommand::EESwitch,ShellFunction::Gobble),
   401 // /N			Uses short filename, if available, when copying a file with a non-8dot3 name.
   401 // /N			Uses short filename, if available, when copying a file with a non-8dot3 name.
   402 //
   402 //
   403 // To append files, specify a single file for destination, but multiple files
   403 // To append files, specify a single file for destination, but multiple files
   404 // for source (using wildcards or file1+file2+file3 format).
   404 // for source (using wildcards or file1+file2+file3 format).
   405 //
   405 //
       
   406 // Overwrites existing file(s).
       
   407 //
   406 // My spec:
   408 // My spec:
   407 //
   409 //
   408 // COPY source [destination]
   410 // COPY source [destination]
   409 // source		Specifies the file or files to be copied to the current directory
   411 // source		Specifies the file or files to be copied to the current directory
   410 
   412 
   459 			if (r!=KErrNone)
   461 			if (r!=KErrNone)
   460 				return(r);
   462 				return(r);
   461 			}
   463 			}
   462 
   464 
   463 		TBool recursive=((aSwitches&TShellCommand::ESSwitch)!=0);
   465 		TBool recursive=((aSwitches&TShellCommand::ESSwitch)!=0);
       
   466 		// Automatically overwrites existing file(s)
   464 		TUint switches=(recursive) ? CFileMan::EOverWrite|CFileMan::ERecurse : CFileMan::EOverWrite;
   467 		TUint switches=(recursive) ? CFileMan::EOverWrite|CFileMan::ERecurse : CFileMan::EOverWrite;
   465 		r=CShell::TheFileMan->Copy(dirPath.FullName(),destination,switches);
   468 		r=CShell::TheFileMan->Copy(dirPath.FullName(),destination,switches);
   466 		if (r==KErrNone)
   469 		if (r==KErrNone)
   467 			return(r);	//	Copy was successful
   470 			return(r);	//	Copy was successful
   468 
   471 
  1105 
  1108 
  1106 
  1109 
  1107 	//-- Print out information about file system installed
  1110 	//-- Print out information about file system installed
  1108 	if(aFlags & EFSInfo)
  1111 	if(aFlags & EFSInfo)
  1109     {
  1112     {
       
  1113         //-- print out drive properties
       
  1114         Buf.Format(_L("\nDrive %c: No:%d"), 'A'+aDrvNum, aDrvNum);
  1110         
  1115         
  1111         apConsole->Printf(_L("\nDrive %c: number:%d\n"), 'A'+aDrvNum, aDrvNum);
  1116         //-- find out if the drive is synchronous / asynchronous
       
  1117         TPckgBuf<TBool> drvSyncBuf;
       
  1118         nRes = aFs.QueryVolumeInfoExt(aDrvNum, EIsDriveSync, drvSyncBuf);
       
  1119         if(nRes == KErrNone)
       
  1120         {
       
  1121             Buf.AppendFormat(_L(", Sync:%d"), drvSyncBuf() ? 1:0);        
       
  1122         }
       
  1123 
       
  1124         //-- find out if drive runs a rugged FS (debug mode only)
       
  1125         const TInt KControlIoIsRugged=4;
       
  1126         TUint8 ruggedFS;
       
  1127         TPtr8 pRugged(&ruggedFS, 1, 1);
       
  1128         nRes=aFs.ControlIo(aDrvNum, KControlIoIsRugged, pRugged);
       
  1129         if(nRes == KErrNone)
       
  1130         {
       
  1131             Buf.AppendFormat(_L(", Rugged:%d"), ruggedFS ? 1:0);        
       
  1132         }
       
  1133 
       
  1134         Buf.Append(_L("\n"));
       
  1135         apConsole->Printf(Buf);
       
  1136 
  1112 
  1137 
  1113 	    //-- print the FS name
  1138 	    //-- print the FS name
  1114 	    if(aFs.FileSystemName(Buf, aDrvNum) == KErrNone)
  1139 	    if(aFs.FileSystemName(Buf, aDrvNum) == KErrNone)
  1115 	    {
  1140 	    {
  1116 	        TFSName fsName;
  1141 	        TFSName fsName;
  1149                 apConsole->Printf(Buf);
  1174                 apConsole->Printf(Buf);
  1150             }
  1175             }
  1151 
  1176 
  1152 
  1177 
  1153 
  1178 
  1154             //-- print out FileSystem volume finalisation info
  1179             
  1155             if(bVolumeOK && (aFlags & EFSInfoEx))
  1180             if(bVolumeOK && (aFlags & EFSInfoEx))
  1156             {
  1181             {
  1157 
  1182                 Buf.Zero();
       
  1183 
       
  1184                 //-- print out FileSystem volume finalisation info
  1158                 TPckgBuf<TBool> boolPckg;
  1185                 TPckgBuf<TBool> boolPckg;
  1159                 nRes = aFs.QueryVolumeInfoExt(aDrvNum, EIsDriveFinalised, boolPckg);
  1186                 nRes = aFs.QueryVolumeInfoExt(aDrvNum, EIsDriveFinalised, boolPckg);
  1160                 if(nRes == KErrNone)
  1187                 if(nRes == KErrNone)
  1161                 {
  1188                 {
  1162                     if(boolPckg() >0)
  1189                     if(boolPckg() >0)
  1163                         apConsole->Printf(_L("Volume Finalised\n"));
  1190                         Buf.Copy(_L("Volume: Finalised"));
  1164                     else
  1191                     else
  1165                         apConsole->Printf(_L("Volume Not finalised\n"));
  1192                         Buf.Copy(_L("Volume: Not finalised"));
  1166                 }
  1193                 }
       
  1194 
       
  1195                 //-- print out cluster size that FS reported
       
  1196                 TVolumeIOParamInfo volIoInfo;
       
  1197                 nRes = aFs.VolumeIOParam(aDrvNum, volIoInfo);
       
  1198                 if(nRes == KErrNone && volIoInfo.iClusterSize >= 512)
       
  1199                 {
       
  1200                     Buf.AppendFormat(_L(", Cluster Sz:%d"), volIoInfo.iClusterSize);
       
  1201                 }
       
  1202 
       
  1203                 if(Buf.Length())
       
  1204                 {
       
  1205                     Buf.Append(_L("\n"));
       
  1206                     apConsole->Printf(Buf);    
       
  1207                 }
       
  1208 
  1167             }
  1209             }
  1168 	    }
  1210 	    }
  1169     }//if(aFlags & EFSInfo)
  1211     }//if(aFlags & EFSInfo)
  1170 
  1212 
  1171 	//-- print media attributes
  1213 	//-- print media attributes