From owner-svn-src-head@freebsd.org Sun Nov 1 20:38:35 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 D60EE45946E; Sun, 1 Nov 2020 20:38:35 +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 4CPSYl5619z4YrC; Sun, 1 Nov 2020 20:38:35 +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 8E3A21E296; Sun, 1 Nov 2020 20:38:35 +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 0A1KcZYJ076168; Sun, 1 Nov 2020 20:38:35 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A1KcZQv076167; Sun, 1 Nov 2020 20:38:35 GMT (envelope-from se@FreeBSD.org) Message-Id: <202011012038.0A1KcZQv076167@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: Sun, 1 Nov 2020 20:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367255 - 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: 367255 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: Sun, 01 Nov 2020 20:38:35 -0000 Author: se Date: Sun Nov 1 20:38:35 2020 New Revision: 367255 URL: https://svnweb.freebsd.org/changeset/base/367255 Log: Fix psoition reporting for calendar data file in system directory MFC after: 3 days Modified: head/usr.bin/calendar/io.c Modified: head/usr.bin/calendar/io.c ============================================================================== --- head/usr.bin/calendar/io.c Sun Nov 1 19:13:55 2020 (r367254) +++ head/usr.bin/calendar/io.c Sun Nov 1 20:38:35 2020 (r367255) @@ -147,10 +147,22 @@ cal_fopen(const char *file) return (NULL); } +static char* +cal_path(void) +{ + static char buffer[MAXPATHLEN + 10]; + + if (cal_dir[0] == '/') + snprintf(buffer, sizeof(buffer), "%s/%s", cal_dir, cal_file); + else + snprintf(buffer, sizeof(buffer), "%s/%s/%s", cal_home, cal_dir, cal_file); + return (buffer); +} + #define WARN0(format) \ - warnx(format " in %s/%s/%s line %d", cal_home, cal_dir, cal_file, cal_line) + warnx(format " in %s line %d", cal_path(), cal_line) #define WARN1(format, arg1) \ - warnx(format " in %s/%s/%s line %d", arg1, cal_home, cal_dir, cal_file, cal_line) + warnx(format " in %s line %d", arg1, cal_path(), cal_line) static int token(char *line, FILE *out, int *skip, int *unskip)