aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFiles
2016-08-08Rename the projectargotSergey Poznyakoff165
2016-08-05Minor fixSergey Poznyakoff1
* build-aux/getopt.m4: Only define lastoptlab if necessary
2016-08-05New operator to stop option processingSergey Poznyakoff1
* build-aux/getopt.m4 (LASTOPT): New macro. Stops further option processing.
2016-07-29Start Automake conditionals on column one.Sergey Poznyakoff2
2016-07-16Complement 529fed25Sergey Poznyakoff2
* tests/gcfpeek.c: New options: -strcat -stradj * tests/locus02.at: Use these.
2016-07-16Disable adjacent string concatenation.Sergey Poznyakoff9
The adjacent string concatenation feature doesn't work well with multiple-argument statements. The common example (found in GNU pies) is the "env" statement: env "PATH=/sbin:$PATH" "PRELOAD=true" The intent was to pass it two arguments, but in fact they get concatenated into one. To control this, the grecs_parser_options variable is introduced. If it has the GRECS_OPTION_QUOTED_STRING_CONCAT bit set, adjacent string concatenation is enabled. By default it is disabled. The GRECS_OPTION_ADJUST_STRING_LOCATIONS bit controls the way the quoted sring locations are computed. If it is set, the beginning of the string is counted at the first character after the opening double quote, and its end at the character immediately preceding the closing double quote. Otherwise, both double-quote characters are included in the location (the default). The change is backward incompatible. * doc/grecs-syntax.texi: Update. * include/grecs/parser.h (grecs_adjust_string_locations): Remove. (grecs_parser_options): New extern. * src/grecs-lex.l: QSTRING is returned only if GRECS_OPTION_QUOTED_STRING_CONCAT option is set. The GRECS_OPTION_ADJUST_STRING_LOCATIONS option controls string locus adjustment. * src/parser.c (grecs_adjust_string_locations): Remove. (grecs_parser_options): New variable. * tests/Makefile.am: Add strcat.at, stradj.at * tests/testsuite.at: Likewise. * tests/gcffmt.c: New options -strcat and -stradj * tests/stradj.at: New test case. * tests/strcat.at: New test case.
2016-07-04Remove leftover includesSergey Poznyakoff1
* build-aux/getopt.m4: Include grecs/opt.h
2016-07-04Update copyright yearsSergey Poznyakoff1
2016-07-04Fix prototypes.Sergey Poznyakoff1
2016-07-04Fix prototypes.Sergey Poznyakoff1
2016-07-04Prevent memory leaks when re-processing values of string type.Sergey Poznyakoff1
Port of a3f25ce2 from master. * include/grecs/table.h (GRECS_CONST): New flag. * src/tree.c (grecs_string_convert): For string types, free the old value prior to assigning the new one, unless the GRECS_CONST flag is set. In any case, clear the GRECS_CONST flag after assigning new value.
2016-07-04Unify some typedefs.Sergey Poznyakoff4
Use _ptr_t suffix for typedefs that define pointers.
2016-07-04Split declarations between several header files.Sergey Poznyakoff60
* Makefile.am (SUBDIRS): Add include * am/grecs.m4 (GRECS_INCLUDES): Update (GRECS_COND_BUILD_INSTALL) (GRECS_COND_BUILD_SHARED) (GRECS_COND_BUILD_STATIC): New conditions. Build include/Makefile and include/grecs/Makefile. * configure.ac: Use src/grecs-gram.y as a source validity marker * include/Makefile.a: New file. * src/grecs.hin: Remove. Split into include/*. See below. * include/grecs.h: New file. * include/grecs/.gitignore: New file. * include/grecs/Makefile.am: New file. * include/grecs/doc.h: New file. * include/grecs/error.h: New file. * include/grecs/format.h: New file. * include/grecs/lex.h: New file. * include/grecs/list.h: New file. * include/grecs/mem.h: New file. * include/grecs/node.h: New file. * include/grecs/parser.h: New file. * include/grecs/preproc.h: New file. * include/grecs/sockaddr.h: New file. * include/grecs/symtab.h: New file. * include/grecs/table.h: New file. * include/grecs/tree.h: New file. * include/grecs/txtacc.h: New file. * include/grecs/types.h.in: New file. * include/grecs/util.h: New file. * include/grecs/value.h: New file. * include/grecs/version.h: New file. * src/grecs-locus.h: Move to ... * include/grecs/locus.h: ... here * src/grecsopt.h: Move to ... * include/grecs/opt.h: ... here * src/json.h: Move to ... * include/grecs/json.h: ... here * src/wordsplit.h: Move to ... * include/wordsplit.h: ... here * src/Make-inst.am (include_HEADERS): Remove. * src/Make-shared.am (grecsinclude_HEADERS) (noinst_HEADERS): Remove. * src/Make-static.am (noinst_HEADERS): Remove. * src/Make.am: Remove header-related stuff * src/bind-gram.y: Fix includes. * src/bind-lex.l: Likewise. * src/cidr.c: Likewise. * src/dhcpd-gram.y: Likewise. * src/dhcpd-lex.l: Likewise. * src/diag.c: Likewise. * src/format.c: Likewise. * src/grecs-gram.y: Likewise. * src/grecs-lex.l: Likewise. * src/json-gram.y: Likewise. * src/json-lex.l: Likewise. * src/jsonfmt.c: Likewise. * src/lookup.c: Likewise. * src/meta1-gram.y: Likewise. * src/meta1-lex.l: Likewise. * src/opthelp.c: Likewise. * src/preproc.c: Likewise. * src/sockaddr.c: Likewise. * src/txtacc.c: Likewise. * src/version.c: Likewise. * tests/gcfenum.c: Likewise. * tests/gcffmt.c: Likewise. * tests/gcfpeek.c: Likewise. * tests/gcfset.c: Likewise. * tests/gcfver.c: Likewise. * tests/json.c: Likewise.
2016-07-04Update copyright yearsSergey Poznyakoff132
2016-06-20Ensure grecs_preproc reentrancy after grecs_preproc_doneSergey Poznyakoff1
* src/preproc.c (grecs_preproc_done): Reset static variables after free.
2016-06-20Avoid closing stdin.Sergey Poznyakoff1
The default grecs parser closes stdin before returning. This might cause grief for programs assuming that open(2) never returns 0. * src/grecs-lex.l (yywrap): Avoid closing stdin. The yyin variable has meaning only if grecs_preprocessor is set. Otherwise, it will be assigned the pointer to stdin by lex-generated code.
2016-06-20Fix grecs_foreach_include_dirSergey Poznyakoff1
2016-06-20Fix grecs_include_path_countSergey Poznyakoff1
* src/preproc.c (grecs_include_path_count): Return count.
2016-06-18Fix prototypes.Sergey Poznyakoff2
2016-06-18Fix handling of undefined escape sequences.Sergey Poznyakoff6
* src/lineacc.c (grecs_line_acc_grow_char_unescape): If the escape sequence is not defined, add the character itself and return 1. Return 0 otherwise. (grecs_line_acc_grow_unescape_last): Take pointer to locus as third argument. If not NULL, print warning about undefined escape sequences. All callers updated. * src/parser.c (grecs_parse): Unless grecs_trace_flags is already set, set it from the value of GRECS_DEBUG environment variable.
2016-03-12Prevent NULL dereferencing when attempting to remove an unexistent symtab entry.Sergey Poznyakoff1
* src/symtab.c (grecs_symtab_remove): Return if no matching entry was found.
2016-03-05Improve dhcpd parserSergey Poznyakoff7
* src/dhcpd-gram.y: Support assignments and conditional expressions. * src/dhcpd-lex.l: New exclusive states BOOL and EXPR. * src/parsertab.c (parser_tab) [ENABLE_DHCPD_PARSER]: Define dhcpd parser. * tests/parser-dhcpd.at: New file. * tests/Makefile.am: Add parser-dhcpd.at * tests/testsuite.at: Likewise.
2016-02-23Reword some diagnosticsSergey Poznyakoff2
2016-02-21Fix memory leaksSergey Poznyakoff2
2016-02-21Prevent memory leaks when re-processing values of string type.Sergey Poznyakoff2
* src/grecs.hin (GRECS_CONST): New flag. * src/tree.c (grecs_string_convert): For string types, free the old value prior to assigning the new one, unless the GRECS_CONST flag is set. In any case, clear the GRECS_CONST flag after assigning new value.
2016-01-21Implement grecs_list_compare; other minor fixes.Sergey Poznyakoff4
* src/grecs.hin (grecs_list_compare) (grecs_node_unlink): New protos. * src/list.c (grecs_list_compare): New function. * src/wordsplit.c (wordsplit_getwords): Word count is size_t * src/wordsplit.h (wordsplit_getwords): Fix proto.
2016-01-09BugfixSergey Poznyakoff2
* src/meta1-lex.l: Fix erroneous #ifndef
2016-01-09BugfixSergey Poznyakoff1
* src/sockaddr.c (parse_inet): Handle GRECS_AH_PASSIVE
2016-01-09Fix memory leakSergey Poznyakoff2
* src/list.c (grecs_list_remove_entry): Free the entry, but not its data. All callers updated. * src/txtacc.c (grecs_txtacc_free_string): Free the txtacc entry after removal.
2016-01-05Implement json_array_setSergey Poznyakoff2
2015-12-31Case-insensitive hash functionSergey Poznyakoff2
* src/grecs.hin (grecs_hash_string_ci): New proto. * src/symtab.c (grecs_hash_string_ci): New function.
2015-12-25Cleanup json code.Sergey Poznyakoff4
* src/json-gram.y (json_new_string) (json_new_number,json_new_bool,json_new_null) (json_new_object),json_new_null) (json_new_object,json_new_array) (json_object_set,json_object_get) (json_array_size,json_array_flatten) (json_array_insert,json_array_append) (json_array_get): New functions. * src/json.h (json_array): New member ol. (json_unescape): Change signature. Add new prototypes. * src/json-lex.l: Return allocated string as T_STRING. (json_unescape): Change signature. * src/jsonfmt.c: Use new accessors. Don't escape / in strings.
2015-12-20Implement function for formatting JSON valuesSergey Poznyakoff4
* src/Make.am: Add jsonfmt.c * src/json.h (json_format): New struct. (json_format_value): New proto. * src/jsonfmt.c: New file. * tests/json.c: Use json_format_value.
2015-12-19Bugfix in test suiteSergey Poznyakoff1
* tests/wsp.c (make_env_kv): Fix array size
2015-12-18Minor fixSergey Poznyakoff3
* src/bind-lex.l: Set noinput,nounput options * src/dhcpd-lex.l: Likewise. * src/meta1-lex.l: Likewise.
2015-12-18Add basic JSON support functions.Sergey Poznyakoff17
* src/Make-inst.am: Add json.h * src/Make-shared.am: Likewise. * src/Make-static.am: Likewise. * src/Make.am: Likewise. * src/json-gram.y: New file. * src/json-lex.l: New file. * src/json.h: New file. * src/yytrans: Translate json prefixes. * src/.gitignore: Update. * tests/json.c: New file. * tests/json00.at: New file. * tests/json01.at: New file. * tests/Makefile.am: Add new tests; build json * tests/testsuite.at: Add new tests. * tests/.gitignore: Update. * am/grecs.m4: New flag "json" * configure.ac (GRECS_SETUP): Require json * src/Make-inst.am (include_HEADERS): Assign GRECS_HDR value. * src/Make-shared.a [GRECS_COND_INSTALLHEADERS] (grecsinclude_HEADERS) [!GRECS_COND_INSTALLHEADERS] (noinst_HEADERS): Likewise. * src/Make-static.am (noinst_HEADERS): Likewise. * src/Make.am [GRECS_COND_JSON]: Define GRECS_JSON and GRECS_EXTRA_JSON.
2015-12-17Minor improvement in wordsplit.Sergey Poznyakoff2
* src/wordsplit.h (WRDSX_WORD, WRDSX_QUOTE): New defines. * src/wordsplit.c: Use them when initializing ws_escape.
2015-12-17Update copyright yearsSergey Poznyakoff124
2015-12-17wordsplit: fix ws trimming and return_delim optionSergey Poznyakoff2
* src/wordsplit.c (_WSNF_DELIM): New node flag (wsnode_flagstr): Print 'd' for that flag. (expvar): Don't set WRDSF_WS when expanding variable value. This fixes, e.g., expansion of a$x if x begins with a whitespace. (wsnode_nullelim): A _WSNF_DELIM node breaks join chain. (wordsplit_trimws): Don't affect nodes within join chains. (scan_word): Set _WSNF_DELIM for returned delimiters. * tests/wordsplit.at (TESTWSP): 8th argument - prologue shell code. Use it to unset environment variables in env/getenv tests. Test ws elimination with return_delims set.
2015-12-17Minor fixes in wordsplit documentationSergey Poznyakoff1
2015-12-17wordsplit: minor fixesSergey Poznyakoff2
2015-12-17wordsplit: improve docs, add new functionSergey Poznyakoff3
* src/wordsplit.c (wordsplit_getwords): New functon. * src/wordsplit.h (wordsplit_getwords): New proto. * doc/wordsplit.3: Add example section, document wordsplit_getwords.
2015-12-17Finish wordsplit docs, improve testsSergey Poznyakoff5
2015-12-17Improve wordsplitSergey Poznyakoff5
* src/wordsplit.c: Implement default assignment, word expansion in variable defaults, distinction between ${variable:-word} and ${variable-word}. * doc/wordsplit.3: New file. * src/wordsplit.h (wordsplit)<ws_envbuf,ws_envidx> <ws_envsiz>: New members. (WRDSF_ARGV): Remove. (WRDSF_OPTIONS): New flag. (WRDSO_ARGV): New option bit. * tests/wordsplit.at: Add new tests. * tests/wsp.c: Set WRDSF_OPTIONS flag if one of the options is requested.
2015-12-17Improve wordsplit documentation and debug output.Sergey Poznyakoff2
2015-12-17Test pathname expansionSergey Poznyakoff1
2015-12-17Various improvements in wordsplitSergey Poznyakoff1
* src/wordsplit.c (wordsplit_trimws): Retutn int. (wordsplit_tildexpand,wordsplit_pathexpand): Add missing return. (wordsplit_process_list): Rewrite in a table-driven fashion.
2015-12-17wordsplit: implement tilde and pathname expansionSergey Poznyakoff3
* src/wordsplit.c (wordsplit_tildexpand) (wordsplit_pathexpand): New functions. (wordsplit_process_list): Run tilde and pathname expansion if WRDSF_PATHEXPAND flag is set. * src/wordsplit.h (wordsplit)<ws_options>: New member. (WRDSF_PATHEXPAND): New flag. (WRDSO_NULLGLOB,WRDSO_FAILGLOB) (WRDSO_DOTGLOB): New defines. * tests/wsp.c: New options pathexpand, nullglob, failglob, dotglob. Fix help output.
2015-12-17wordsplit: perform quote removal before command substitutionSergey Poznyakoff1
2015-12-17cleanup in wordsplitSergey Poznyakoff2

Return to:

Send suggestions and report system problems to the System administrator.