dropshell release 2025.0601.1821
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
This commit is contained in:
@@ -312,7 +312,7 @@ std::string requote(std::string str) {
|
||||
}
|
||||
|
||||
|
||||
int die(const std::string & msg) {
|
||||
int return_die(const std::string & msg) {
|
||||
error << "Fatal error:" << std::endl;
|
||||
error << msg << std::endl;
|
||||
return 1;
|
||||
@@ -650,4 +650,11 @@ bool file_replace_or_add_segment(std::string filepath, std::string segment)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool legal_service_name(const std::string &service_name)
|
||||
{
|
||||
// legal characters are alphanumeric, and - and _
|
||||
std::regex legal_chars("^[a-zA-Z0-9_-]+$");
|
||||
return std::regex_match(service_name, legal_chars);
|
||||
}
|
||||
|
||||
} // namespace dropshell
|
@@ -45,7 +45,7 @@ int count_substring(const std::string &substring, const std::string &text);
|
||||
|
||||
std::string random_alphanumeric_string(int length);
|
||||
|
||||
int die(const std::string & msg);
|
||||
int return_die(const std::string & msg);
|
||||
std::string safearg(int argc, char *argv[], int index);
|
||||
std::string safearg(const std::vector<std::string> & args, int index);
|
||||
|
||||
@@ -75,4 +75,7 @@ constexpr unsigned int switchhash(const char *s, int off = 0)
|
||||
return !s[off] ? 5381 : (switchhash(s, off + 1) * 33) ^ s[off];
|
||||
}
|
||||
|
||||
bool legal_service_name(const std::string & service_name);
|
||||
|
||||
|
||||
} // namespace dropshell
|
Reference in New Issue
Block a user