//endmagic goes into stream as "ceff ffec"
const mymagic_t endmagic = (0xecff << 16) | shortmagic;
const int fd_none = INT_MIN;
+bool outistty;
//The first FIXED_LENGTH bytes are a fixed
//portion of the export output. This includes the overall
return ret;
}
+// Convert non-printable characters to '\###'
+static void cleanbin(string &str)
+{
+ bool cleaned = false;
+ string clean;
+
+ for (string::iterator it = str.begin(); it != str.end(); ++it) {
+ if (!isprint(*it)) {
+ clean.push_back('\\');
+ clean.push_back('0' + ((*it >> 6) & 7));
+ clean.push_back('0' + ((*it >> 3) & 7));
+ clean.push_back('0' + (*it & 7));
+ cleaned = true;
+ } else {
+ clean.push_back(*it);
+ }
+ }
+
+ if (cleaned)
+ str = clean;
+ return;
+}
+
int write_simple(sectiontype_t type, int fd)
{
bufferlist hbl;
return 1;
}
+ outistty = isatty(STDOUT_FILENO);
+
file_fd = fd_none;
if (type == "export") {
if (!vm.count("file")) {