.. | .. |
---|
2 | 2 | // |
---|
3 | 3 | // Copyright (C) 2018 Masahiro Yamada <yamada.masahiro@socionext.com> |
---|
4 | 4 | |
---|
| 5 | +#include <ctype.h> |
---|
5 | 6 | #include <stdarg.h> |
---|
6 | 7 | #include <stdbool.h> |
---|
7 | 8 | #include <stdio.h> |
---|
.. | .. |
---|
9 | 10 | #include <string.h> |
---|
10 | 11 | |
---|
11 | 12 | #include "list.h" |
---|
| 13 | +#include "lkc.h" |
---|
12 | 14 | |
---|
13 | 15 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) |
---|
14 | 16 | |
---|
15 | 17 | static char *expand_string_with_args(const char *in, int argc, char *argv[]); |
---|
| 18 | +static char *expand_string(const char *in); |
---|
16 | 19 | |
---|
17 | 20 | static void __attribute__((noreturn)) pperror(const char *format, ...) |
---|
18 | 21 | { |
---|
.. | .. |
---|
393 | 396 | |
---|
394 | 397 | p++; |
---|
395 | 398 | } |
---|
| 399 | + |
---|
| 400 | + if (new_argc >= FUNCTION_MAX_ARGS) |
---|
| 401 | + pperror("too many function arguments"); |
---|
396 | 402 | new_argv[new_argc++] = prev; |
---|
397 | 403 | |
---|
398 | 404 | /* |
---|
.. | .. |
---|
548 | 554 | return __expand_string(&in, is_end_of_str, argc, argv); |
---|
549 | 555 | } |
---|
550 | 556 | |
---|
551 | | -char *expand_string(const char *in) |
---|
| 557 | +static char *expand_string(const char *in) |
---|
552 | 558 | { |
---|
553 | 559 | return expand_string_with_args(in, 0, NULL); |
---|
554 | 560 | } |
---|
555 | 561 | |
---|
556 | 562 | static bool is_end_of_token(char c) |
---|
557 | 563 | { |
---|
558 | | - /* Why are '.' and '/' valid characters for symbols? */ |
---|
559 | | - return !(isalnum(c) || c == '_' || c == '-' || c == '.' || c == '/'); |
---|
| 564 | + return !(isalnum(c) || c == '_' || c == '-'); |
---|
560 | 565 | } |
---|
561 | 566 | |
---|
562 | 567 | /* |
---|