mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-01 16:44:23 +08:00
🦄 Sync 2026-10-02 14:52:05
This commit is contained in:
1 parent
4c85793342
commit
0bfe84f1e8
133 files changed
+7983
-3225
No files matched your search
@@ -866,7 +866,14 @@ tctl_persist_save() {
|
||||
first=1
|
||||
for (i=1; i<=n; i++) {
|
||||
sub(/^\{/,"",items[i]); sub(/\}$/,"",items[i])
|
||||
if (items[i] ~ "\"ip\":\"" ip "\"" && items[i] ~ "\"type\":\"" t "\"") continue
|
||||
# index(), not ~: these values reach awk as a REGEX otherwise, and
|
||||
# its safety then rests on an argument about which characters the
|
||||
# fields can hold. That argument happens to hold today — an address
|
||||
# or a CIDR carries only the dot, which among valid values can line
|
||||
# up with nothing but another dot — but it is not a property of the
|
||||
# code, and the next field added here would not have it. A fixed
|
||||
# string search needs no such argument.
|
||||
if (index(items[i], "\"ip\":\"" ip "\"") && index(items[i], "\"type\":\"" t "\"")) continue
|
||||
if (!first) printf ","
|
||||
printf "{%s}", items[i]
|
||||
first=0
|
||||
@@ -889,7 +896,14 @@ tctl_persist_remove() {
|
||||
first=1
|
||||
for (i=1; i<=n; i++) {
|
||||
sub(/^\{/,"",items[i]); sub(/\}$/,"",items[i])
|
||||
if (items[i] ~ "\"ip\":\"" ip "\"" && items[i] ~ "\"type\":\"" t "\"") continue
|
||||
# index(), not ~: these values reach awk as a REGEX otherwise, and
|
||||
# its safety then rests on an argument about which characters the
|
||||
# fields can hold. That argument happens to hold today — an address
|
||||
# or a CIDR carries only the dot, which among valid values can line
|
||||
# up with nothing but another dot — but it is not a property of the
|
||||
# code, and the next field added here would not have it. A fixed
|
||||
# string search needs no such argument.
|
||||
if (index(items[i], "\"ip\":\"" ip "\"") && index(items[i], "\"type\":\"" t "\"")) continue
|
||||
if (!first) printf ","
|
||||
printf "{%s}", items[i]
|
||||
first=0
|
||||
|
||||
Reference in new issue
Block a user