예제 #1
0
void ParseStdArgs(int argc, char **argv,int *extra_argc, char ***extra_argv) {
  Options options[] = {{"P","protocol",1,0,0},
		       {"h","hostfile",1,0,0},
		       {"s","server",0,0,0},
		       {"m","multi",0,0,0},
		       {"c","compression",1,0,0},
		       {0,0,0,0}};
  ParseCommand(argc,argv,options,1,extra_argc,extra_argv);
  if (options[0].present && options[0].value)
    SetProtocol(options[0].value);
  if (options[1].present && options[1].value)
    SetHostfile(options[1].value);
  if (options[2].present) {
    if (options[3].present) {
      fprintf(stderr,"Cannot select both server mode and multi mode\n\n");
      PrintHelp(0);
    } else {
      SetMulti(1);
      SetContextSwitching(0);
    }
  }
  if (options[3].present) {
    SetMulti(1);
    SetContextSwitching(1);
  }
  if (options[4].present && options[4].value)
    SetCompressionLevel(atoi(options[4].value));
}
예제 #2
0
CRegEntry& CRegEntry::operator=(CRegEntry& cregValue) {

	if (this == &cregValue)
		return *this;
	
	if (lpszName == NULL) {
		size_t nNameLen = _tcslen(cregValue.lpszName) + 1;
		lpszName = new _TCHAR[nNameLen]; _tcsncpy(lpszName, cregValue.lpszName, nNameLen);
	}
	
	switch ((iType = cregValue.iType)) {

		case REG_SZ:
			return (*this = (ForceStr(), cregValue.lpszStr));
			break;

		case REG_MULTI_SZ: {
			LPTSTR lpszBuf = new _TCHAR[_MAX_REG_VALUE];
			SetMulti(cregValue.GetMulti(lpszBuf), cregValue.MultiLength());
			delete [] lpszBuf; return *this;
			}
			break;
		case REG_BINARY: {
			size_t n = cregValue.vBytes.size(); LPBYTE buf = new BYTE[n];
			cregValue.GetBinary(buf, n); SetBinary(buf, n);
			delete [] buf; return *this;
			}
			break;
		default:
			return (*this = cregValue.dwDWORD);
	}
}