diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-03-11 12:16:25 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-03-11 12:16:25 +0000 |
commit | 1b5312d5c01fd5e12b938cfe65cda562e822619d (patch) | |
tree | 60f086613e97aae5cb2635b8b9e3251c7b3c55cf /src/skaembutils/s6-expr.c | |
parent | ac77200b30d6c8bbe9093655dd0f8d8bf6e88feb (diff) | |
download | s6-portable-utils-1b5312d5c01fd5e12b938cfe65cda562e822619d.tar.xz |
Adapt to skalibs-2.5.0.0
Diffstat (limited to 'src/skaembutils/s6-expr.c')
-rw-r--r-- | src/skaembutils/s6-expr.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/skaembutils/s6-expr.c b/src/skaembutils/s6-expr.c index accb0e6..a36f422 100644 --- a/src/skaembutils/s6-expr.c +++ b/src/skaembutils/s6-expr.c @@ -1,11 +1,8 @@ /* ISC license. */ -#include <sys/types.h> -#include <unistd.h> +#include <string.h> #include <skalibs/allreadwrite.h> -#include <skalibs/bytestr.h> -#include <skalibs/ulong.h> -#include <skalibs/fmtscan.h> +#include <skalibs/types.h> #include <skalibs/strerr2.h> #define USAGE "s6-expr arithmetic expression" @@ -68,13 +65,13 @@ static unsigned int lex (struct node *tree, char const *const *argv) { "&", T_AND, 5 }, { 0, 0, 0 } } ; - register unsigned int pos = 0 ; + unsigned int pos = 0 ; for (; argv[pos] ; pos++) { - register unsigned int i = 0 ; + unsigned int i = 0 ; for (i = 0 ; tokens[i].string ; i++) - if (!str_diff(argv[pos], tokens[i].string)) + if (!strcmp(argv[pos], tokens[i].string)) { tree[pos].op = tokens[i].op ; tree[pos].type = tokens[i].type ; @@ -90,7 +87,7 @@ static unsigned int lex (struct node *tree, char const *const *argv) return pos ; } -static void reduce (struct node *tree, register unsigned int *stack, register unsigned int *sp, unsigned int type) +static void reduce (struct node *tree, unsigned int *stack, unsigned int *sp, unsigned int type) { if (tree[stack[*sp-1]].type == type) { @@ -191,7 +188,7 @@ static long run (struct node const *tree, unsigned int root) int main (int argc, char const *const *argv) { - char fmt[ULONG_FMT+1] ; + char fmt[LONG_FMT] ; long val ; size_t len ; PROG = "s6-expr" ; |