Give makerd a cwd argument, and upgrade cpptoml
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
* @date May 2013
|
||||
*/
|
||||
|
||||
#ifndef _CPPTOML_H_
|
||||
#define _CPPTOML_H_
|
||||
#ifndef CPPTOML_H
|
||||
#define CPPTOML_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
@@ -84,11 +84,12 @@ class option
|
||||
return &value_;
|
||||
}
|
||||
|
||||
const T& value_or(const T& alternative) const
|
||||
template <class U>
|
||||
T value_or(U&& alternative) const
|
||||
{
|
||||
if (!empty_)
|
||||
return value_;
|
||||
return alternative;
|
||||
return static_cast<T>(std::forward<U>(alternative));
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -2874,8 +2875,14 @@ class parser
|
||||
std::string::iterator find_end_of_date(std::string::iterator it,
|
||||
std::string::iterator end)
|
||||
{
|
||||
return std::find_if(it, end, [](char c) {
|
||||
return !is_number(c) && c != 'T' && c != ' ' && c != 'Z' && c != ':'
|
||||
auto end_of_date = std::find_if(it, end, [](char c) {
|
||||
return !is_number(c) && c != '-';
|
||||
});
|
||||
if (end_of_date != end && *end_of_date == ' ' && end_of_date + 1 != end
|
||||
&& is_number(end_of_date[1]))
|
||||
end_of_date++;
|
||||
return std::find_if(end_of_date, end, [](char c) {
|
||||
return !is_number(c) && c != 'T' && c != 'Z' && c != ':'
|
||||
&& c != '-' && c != '+' && c != '.';
|
||||
});
|
||||
}
|
||||
@@ -3097,8 +3104,11 @@ class parser
|
||||
throw_parse_exception("Unterminated inline table");
|
||||
|
||||
consume_whitespace(it, end);
|
||||
if (it != end && *it != '}')
|
||||
{
|
||||
parse_key_value(it, end, tbl.get());
|
||||
consume_whitespace(it, end);
|
||||
}
|
||||
} while (*it == ',');
|
||||
|
||||
if (it == end || *it != '}')
|
||||
@@ -3435,7 +3445,7 @@ class toml_writer
|
||||
{
|
||||
res += "\\\\";
|
||||
}
|
||||
else if ((const uint32_t)*it <= 0x001f)
|
||||
else if (static_cast<uint32_t>(*it) <= UINT32_C(0x001f))
|
||||
{
|
||||
res += "\\u";
|
||||
std::stringstream ss;
|
||||
@@ -3655,4 +3665,5 @@ inline std::ostream& operator<<(std::ostream& stream, const array& a)
|
||||
return stream;
|
||||
}
|
||||
} // namespace cpptoml
|
||||
#endif
|
||||
#endif // CPPTOML_H
|
||||
|
||||
|
||||
@@ -3,14 +3,23 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <unistd.h>
|
||||
#include "cpptoml.h"
|
||||
#include "initrd/headers.h"
|
||||
#include "entry.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 3) {
|
||||
std::cerr << "Usage: " << argv[0] << " <manifest> <output>" << std::endl;
|
||||
if (argc < 3 && argc > 4) {
|
||||
std::cerr << "Usage: " << argv[0] << " <manifest> <output> [sourceroot]" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (argc == 4 && chdir(argv[3]) != 0) {
|
||||
std::cerr
|
||||
<< "Failed to change to " << argv[3] << ": "
|
||||
<< std::strerror(errno) << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user