diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-07-07 16:13:35 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-07-07 16:14:18 -0400 |
commit | 39c00050d2f273cd2af28db4546e55f20d1ae2db (patch) | |
tree | 113f039f98e5a85edf7a19d2f17a87f3c3214bdc /c_src | |
parent | ec23efce867a316f2f82df37fc5efd84bbdc7020 (diff) |
bpos_parse(): parse symbolic constants
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'c_src')
-rw-r--r-- | c_src/tools-util.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/c_src/tools-util.c b/c_src/tools-util.c index 150925eb..a31adcb0 100644 --- a/c_src/tools-util.c +++ b/c_src/tools-util.c @@ -681,6 +681,15 @@ static int kstrtouint_symbolic(const char *s, unsigned int base, unsigned *res) struct bpos bpos_parse(char *buf) { + if (!strcmp(buf, "POS_MIN")) + return POS_MIN; + + if (!strcmp(buf, "POS_MAX")) + return POS_MAX; + + if (!strcmp(buf, "SPOS_MAX")) + return SPOS_MAX; + char *orig = strdup(buf); char *s = buf; |