From owner-svn-src-head@freebsd.org Thu Dec 17 13:01:06 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 784B34B7461 for ; Thu, 17 Dec 2020 13:01:06 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CxXDf2rVGz3P39 for ; Thu, 17 Dec 2020 13:01:06 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f45.google.com with SMTP id y17so26489410wrr.10 for ; Thu, 17 Dec 2020 05:01:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=6FXZRWp6R4iqRtoSTlPJbSgjUGMnpwJuIxYqbKVuIFE=; b=MU4TfdH92XarAE2UkuiJQoRHp9fx9QBCXozRgTkaDrs4FkesH1a6GvPLuo6KdzsZGV q5Q/PfNka4tFqCtLwldWzI8KalbnF1DX1iuZlFEPWynIM6k1DzDtlgvQYPuDSAbhYCfk 1nB9iEwV4AhdBBlFYEOQ9wVRm1zJsgbVuYAaxH4iXU8ldXHW29wooSm4dVMXhg9P70H5 S+CdZAT9y/KxurOnHmVxgYJjt+TDx3lVSIrAerG2hDWcEGoA3awxLW7U5SybHu0//2Da Cj1V2CmKNCCbjNkgEwzq1ZjdAAeKepj91YWomjiCNr7yLaqknJPDVWgBPSWKHxXwlNjO jWkg== X-Gm-Message-State: AOAM530vku9hdIR5GeOfw/uCFrnLqozYF+/yq4vz/kwYJkMoiFJpk3A2 9H47LNRjg/qFhFCJgNZSslcuQQ== X-Google-Smtp-Source: ABdhPJx53M0QBxybAGMbqsgXfUWCqR8juVmuYOCKg/S0B3dCDLDrFkpogeqY9DetgDLFhYwG3p9d8g== X-Received: by 2002:adf:dc87:: with SMTP id r7mr44217533wrj.305.1608210064682; Thu, 17 Dec 2020 05:01:04 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id o23sm9336774wro.57.2020.12.17.05.01.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Dec 2020 05:01:03 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: svn commit: r368714 - head/lib/libc/string From: Jessica Clarke In-Reply-To: Date: Thu, 17 Dec 2020 13:01:01 +0000 Cc: Mateusz Piotrowski <0mp@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <686CF2E6-1D3C-4A83-A323-02CD9F536675@freebsd.org> References: <202012171241.0BHCfl1r008452@repo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4CxXDf2rVGz3P39 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 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, 17 Dec 2020 13:01:06 -0000 On 17 Dec 2020, at 12:53, Konstantin Belousov = wrote: >=20 > On Thu, Dec 17, 2020 at 12:41:47PM +0000, Mateusz Piotrowski wrote: >> Author: 0mp (doc,ports committer) >> Date: Thu Dec 17 12:41:47 2020 >> New Revision: 368714 >> URL: https://svnweb.freebsd.org/changeset/base/368714 >>=20 >> Log: >> strerror.3: Add an example for perror() >>=20 >> This is a nice and quick reference. >>=20 >> Reviewed by: jilles, yuripv >> MFC after: 2 weeks >> Differential Revision: https://reviews.freebsd.org/D27623 >>=20 >> Modified: >> head/lib/libc/string/strerror.3 >>=20 >> Modified: head/lib/libc/string/strerror.3 >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/lib/libc/string/strerror.3 Thu Dec 17 03:42:54 2020 = (r368713) >> +++ head/lib/libc/string/strerror.3 Thu Dec 17 12:41:47 2020 = (r368714) >> @@ -32,7 +32,7 @@ >> .\" @(#)strerror.3 8.1 (Berkeley) 6/9/93 >> .\" $FreeBSD$ >> .\" >> -.Dd December 7, 2020 >> +.Dd December 17, 2020 >> .Dt STRERROR 3 >> .Os >> .Sh NAME >> @@ -170,6 +170,31 @@ The use of these variables is deprecated; >> or >> .Fn strerror_r >> should be used instead. >> +.Sh EXAMPLES >> +The following example shows how to use >> +.Fn perror >> +to report an error. >> +.Bd -literal -offset 2n >> +#include >> +#include >> +#include >> + >> +int >> +main(void) >> +{ >> + int fd; >> + >> + if ((fd =3D open("/nonexistent", O_RDONLY)) =3D=3D -1) { >> + perror("open()"); >> + exit(1); >> + } >> + printf("File descriptor: %d\en", fd); > This lines is indented with spaces, while other lines have tabs. >=20 >> + return (0); > return (0) is redundand. It's not required as per the standard, but omitting it is needlessly obfuscating it and bad practice. C lets you do a whole load of things that are a bad idea, and whilst this one is harmless, it is nonetheless confusing to anyone who is not intimately acquainted quirks like this special case in the standard. Jess