////////////////////////////////////////////////////////////////////////// FillOutCmdLineInfo -- fills out info common to all modes that appears on the command line. //////////////////////////////////////////////////////////////////////////
| 190 | // command line. |
| 191 | /////////////////////////////////////////////////////////////////////////////// |
| 192 | void cTWAModeCommon::FillOutCmdLineInfo(const cCmdLineParser& parser) |
| 193 | { |
| 194 | cCmdLineIter iter(parser); |
| 195 | for (iter.SeekBegin(); !iter.Done(); iter.Next()) |
| 196 | { |
| 197 | switch (iter.ArgId()) |
| 198 | { |
| 199 | case cTWAdminCmdLine::VERBOSE: |
| 200 | mVerbosity = 2; |
| 201 | break; |
| 202 | case cTWAdminCmdLine::SILENT: |
| 203 | mVerbosity = 0; |
| 204 | break; |
| 205 | case cTWAdminCmdLine::POL_FILE: |
| 206 | ASSERT(iter.NumParams() > 0); // should be caught by cmd line parser |
| 207 | mPolFile = iter.ParamAt(0); |
| 208 | break; |
| 209 | case cTWAdminCmdLine::SITE_KEY_FILE: |
| 210 | ASSERT(iter.NumParams() > 0); // should be caught by cmd line parser |
| 211 | mSiteKeyFile = iter.ParamAt(0); |
| 212 | mSiteKeyFileProvieded = true; |
| 213 | break; |
| 214 | case cTWAdminCmdLine::LOCAL_KEY_FILE: |
| 215 | ASSERT(iter.NumParams() > 0); // should be caught by cmd line parser |
| 216 | mLocalKeyFile = iter.ParamAt(0); |
| 217 | mLocalKeyFileProvieded = true; |
| 218 | break; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | // Turn all of the file names into full paths for nice presentation to the user. |
| 223 | // Note: We depend later on the if one of these files is not specified, the string |
| 224 | // is empty. Currently FullPath() expands "" to the CWD. |
| 225 | TSTRING fullPath; |
| 226 | if (!mPolFile.empty() && iFSServices::GetInstance()->FullPath(fullPath, mPolFile)) |
| 227 | mPolFile = fullPath; |
| 228 | if (!mSiteKeyFile.empty() && iFSServices::GetInstance()->FullPath(fullPath, mSiteKeyFile)) |
| 229 | mSiteKeyFile = fullPath; |
| 230 | if (!mLocalKeyFile.empty() && iFSServices::GetInstance()->FullPath(fullPath, mLocalKeyFile)) |
| 231 | mLocalKeyFile = fullPath; |
| 232 | |
| 233 | // use the verbosity information |
| 234 | ASSERT((mVerbosity >= 0) && (mVerbosity < 3)); |
| 235 | iUserNotify::GetInstance()->SetVerboseLevel(mVerbosity); |
| 236 | } |
| 237 | |
| 238 | /////////////////////////////////////////////////////////////////////////////// |
| 239 | // TWAdmin modes |