From owner-svn-src-head@freebsd.org Thu Oct 29 08:31:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 791234469F8; Thu, 29 Oct 2020 08:31:48 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CMJZX2jcDz4Ndd; Thu, 29 Oct 2020 08:31:48 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4064F2AD18; Thu, 29 Oct 2020 08:31:48 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09T8Vm1n060439; Thu, 29 Oct 2020 08:31:48 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09T8VlbH060437; Thu, 29 Oct 2020 08:31:47 GMT (envelope-from se@FreeBSD.org) Message-Id: <202010290831.09T8VlbH060437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: se set sender to se@FreeBSD.org using -f From: =?UTF-8?Q?Stefan_E=c3=9fer?= Date: Thu, 29 Oct 2020 08:31:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367127 - head/usr.bin/calendar X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head/usr.bin/calendar X-SVN-Commit-Revision: 367127 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Oct 2020 08:31:48 -0000 Author: se Date: Thu Oct 29 08:31:47 2020 New Revision: 367127 URL: https://svnweb.freebsd.org/changeset/base/367127 Log: Simplify test for closing delimiter of #include argument (no functional change). While here: Fix invalid parameters of a commented-out debug printf() found when testing with this code enabled. MFC after: 3 days Modified: head/usr.bin/calendar/events.c head/usr.bin/calendar/io.c Modified: head/usr.bin/calendar/events.c ============================================================================== --- head/usr.bin/calendar/events.c Thu Oct 29 08:26:38 2020 (r367126) +++ head/usr.bin/calendar/events.c Thu Oct 29 08:31:47 2020 (r367127) @@ -207,8 +207,9 @@ event_print_all(FILE *fp) while (walkthrough_dates(&e) != 0) { #ifdef DEBUG - fprintf(stderr, "event_print_allmonth: %d, day: %d\n", - month, day); + if (e) + fprintf(stderr, "event_print_all month: %d, day: %d\n", + e->month, e->day); #endif /* Modified: head/usr.bin/calendar/io.c ============================================================================== --- head/usr.bin/calendar/io.c Thu Oct 29 08:26:38 2020 (r367126) +++ head/usr.bin/calendar/io.c Thu Oct 29 08:31:47 2020 (r367127) @@ -215,26 +215,12 @@ token(char *line, FILE *out, int *skip) return (T_ERR); } - a = *walk; + a = *walk == '<' ? '>' : '\"'; walk++; c = walk[strlen(walk) - 1]; - switch(c) { - case '>': - if (a != '<') { - warnx("Unterminated include expecting '\"'"); - return (T_ERR); - } - break; - case '\"': - if (a != '\"') { - warnx("Unterminated include expecting '>'"); - return (T_ERR); - } - break; - default: - warnx("Unterminated include expecting '%c'", - a == '<' ? '>' : '\"' ); + if (a != c) { + warnx("Unterminated include expecting '%c'", a); return (T_ERR); } walk[strlen(walk) - 1] = '\0';