From owner-freebsd-questions@FreeBSD.ORG Fri Dec 2 15:38:33 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 432F616A41F for ; Fri, 2 Dec 2005 15:38:33 +0000 (GMT) (envelope-from elvstone@gmail.com) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id C9C2A43D5A for ; Fri, 2 Dec 2005 15:38:32 +0000 (GMT) (envelope-from elvstone@gmail.com) Received: by xproxy.gmail.com with SMTP id t12so443462wxc for ; Fri, 02 Dec 2005 07:38:31 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=lPNDs6rpnyc+LHSWH3aUO2piHt3QKh7+Oaez4XY2oRGYyMGt47g6jDwyJoZQ+tTawCjG7tfCB8C37W4iFCKNtidY3sk9tnzefLAnG1GwHYgSNxAKNfk+q+KBx/E2qmey2soZEeQEOt5VT3wijNkkyHNqAZLP1OuyZYeKeF7TMTI= Received: by 10.11.98.49 with SMTP id v49mr67492cwb; Fri, 02 Dec 2005 07:38:31 -0800 (PST) Received: by 10.11.98.33 with HTTP; Fri, 2 Dec 2005 07:38:31 -0800 (PST) Message-ID: <751a4f870512020738i5b30096fr@mail.gmail.com> Date: Fri, 2 Dec 2005 16:38:31 +0100 From: Aron Stansvik To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: Why scandir(3) argument not const? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2005 15:38:33 -0000 Hello. I read scandir(3). Why: scandir(const char *dirname, struct dirent ***namelist, int (*select)(struct dirent *), int (*compar)(const void *, const void *)); and not: scandir(const char *dirname, struct dirent ***namelist, int (*select)(const struct dirent *), int (*compar)(const void *, const void *)); I.e. why is the dirent pointer in the third argument not a const dirent pointer? I see that on Linux and NetBSD it is declared const, but not so on FreeBSD and OpenBSD (don't know about other platforms). Since this in not a POSIX function, but a BSD extension, it would be nice if the prototypes for the function was compatible across platforms. Is there any case where the filter function should need to change the dirent structure? I think not. Comments? Best regards, Aron Stansvik