blob: 01295a2138e31c0b91863adabaa01a4bbca13ac6 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
## Helper functions
# Remove all whitespace in str
function trim(str) {
gsub(/[ \t]/, "", str);
return str;
}
# Remove all whitespace around str
function trim_surrounding(str) {
gsub(/^[ \t]*/, "", str);
gsub(/[ \t]*$/, "", str);
return str;
}
# Time n days before the current time
function time_days_ago(n) {
return strftime("%FT%TZ", systime() - 24 * 60 * 60 * n, 1);
}
function or_default(var, def) {
return (var != "") ? var : def;
}
|