From 0770337b2b35ea9ece19ef37de8efcb9cc828e99 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Sat, 27 Dec 2003 17:48:12 +0000 Subject: did some fixes/cleanup here. Make sure csslint --help shows a proper help. 2003-12-27 Dodji Seketeli * csslint/csslint.c: did some fixes/cleanup here. Make sure csslint --help shows a proper help. * src/parser/cr-statement.c: (cr_statement_dump): when a NULL statement is given, do not dump anything, instead considering this as an error. * src/parser/cr-stylesheet.c: (cr_stylesheet_dump): give the possibility to dump empty sheets, instead of considering this case as an error case. --- ChangeLog | 12 ++++++++++++ csslint/csslint.c | 14 ++++++++++++-- src/parser/cr-parser.c | 5 +++-- src/parser/cr-statement.c | 4 +++- src/parser/cr-stylesheet.c | 4 ++-- src/parser/cr-utils.c | 2 +- 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 308d533..7ce345f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2003-12-27 Dodji Seketeli + + * csslint/csslint.c: did some fixes/cleanup here. + Make sure csslint --help shows a proper help. + * src/parser/cr-statement.c: + (cr_statement_dump): when a NULL statement is given, do + not dump anything, instead considering this as an error. + * src/parser/cr-stylesheet.c: + (cr_stylesheet_dump): give the possibility to dump + empty sheets, instead of considering this case as + an error case. + 2003-12-24 Dodji Seketeli * src/parser/cr-additional-sel.h,src/parser/cr-pseudo.h, diff --git a/csslint/csslint.c b/csslint/csslint.c index a39a3fd..a44ed2c 100644 --- a/csslint/csslint.c +++ b/csslint/csslint.c @@ -36,7 +36,7 @@ struct Options { gboolean show_version ; gboolean use_cssom ; - + gboolean display_help ; gchar ** files_list ; }; @@ -86,6 +86,11 @@ csslint_parse_cmd_line (int a_argc, char **a_argv, { a_options->use_cssom = TRUE ; } + if (!strcmp (a_argv[i], "--help") || + !strcmp (a_argv[i], "-h")) + { + a_options->display_help = TRUE ; + } } if (i >= a_argc) @@ -190,6 +195,11 @@ main (int argc, char **argv) return 0; } + if (options.display_help == TRUE) + { + csslint_usage (argv[0]) ; + return 0 ; + } if (options.use_cssom == TRUE) { if (options.files_list != NULL) @@ -200,7 +210,7 @@ main (int argc, char **argv) } else { - csslint_show_version(argv[0]); + csslint_usage (argv[0]); return 0; } diff --git a/src/parser/cr-parser.c b/src/parser/cr-parser.c index d6252a5..c580799 100644 --- a/src/parser/cr-parser.c +++ b/src/parser/cr-parser.c @@ -176,7 +176,7 @@ if ((status) != CR_OK) \ *on the parser error stack when an error arises. *@param a_this the current instance of #CRParser . *@param a_status the status to check. Is of type enum #CRStatus. - *@param a_is_exception in case of error, if is FALSE, the status + *@param a_is_exception in case of error, if is TRUE, the status *is set to CR_PARSING_ERROR before goto error. If is false, the *real low level status is kept and will be returned by the *upper level function that called this macro. Usally,this must @@ -4001,7 +4001,7 @@ cr_parser_parse_ruleset (CRParser *a_this) } } - CHECK_PARSING_STATUS_ERR + CHECK_PARSING_STATUS_ERR (a_this, status, FALSE, "while parsing ruleset: next construction should be a declaration", CR_SYNTAX_ERROR) ; @@ -4018,6 +4018,7 @@ cr_parser_parse_ruleset (CRParser *a_this) status = cr_parser_parse_declaration (a_this, &property, &expr) ; + if (expr) { cr_term_ref (expr) ; diff --git a/src/parser/cr-statement.c b/src/parser/cr-statement.c index 88ef9c0..a857680 100644 --- a/src/parser/cr-statement.c +++ b/src/parser/cr-statement.c @@ -2303,7 +2303,9 @@ cr_statement_at_font_face_rule_add_decl (CRStatement *a_this, void cr_statement_dump (CRStatement *a_this, FILE *a_fp, gulong a_indent) { - g_return_if_fail (a_this) ; + + if (!a_this) + return ; if (a_this->prev) { diff --git a/src/parser/cr-stylesheet.c b/src/parser/cr-stylesheet.c index 4b3cba6..06b1c5f 100644 --- a/src/parser/cr-stylesheet.c +++ b/src/parser/cr-stylesheet.c @@ -3,7 +3,7 @@ /* * This file is part of The Croco Library * - * Copyright (C) 2002-2003 Dodji Seketeli + * Copyright (C) 2002-2003 Dodji Seketeli * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2.1 of the GNU Lesser General Public @@ -68,7 +68,7 @@ cr_stylesheet_dump (CRStyleSheet *a_this, FILE *a_fp) { CRStatement * cur_stmt = NULL ; - g_return_if_fail (a_this && a_this->statements) ; + g_return_if_fail (a_this) ; for (cur_stmt = a_this->statements ; cur_stmt ; diff --git a/src/parser/cr-utils.c b/src/parser/cr-utils.c index cbc4593..4c7c00a 100644 --- a/src/parser/cr-utils.c +++ b/src/parser/cr-utils.c @@ -3,7 +3,7 @@ /* * This file is part of The Croco Library * - * Copyright (C) 2002-2003 Dodji Seketeli + * Copyright (C) 2002-2003 Dodji Seketeli * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2.1 of the GNU Lesser General Public -- cgit v1.2.1