| | |
| | | " Format YYYYMMDD. If not specified the license won't expire") // |
| | | ("client_signature,s", po::value<string>(), |
| | | "The signature of the pc that requires the license. " |
| | | "It should be in the format XXX-XXXX-XXXX." |
| | | "It should be in the format XXXX-XXXX-XXXX-XXXX." |
| | | " If not specified the license " |
| | | "won't be linked to a specific pc.") // |
| | | ("start_version,t", po::value<unsigned int>()->default_value(0 |
| | |
| | | string client_signature = ""; |
| | | if (vm.count("client_signature")) { |
| | | client_signature = vm["client_signature"].as<string>(); |
| | | regex e("\\d{3}-[:alnum:]{4}-[:alnum:]{4}"); |
| | | //fixme match + and / |
| | | /*regex e("(A-Za-z0-9){4}-(A-Za-z0-9){4}-(A-Za-z0-9){4}-(A-Za-z0-9){4}"); |
| | | if (!regex_match(client_signature, e)) { |
| | | cerr << endl << "Client signature not recognized: " |
| | | << client_signature |
| | | << " Please enter a valid signature in format XXX-XXXX-XXX" |
| | | << " Please enter a valid signature in format XXXX-XXXX-XXXX-XXXX" |
| | | << endl; |
| | | exit(2); |
| | | } |
| | | }*/ |
| | | } |
| | | string extra_data = ""; |
| | | if (vm.count("extra_data")) { |
| | |
| | | return licInfo; |
| | | } |
| | | |
| | | void LicenseGenerator::generateAndOutptuLicenses(const po::variables_map& vm, |
| | | void LicenseGenerator::generateAndOutputLicenses(const po::variables_map& vm, |
| | | ostream& outputFile) { |
| | | vector<FullLicenseInfo> licenseInfo = parseLicenseInfo(vm); |
| | | license::LicenseSigner licSigner = |
| | |
| | | << " error: " << strerror( errno); |
| | | exit(3); |
| | | } |
| | | generateAndOutptuLicenses(vm, ofstream); |
| | | generateAndOutputLicenses(vm, ofstream); |
| | | ofstream.close(); |
| | | } else { |
| | | generateAndOutptuLicenses(vm, cout); |
| | | generateAndOutputLicenses(vm, cout); |
| | | } |
| | | return 0; |
| | | } |
| | |
| | | ostringstream oss; |
| | | bt::time_facet *facet = new bt::time_facet("%Y-%m-%d"); |
| | | oss.imbue(locale(cout.getloc(), facet)); |
| | | oss << pt << endl; |
| | | oss << pt; |
| | | //delete (facet); |
| | | return oss.str(); |
| | | } |