blob: 00045dea25829091188095418ce12fdd88841cd9 (
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%T", systime() - 24 * 60 * 60 * n, 1);
}
function or_default(var, def) {
return var ? var : def;
}
|