|
a/src/internfile/extrameta.cpp |
|
b/src/internfile/extrameta.cpp |
|
... |
|
... |
44 |
|
44 |
|
45 |
void reapXAttrs(const RclConfig* cfg, const string& path,
|
45 |
void reapXAttrs(const RclConfig* cfg, const string& path,
|
46 |
map<string, string>& xfields)
|
46 |
map<string, string>& xfields)
|
47 |
{
|
47 |
{
|
48 |
LOGDEB2(("reapXAttrs: [%s]\n", path.c_str()));
|
48 |
LOGDEB2(("reapXAttrs: [%s]\n", path.c_str()));
|
49 |
|
49 |
#ifndef _WIN32
|
50 |
// Retrieve xattrs names from files and mapping table from config
|
50 |
// Retrieve xattrs names from files and mapping table from config
|
51 |
vector<string> xnames;
|
51 |
vector<string> xnames;
|
52 |
if (!pxattr::list(path, &xnames)) {
|
52 |
if (!pxattr::list(path, &xnames)) {
|
53 |
LOGERR(("FileInterner::reapXattrs: pxattr::list: errno %d\n", errno));
|
53 |
LOGERR(("FileInterner::reapXattrs: pxattr::list: errno %d\n", errno));
|
54 |
return;
|
54 |
return;
|
|
... |
|
... |
77 |
}
|
77 |
}
|
78 |
// Encode should we ?
|
78 |
// Encode should we ?
|
79 |
xfields[key] = value;
|
79 |
xfields[key] = value;
|
80 |
LOGDEB2(("reapXAttrs: [%s] -> [%s]\n", key.c_str(), value.c_str()));
|
80 |
LOGDEB2(("reapXAttrs: [%s] -> [%s]\n", key.c_str(), value.c_str()));
|
81 |
}
|
81 |
}
|
|
|
82 |
#endif
|
82 |
}
|
83 |
}
|
83 |
|
84 |
|
84 |
void docFieldsFromXattrs(RclConfig *cfg, const map<string, string>& xfields,
|
85 |
void docFieldsFromXattrs(RclConfig *cfg, const map<string, string>& xfields,
|
85 |
Rcl::Doc& doc)
|
86 |
Rcl::Doc& doc)
|
86 |
{
|
87 |
{
|
|
... |
|
... |
91 |
}
|
92 |
}
|
92 |
|
93 |
|
93 |
void reapMetaCmds(RclConfig* cfg, const string& path,
|
94 |
void reapMetaCmds(RclConfig* cfg, const string& path,
|
94 |
map<string, string>& cfields)
|
95 |
map<string, string>& cfields)
|
95 |
{
|
96 |
{
|
|
|
97 |
#ifndef _WIN32
|
96 |
const vector<MDReaper>& reapers = cfg->getMDReapers();
|
98 |
const vector<MDReaper>& reapers = cfg->getMDReapers();
|
97 |
if (reapers.empty())
|
99 |
if (reapers.empty())
|
98 |
return;
|
100 |
return;
|
99 |
map<char,string> smap = create_map<char, string>('f', path);
|
101 |
map<char,string> smap = create_map<char, string>('f', path);
|
100 |
for (vector<MDReaper>::const_iterator rp = reapers.begin();
|
102 |
for (vector<MDReaper>::const_iterator rp = reapers.begin();
|
|
... |
|
... |
109 |
string output;
|
111 |
string output;
|
110 |
if (ExecCmd::backtick(cmd, output)) {
|
112 |
if (ExecCmd::backtick(cmd, output)) {
|
111 |
cfields[rp->fieldname] = output;
|
113 |
cfields[rp->fieldname] = output;
|
112 |
}
|
114 |
}
|
113 |
}
|
115 |
}
|
|
|
116 |
#endif
|
114 |
}
|
117 |
}
|
115 |
|
118 |
|
116 |
// Set fields from external commands
|
119 |
// Set fields from external commands
|
117 |
// These override those from xattrs and can be later augmented by
|
120 |
// These override those from xattrs and can be later augmented by
|
118 |
// values from inside the file.
|
121 |
// values from inside the file.
|