From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 362AE941C0B for ; Fri, 20 Oct 2023 19:54:29 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=6F4rlbr06fxmXg/5vuM1k0lt0ciLppwsoiPIMQuHrUY=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1697831668; v=1; b=Hoc7rD5m0yLWfM++T3aTnKQbowsRLGieBz0NdiQJzKtn22KsuBlWsAcVMy6kw12aCRnfReOM pTZ19VE69Rd3BRWNcOPKoslWZTYiBhFFKwb5uI9KPEEzGp3PN9KjBLqwi9q5PgUVHhKel+DR4Zj Gc5QfM8iEl/6PBdMCxPy+u3E= X-Received: by 127.0.0.2 with SMTP id TTufYY7687511xrIpqVocfFz; Fri, 20 Oct 2023 12:54:28 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.64333.1697831667695529291 for ; Fri, 20 Oct 2023 12:54:28 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10869"; a="472788239" X-IronPort-AV: E=Sophos;i="6.03,239,1694761200"; d="scan'208";a="472788239" X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2023 12:54:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10869"; a="827834053" X-IronPort-AV: E=Sophos;i="6.03,239,1694761200"; d="scan'208";a="827834053" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga004.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 20 Oct 2023 12:54:26 -0700 X-Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Fri, 20 Oct 2023 12:54:26 -0700 X-Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Fri, 20 Oct 2023 12:54:26 -0700 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.168) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Fri, 20 Oct 2023 12:54:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AJdkvBhNVB8Y5Jc/1lc7fBTU++oiQT0U5wncx+WCzOlEBrRfJzmHKkL7BAihLuE62/xqqn6qwW0xSETvUlXGDo7cm9fgZ5Tk3ArGldpFn/gKGq5MkOejRCpaeEWFALu/VJvKYMq0Q+/usIQu1LbWQoGjAF1MUioE10KA7R9XzkEKjQOk7mqSFjLOijIOazmjUvEdlttB8lqwwj3XY8a4nc1EXIuE9czhDXasZKtLiEM9VxCohRAkvGEaHnF01zUauk6ri9Br2+viw2HYL9qXLltzojFRRJ9j7tQ5R++h3bLGrPWcLyi28R6+d9w+8GQ0jRbxADHeFVVexQGha5rgpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=U6VP07ZSsxAUXpcqaWCX4fuKsExeu8QnpNbU7+unzbA=; b=mZAxh2w6teWtPYf372M3W5tDMnC04JroRHz1KjR5JSs2Fct5+SUhBKL1c+dqxEsQMdiqVdUSM5kKdWuF0yc1St+c25Ui8X/hCLq/g9+FUc61VP0fwX/MMOvErbLZ3KzDSZmEtCY/yksN6WsdhznQbxKEuATK18AgHsWyncsr7yjTFUNK9xkaFFu0ZEwPDAE8eamyiS3WskFN9O3/TXaRCxhuz5t7+UtG4+MpJHTQdDvcmi97nqp3U3u9sTDfeIEGpvqCuhSmuoxqHw/YLdfEzTHDOe3+JFmVZLMvoTf+7jt23MQvGMS9BmDU0bIrTyd+05PvApOF4N6wikRiC3sQSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from CO1PR11MB4929.namprd11.prod.outlook.com (2603:10b6:303:6d::19) by PH7PR11MB7596.namprd11.prod.outlook.com (2603:10b6:510:27e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.26; Fri, 20 Oct 2023 19:54:15 +0000 X-Received: from CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::2ebf:3b09:b169:ee2c]) by CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::2ebf:3b09:b169:ee2c%4]) with mapi id 15.20.6907.022; Fri, 20 Oct 2023 19:54:15 +0000 From: "Michael D Kinney" To: "Jayaprakash, N" , "devel@edk2.groups.io" CC: Rebecca Cran , Tyler Erickson , Ard Biesheuvel , Leif Lindholm , "Kinney, Michael D" Subject: Re: [edk2-devel] [edk2-libc Patch 1/1] ek2-libc: Enhance StdLib for supporting Aarch64 and ARM Thread-Topic: [edk2-libc Patch 1/1] ek2-libc: Enhance StdLib for supporting Aarch64 and ARM Thread-Index: AQHaA15d4LB9raxtN06r8hAIPD6/TbBTF4dg Date: Fri, 20 Oct 2023 19:54:15 +0000 Message-ID: References: <20231020140406.2432-1-n.jayaprakash@intel.com> <20231020140406.2432-2-n.jayaprakash@intel.com> In-Reply-To: <20231020140406.2432-2-n.jayaprakash@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CO1PR11MB4929:EE_|PH7PR11MB7596:EE_ x-ms-office365-filtering-correlation-id: 4dfd7e63-c47b-4814-193b-08dbd1a656fc x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: blE2rJsZ8LqgV9sdVdMmldoZf77JUPg/GYT1o6aW/yuHNdQdhpGKEhBw1Yl0TMoqFbbdXc9onkU+YbnO34i31H1RRZQ9zpTgIUnCZzyEhlwo+Kmwnd1f7EqYbtgCXY2dgqSli2svrxevPm3Ph8X5YrjPLKtOinwDAcu6KIPDWZNyZs6jHaVOGEC4jiivjz4DAoayAR7/1T6dQ+3ku0b5+TafUsufblhg3dCIjE5ZgoZtjrsDIXSDM6PaNBsVft/R1MN3on2sFzEIdFkkuE+LUNX1ow8VQ87SEMVE8G5IGyNzFG7BVZgaS4MLNNpPUvBcEkwYgL3ZpQd8jHrjI/gNDRGqV48cvQNFqwWbEv693S5++kDbk0m2+BWCVc8OJgeQuu+Rv/SPkKGgQJjR+1oGzC9ieYxtKQJNKWjTFWLVU1MyAZutn4LE35EhZOrNG3cT27G1EHDSvZa5a6i/xGJQtCQg/07sl/ZoufZ4v8rj7QY6lUxQWQl0L67kDCqwvRX80bjsK6r1YCC2ZxBrY3jwPAuGeYHsr5MAxOG/SFBosauqfvL3dv3L6Kh8wCJC2wMWfAvuT6cWJVbhB6U6S1eER2/eBA8CUN6IQT6BJRHNHYQA+9kjCoDZylTVtwZAbrqwFZ4meqrQods7eWLZMQK8iARi4DqogMbsY35mHtQPRZY= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?RlFyoObTDVxqXLQm9TGd5ubTCVs2E5ihCsElyScFfwyrCGMu0I/ATblBwT68?= =?us-ascii?Q?vbiiwUSo3A34z2YYW3+zauKAU/4Nu5IhQjVTZY5jwMs6INDptx41lz2TPL++?= =?us-ascii?Q?nF72TBwaArVCnPJZ/3/3eo4poVcII+xg4U8NMazUpo3c2Jpinl4NNvvGr60V?= =?us-ascii?Q?MX5pZ9I+1jn5mBK6aRBwzSzgY6tT1uR0oT3p+TYmVkF62G55XN5JSu9+O6ur?= =?us-ascii?Q?6O+JkzB0cbXXGd93g7LL0WAYU74j+8cC3hvxWHou1XLFtHVwWIZp3gFCDFFP?= =?us-ascii?Q?BSp/5ttYr7Y4tZGucjDcm7YdP+5eKqNb8/kLXCM0xtS+m1VBsK6OxnZ3Ibns?= =?us-ascii?Q?zrsciOJxOLvBSqxHDlL1WxLXCz81eTq+PsoV2jVg0SEb1dum3efMuNMEJz6+?= =?us-ascii?Q?WbhFaegxcVXBmKJ8/+AJPWKTiAqAnnMZmdLFsR8iNrXf6xn8P5DPIP6jq6m2?= =?us-ascii?Q?wQtWaDwtDOYxcCVy0z/gJVN97bl64XucbL27sH6xaVu6BjxRvCC7lQ09pWuR?= =?us-ascii?Q?tqYK7aFpjKO5rxPBZqmUOlDFe+6YBlw9DiZaga7qrDcETfWCvae3l1amJigO?= =?us-ascii?Q?ZXqVo0z5ZGbWVCfhELp+3MkT3oUUSN0gsseT20VogBVeJhs8gdwccY1WG7fJ?= =?us-ascii?Q?gJw6BB7h5dSfSOamgVetI+MdzJKrIN6GKy3ymsSrvxKU3wlUc3aqT4M1kijW?= =?us-ascii?Q?/4Q6UK5sv1mDsMF6Cx8VlcjhebmE7GKSjHG2D7Qd1cTLp8PHWzgNool0fi2B?= =?us-ascii?Q?0sQEaRD7VIGRXjd0Iz4ydyc3aBkwDfkzS/w0YmCudiUc09U+ZPq7CDLzKdr6?= =?us-ascii?Q?SwYDvIJbc/gNEWrUjF52PdSM670dsrdCuf5cZ1hwivO/RBpYvIViFuLx+I2j?= =?us-ascii?Q?PGXwhm/lqqC7SwuhIhTA2n5uUbPlkmxzgZoqD/JlzUsyMEG89DvB8lGdLJ7Q?= =?us-ascii?Q?9DpvkVAmby6scVcNtqHyb/07s8y1BzvVTXY+P1VxVEMqqDT04UuVsjdQHUrQ?= =?us-ascii?Q?PI74qYIjFc7a/uyo0FDMfnN6pt21qcx0qMEerYELF3462vgcuKqCMtTGQzSH?= =?us-ascii?Q?3rFelFZXkiKkKO978hvoNUDgH/NUCJoAIhTpnJTiDC/LA2O5FDdpU3CEwUQI?= =?us-ascii?Q?7Pq5vZaxBLJGaygU6y5x6rUNMUNevmY3tZ1fLRrgdH38MxXNa1zRjtaYdlXF?= =?us-ascii?Q?HP3UsxqB9kGazhv2yna8rDqGQQPQYj8KnbYbVqtRI0lPKDnHCfix/DoLEFpB?= =?us-ascii?Q?QpljDNDfuTGhhacDyK9Rnj8an0CazEhSb4Bk/Ilnt5KEfAa/lmAYZrwEaYeI?= =?us-ascii?Q?YvEwatNKoZmWb/zCNZbrDmgQrp+a5Wvk4zcq81k31HVzl6CflHE0BUfH13pR?= =?us-ascii?Q?YFxC5+kaOwuc55imgQ8P1JptwEgcKJDDbCnogXBUGvq78O2Dw9xSxydsHXU+?= =?us-ascii?Q?55cPE2xrBnHLpR+KJzKkxVddSmd5dfnm1g29mk2XEkFk9EtDcxE3vP3C5RiL?= =?us-ascii?Q?SCTlUjYVaEjdD26cSVBU/kVttpNnEdT8PZlYjQxH62lOI7mJ08VcJrBtUyll?= =?us-ascii?Q?nbzYOZK7wfNkUC2N4lqhpUhNtGfVgCdwYWI26f/q2IYQN+ABVgSEAmrGHn8t?= =?us-ascii?Q?EQ=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4929.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4dfd7e63-c47b-4814-193b-08dbd1a656fc X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Oct 2023 19:54:15.6968 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: LDC+iTyqn+phlB/d5MRkhOa1dV95smXDowuNkVJSYRww8TKtWlYCFV+Z6oNkcmK/kMRdVivNhwptgsjOpJrS6EKN54/vvocnhNyet+AOl1g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7596 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: vR14ibLJFi3QxhviHuAaoQa6x7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=Hoc7rD5m; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io +Ard +Leif > -----Original Message----- > From: Jayaprakash, N > Sent: Friday, October 20, 2023 7:04 AM > To: devel@edk2.groups.io > Cc: Jayaprakash, N ; Rebecca Cran > ; Kinney, Michael D ; > Tyler Erickson > Subject: [edk2-libc Patch 1/1] ek2-libc: Enhance StdLib for supporting > Aarch64 and ARM >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4570 >=20 > This commit is for processing the below PR on edk2-libc repo > https://github.com/tianocore/edk2-libc/pull/3 > These are the changes introduced to StdLib to build > an application for the UEFI shell. > Added format macros for int types to Aarch64, ARM, and Ia32. > Also modified the X64 macros so that everything would build > when they are used. > Added some macros that can be used for compatibility that define when > socklen_t has been defined. > Added getopt_long parser from OpenBSD to provide long and > short option parsing capability with getopt. >=20 > Cc: Rebecca Cran > Cc: Michael D Kinney > Cc: Jayaprakash N > Signed-off-by: Tyler Erickson > --- > StdLib/Include/Aarch64/machine/int_fmtio.h | 211 +++++++++ > StdLib/Include/Arm/machine/int_fmtio.h | 211 +++++++++ > StdLib/Include/Ia32/machine/int_fmtio.h | 212 +++++++++ > StdLib/Include/X64/machine/int_fmtio.h | 324 ++++++------- > StdLib/Include/getopt.h | 76 +++ > StdLib/Include/inttypes.h | 2 +- > StdLib/Include/sys/socket.h | 6 + > StdLib/Include/unistd.h | 7 +- > StdLib/LibC/LibC.inf | 1 + > StdLib/LibC/Uefi/Uefi.inf | 1 + > StdLib/LibC/Uefi/compat.c | 40 +- > StdLib/LibC/Uefi/getopt_long.c | 523 > +++++++++++++++++++++ > 12 files changed, 1406 insertions(+), 208 deletions(-) > create mode 100644 StdLib/Include/Aarch64/machine/int_fmtio.h > create mode 100644 StdLib/Include/Arm/machine/int_fmtio.h > create mode 100644 StdLib/Include/Ia32/machine/int_fmtio.h > create mode 100644 StdLib/Include/getopt.h > create mode 100644 StdLib/LibC/Uefi/getopt_long.c >=20 > diff --git a/StdLib/Include/Aarch64/machine/int_fmtio.h > b/StdLib/Include/Aarch64/machine/int_fmtio.h > new file mode 100644 > index 0000000..f091a7d > --- /dev/null > +++ b/StdLib/Include/Aarch64/machine/int_fmtio.h > @@ -0,0 +1,211 @@ > +/* $NetBSD: int_fmtio.h,v 1.10 2018/07/15 00:36:13 christos Exp $ > */ > + > +/*- > + * Copyright (c) 2001 The NetBSD Foundation, Inc. > + * All rights reserved. > + * > + * This code is derived from software contributed to The NetBSD > Foundation > + * by Klaus Klein. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above > copyright > + * notice, this list of conditions and the following disclaimer in > the > + * documentation and/or other materials provided with the > distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND > CONTRIBUTORS > + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT > NOT LIMITED > + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > PARTICULAR > + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR > CONTRIBUTORS > + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, > EXEMPLARY, OR > + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT > OF > + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR > BUSINESS > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, > WHETHER IN > + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR > OTHERWISE) > + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF > ADVISED OF THE > + * POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#ifndef _ARM_INT_FMTIO_H_ > +#define _ARM_INT_FMTIO_H_ > + > +/* > + * 7.8.1 Macros for format specifiers > + */ > + > +/* fprintf macros for signed integers */ > +#define PRId8 "d" /* int8_t */ > +#define PRId16 "d" /* int16_t */ > +#define PRId32 "d" /* int32_t */ > +#define PRId64 "lld" /* int64_t */ > +#define PRIdLEAST8 "d" /* int_least8_t */ > +#define PRIdLEAST16 "d" /* int_least16_t */ > +#define PRIdLEAST32 "d" /* int_least32_t */ > +#define PRIdLEAST64 "lld" /* int_least64_t */ > +#define PRIdFAST8 "d" /* int_fast8_t */ > +#define PRIdFAST16 "d" /* int_fast16_t */ > +#define PRIdFAST32 "d" /* int_fast32_t */ > +#define PRIdFAST64 "lld" /* int_fast64_t */ > +#define PRIdMAX "lld" /* intmax_t */ > +#define PRIdPTR "ld" /* intptr_t */ > + > +#define PRIi8 "i" /* int8_t */ > +#define PRIi16 "i" /* int16_t */ > +#define PRIi32 "i" /* int32_t */ > +#define PRIi64 "lli" /* int64_t */ > +#define PRIiLEAST8 "i" /* int_least8_t */ > +#define PRIiLEAST16 "i" /* int_least16_t */ > +#define PRIiLEAST32 "i" /* int_least32_t */ > +#define PRIiLEAST64 "lli" /* int_least64_t */ > +#define PRIiFAST8 "i" /* int_fast8_t */ > +#define PRIiFAST16 "i" /* int_fast16_t */ > +#define PRIiFAST32 "i" /* int_fast32_t */ > +#define PRIiFAST64 "lli" /* int_fast64_t */ > +#define PRIiMAX "lli" /* intmax_t */ > +#define PRIiPTR "li" /* intptr_t */ > + > +/* fprintf macros for unsigned integers */ > + > +#define PRIo8 "o" /* uint8_t */ > +#define PRIo16 "o" /* uint16_t */ > +#define PRIo32 "o" /* uint32_t */ > +#define PRIo64 "llo" /* uint64_t */ > +#define PRIoLEAST8 "o" /* uint_least8_t */ > +#define PRIoLEAST16 "o" /* uint_least16_t */ > +#define PRIoLEAST32 "o" /* uint_least32_t */ > +#define PRIoLEAST64 "llo" /* uint_least64_t */ > +#define PRIoFAST8 "o" /* uint_fast8_t */ > +#define PRIoFAST16 "o" /* uint_fast16_t */ > +#define PRIoFAST32 "o" /* uint_fast32_t */ > +#define PRIoFAST64 "llo" /* uint_fast64_t */ > +#define PRIoMAX "llo" /* uintmax_t */ > +#define PRIoPTR "lo" /* uintptr_t */ > + > +#define PRIu8 "u" /* uint8_t */ > +#define PRIu16 "u" /* uint16_t */ > +#define PRIu32 "u" /* uint32_t */ > +#define PRIu64 "llu" /* uint64_t */ > +#define PRIuLEAST8 "u" /* uint_least8_t */ > +#define PRIuLEAST16 "u" /* uint_least16_t */ > +#define PRIuLEAST32 "u" /* uint_least32_t */ > +#define PRIuLEAST64 "llu" /* uint_least64_t */ > +#define PRIuFAST8 "u" /* uint_fast8_t */ > +#define PRIuFAST16 "u" /* uint_fast16_t */ > +#define PRIuFAST32 "u" /* uint_fast32_t */ > +#define PRIuFAST64 "llu" /* uint_fast64_t */ > +#define PRIuMAX "llu" /* uintmax_t */ > +#define PRIuPTR "lu" /* uintptr_t */ > + > +#define PRIx8 "x" /* uint8_t */ > +#define PRIx16 "x" /* uint16_t */ > +#define PRIx32 "x" /* uint32_t */ > +#define PRIx64 "llx" /* uint64_t */ > +#define PRIxLEAST8 "x" /* uint_least8_t */ > +#define PRIxLEAST16 "x" /* uint_least16_t */ > +#define PRIxLEAST32 "x" /* uint_least32_t */ > +#define PRIxLEAST64 "llx" /* uint_least64_t */ > +#define PRIxFAST8 "x" /* uint_fast8_t */ > +#define PRIxFAST16 "x" /* uint_fast16_t */ > +#define PRIxFAST32 "x" /* uint_fast32_t */ > +#define PRIxFAST64 "llx" /* uint_fast64_t */ > +#define PRIxMAX "llx" /* uintmax_t */ > +#define PRIxPTR "lx" /* uintptr_t */ > + > +#define PRIX8 "X" /* uint8_t */ > +#define PRIX16 "X" /* uint16_t */ > +#define PRIX32 "X" /* uint32_t */ > +#define PRIX64 "llX" /* uint64_t */ > +#define PRIXLEAST8 "X" /* uint_least8_t */ > +#define PRIXLEAST16 "X" /* uint_least16_t */ > +#define PRIXLEAST32 "X" /* uint_least32_t */ > +#define PRIXLEAST64 "llX" /* uint_least64_t */ > +#define PRIXFAST8 "X" /* uint_fast8_t */ > +#define PRIXFAST16 "X" /* uint_fast16_t */ > +#define PRIXFAST32 "X" /* uint_fast32_t */ > +#define PRIXFAST64 "llX" /* uint_fast64_t */ > +#define PRIXMAX "llX" /* uintmax_t */ > +#define PRIXPTR "lX" /* uintptr_t */ > + > +/* fscanf macros for signed integers */ > + > +#define SCNd8 "hhd" /* int8_t */ > +#define SCNd16 "hd" /* int16_t */ > +#define SCNd32 "d" /* int32_t */ > +#define SCNd64 "lld" /* int64_t */ > +#define SCNdLEAST8 "hhd" /* int_least8_t */ > +#define SCNdLEAST16 "hd" /* int_least16_t */ > +#define SCNdLEAST32 "d" /* int_least32_t */ > +#define SCNdLEAST64 "lld" /* int_least64_t */ > +#define SCNdFAST8 "d" /* int_fast8_t */ > +#define SCNdFAST16 "d" /* int_fast16_t */ > +#define SCNdFAST32 "d" /* int_fast32_t */ > +#define SCNdFAST64 "lld" /* int_fast64_t */ > +#define SCNdMAX "lld" /* intmax_t */ > +#define SCNdPTR "ld" /* intptr_t */ > + > +#define SCNi8 "hhi" /* int8_t */ > +#define SCNi16 "hi" /* int16_t */ > +#define SCNi32 "i" /* int32_t */ > +#define SCNi64 "lli" /* int64_t */ > +#define SCNiLEAST8 "hhi" /* int_least8_t */ > +#define SCNiLEAST16 "hi" /* int_least16_t */ > +#define SCNiLEAST32 "i" /* int_least32_t */ > +#define SCNiLEAST64 "lli" /* int_least64_t */ > +#define SCNiFAST8 "i" /* int_fast8_t */ > +#define SCNiFAST16 "i" /* int_fast16_t */ > +#define SCNiFAST32 "i" /* int_fast32_t */ > +#define SCNiFAST64 "lli" /* int_fast64_t */ > +#define SCNiMAX "lli" /* intmax_t */ > +#define SCNiPTR "li" /* intptr_t */ > + > +/* fscanf macros for unsigned integers */ > + > +#define SCNo8 "hho" /* uint8_t */ > +#define SCNo16 "ho" /* uint16_t */ > +#define SCNo32 "o" /* uint32_t */ > +#define SCNo64 "llo" /* uint64_t */ > +#define SCNoLEAST8 "hho" /* uint_least8_t */ > +#define SCNoLEAST16 "ho" /* uint_least16_t */ > +#define SCNoLEAST32 "o" /* uint_least32_t */ > +#define SCNoLEAST64 "llo" /* uint_least64_t */ > +#define SCNoFAST8 "o" /* uint_fast8_t */ > +#define SCNoFAST16 "o" /* uint_fast16_t */ > +#define SCNoFAST32 "o" /* uint_fast32_t */ > +#define SCNoFAST64 "llo" /* uint_fast64_t */ > +#define SCNoMAX "llo" /* uintmax_t */ > +#define SCNoPTR "lo" /* uintptr_t */ > + > +#define SCNu8 "hhu" /* uint8_t */ > +#define SCNu16 "hu" /* uint16_t */ > +#define SCNu32 "u" /* uint32_t */ > +#define SCNu64 "llu" /* uint64_t */ > +#define SCNuLEAST8 "hhu" /* uint_least8_t */ > +#define SCNuLEAST16 "hu" /* uint_least16_t */ > +#define SCNuLEAST32 "u" /* uint_least32_t */ > +#define SCNuLEAST64 "llu" /* uint_least64_t */ > +#define SCNuFAST8 "u" /* uint_fast8_t */ > +#define SCNuFAST16 "u" /* uint_fast16_t */ > +#define SCNuFAST32 "u" /* uint_fast32_t */ > +#define SCNuFAST64 "llu" /* uint_fast64_t */ > +#define SCNuMAX "llu" /* uintmax_t */ > +#define SCNuPTR "lu" /* uintptr_t */ > + > +#define SCNx8 "hhx" /* uint8_t */ > +#define SCNx16 "hx" /* uint16_t */ > +#define SCNx32 "x" /* uint32_t */ > +#define SCNx64 "llx" /* uint64_t */ > +#define SCNxLEAST8 "hhx" /* uint_least8_t */ > +#define SCNxLEAST16 "hx" /* uint_least16_t */ > +#define SCNxLEAST32 "x" /* uint_least32_t */ > +#define SCNxLEAST64 "llx" /* uint_least64_t */ > +#define SCNxFAST8 "x" /* uint_fast8_t */ > +#define SCNxFAST16 "x" /* uint_fast16_t */ > +#define SCNxFAST32 "x" /* uint_fast32_t */ > +#define SCNxFAST64 "llx" /* uint_fast64_t */ > +#define SCNxMAX "llx" /* uintmax_t */ > +#define SCNxPTR "lx" /* uintptr_t */ > + > +#endif /* !_ARM_INT_FMTIO_H_ */ > diff --git a/StdLib/Include/Arm/machine/int_fmtio.h > b/StdLib/Include/Arm/machine/int_fmtio.h > new file mode 100644 > index 0000000..f091a7d > --- /dev/null > +++ b/StdLib/Include/Arm/machine/int_fmtio.h > @@ -0,0 +1,211 @@ > +/* $NetBSD: int_fmtio.h,v 1.10 2018/07/15 00:36:13 christos Exp $ > */ > + > +/*- > + * Copyright (c) 2001 The NetBSD Foundation, Inc. > + * All rights reserved. > + * > + * This code is derived from software contributed to The NetBSD > Foundation > + * by Klaus Klein. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above > copyright > + * notice, this list of conditions and the following disclaimer in > the > + * documentation and/or other materials provided with the > distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND > CONTRIBUTORS > + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT > NOT LIMITED > + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > PARTICULAR > + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR > CONTRIBUTORS > + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, > EXEMPLARY, OR > + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT > OF > + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR > BUSINESS > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, > WHETHER IN > + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR > OTHERWISE) > + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF > ADVISED OF THE > + * POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#ifndef _ARM_INT_FMTIO_H_ > +#define _ARM_INT_FMTIO_H_ > + > +/* > + * 7.8.1 Macros for format specifiers > + */ > + > +/* fprintf macros for signed integers */ > +#define PRId8 "d" /* int8_t */ > +#define PRId16 "d" /* int16_t */ > +#define PRId32 "d" /* int32_t */ > +#define PRId64 "lld" /* int64_t */ > +#define PRIdLEAST8 "d" /* int_least8_t */ > +#define PRIdLEAST16 "d" /* int_least16_t */ > +#define PRIdLEAST32 "d" /* int_least32_t */ > +#define PRIdLEAST64 "lld" /* int_least64_t */ > +#define PRIdFAST8 "d" /* int_fast8_t */ > +#define PRIdFAST16 "d" /* int_fast16_t */ > +#define PRIdFAST32 "d" /* int_fast32_t */ > +#define PRIdFAST64 "lld" /* int_fast64_t */ > +#define PRIdMAX "lld" /* intmax_t */ > +#define PRIdPTR "ld" /* intptr_t */ > + > +#define PRIi8 "i" /* int8_t */ > +#define PRIi16 "i" /* int16_t */ > +#define PRIi32 "i" /* int32_t */ > +#define PRIi64 "lli" /* int64_t */ > +#define PRIiLEAST8 "i" /* int_least8_t */ > +#define PRIiLEAST16 "i" /* int_least16_t */ > +#define PRIiLEAST32 "i" /* int_least32_t */ > +#define PRIiLEAST64 "lli" /* int_least64_t */ > +#define PRIiFAST8 "i" /* int_fast8_t */ > +#define PRIiFAST16 "i" /* int_fast16_t */ > +#define PRIiFAST32 "i" /* int_fast32_t */ > +#define PRIiFAST64 "lli" /* int_fast64_t */ > +#define PRIiMAX "lli" /* intmax_t */ > +#define PRIiPTR "li" /* intptr_t */ > + > +/* fprintf macros for unsigned integers */ > + > +#define PRIo8 "o" /* uint8_t */ > +#define PRIo16 "o" /* uint16_t */ > +#define PRIo32 "o" /* uint32_t */ > +#define PRIo64 "llo" /* uint64_t */ > +#define PRIoLEAST8 "o" /* uint_least8_t */ > +#define PRIoLEAST16 "o" /* uint_least16_t */ > +#define PRIoLEAST32 "o" /* uint_least32_t */ > +#define PRIoLEAST64 "llo" /* uint_least64_t */ > +#define PRIoFAST8 "o" /* uint_fast8_t */ > +#define PRIoFAST16 "o" /* uint_fast16_t */ > +#define PRIoFAST32 "o" /* uint_fast32_t */ > +#define PRIoFAST64 "llo" /* uint_fast64_t */ > +#define PRIoMAX "llo" /* uintmax_t */ > +#define PRIoPTR "lo" /* uintptr_t */ > + > +#define PRIu8 "u" /* uint8_t */ > +#define PRIu16 "u" /* uint16_t */ > +#define PRIu32 "u" /* uint32_t */ > +#define PRIu64 "llu" /* uint64_t */ > +#define PRIuLEAST8 "u" /* uint_least8_t */ > +#define PRIuLEAST16 "u" /* uint_least16_t */ > +#define PRIuLEAST32 "u" /* uint_least32_t */ > +#define PRIuLEAST64 "llu" /* uint_least64_t */ > +#define PRIuFAST8 "u" /* uint_fast8_t */ > +#define PRIuFAST16 "u" /* uint_fast16_t */ > +#define PRIuFAST32 "u" /* uint_fast32_t */ > +#define PRIuFAST64 "llu" /* uint_fast64_t */ > +#define PRIuMAX "llu" /* uintmax_t */ > +#define PRIuPTR "lu" /* uintptr_t */ > + > +#define PRIx8 "x" /* uint8_t */ > +#define PRIx16 "x" /* uint16_t */ > +#define PRIx32 "x" /* uint32_t */ > +#define PRIx64 "llx" /* uint64_t */ > +#define PRIxLEAST8 "x" /* uint_least8_t */ > +#define PRIxLEAST16 "x" /* uint_least16_t */ > +#define PRIxLEAST32 "x" /* uint_least32_t */ > +#define PRIxLEAST64 "llx" /* uint_least64_t */ > +#define PRIxFAST8 "x" /* uint_fast8_t */ > +#define PRIxFAST16 "x" /* uint_fast16_t */ > +#define PRIxFAST32 "x" /* uint_fast32_t */ > +#define PRIxFAST64 "llx" /* uint_fast64_t */ > +#define PRIxMAX "llx" /* uintmax_t */ > +#define PRIxPTR "lx" /* uintptr_t */ > + > +#define PRIX8 "X" /* uint8_t */ > +#define PRIX16 "X" /* uint16_t */ > +#define PRIX32 "X" /* uint32_t */ > +#define PRIX64 "llX" /* uint64_t */ > +#define PRIXLEAST8 "X" /* uint_least8_t */ > +#define PRIXLEAST16 "X" /* uint_least16_t */ > +#define PRIXLEAST32 "X" /* uint_least32_t */ > +#define PRIXLEAST64 "llX" /* uint_least64_t */ > +#define PRIXFAST8 "X" /* uint_fast8_t */ > +#define PRIXFAST16 "X" /* uint_fast16_t */ > +#define PRIXFAST32 "X" /* uint_fast32_t */ > +#define PRIXFAST64 "llX" /* uint_fast64_t */ > +#define PRIXMAX "llX" /* uintmax_t */ > +#define PRIXPTR "lX" /* uintptr_t */ > + > +/* fscanf macros for signed integers */ > + > +#define SCNd8 "hhd" /* int8_t */ > +#define SCNd16 "hd" /* int16_t */ > +#define SCNd32 "d" /* int32_t */ > +#define SCNd64 "lld" /* int64_t */ > +#define SCNdLEAST8 "hhd" /* int_least8_t */ > +#define SCNdLEAST16 "hd" /* int_least16_t */ > +#define SCNdLEAST32 "d" /* int_least32_t */ > +#define SCNdLEAST64 "lld" /* int_least64_t */ > +#define SCNdFAST8 "d" /* int_fast8_t */ > +#define SCNdFAST16 "d" /* int_fast16_t */ > +#define SCNdFAST32 "d" /* int_fast32_t */ > +#define SCNdFAST64 "lld" /* int_fast64_t */ > +#define SCNdMAX "lld" /* intmax_t */ > +#define SCNdPTR "ld" /* intptr_t */ > + > +#define SCNi8 "hhi" /* int8_t */ > +#define SCNi16 "hi" /* int16_t */ > +#define SCNi32 "i" /* int32_t */ > +#define SCNi64 "lli" /* int64_t */ > +#define SCNiLEAST8 "hhi" /* int_least8_t */ > +#define SCNiLEAST16 "hi" /* int_least16_t */ > +#define SCNiLEAST32 "i" /* int_least32_t */ > +#define SCNiLEAST64 "lli" /* int_least64_t */ > +#define SCNiFAST8 "i" /* int_fast8_t */ > +#define SCNiFAST16 "i" /* int_fast16_t */ > +#define SCNiFAST32 "i" /* int_fast32_t */ > +#define SCNiFAST64 "lli" /* int_fast64_t */ > +#define SCNiMAX "lli" /* intmax_t */ > +#define SCNiPTR "li" /* intptr_t */ > + > +/* fscanf macros for unsigned integers */ > + > +#define SCNo8 "hho" /* uint8_t */ > +#define SCNo16 "ho" /* uint16_t */ > +#define SCNo32 "o" /* uint32_t */ > +#define SCNo64 "llo" /* uint64_t */ > +#define SCNoLEAST8 "hho" /* uint_least8_t */ > +#define SCNoLEAST16 "ho" /* uint_least16_t */ > +#define SCNoLEAST32 "o" /* uint_least32_t */ > +#define SCNoLEAST64 "llo" /* uint_least64_t */ > +#define SCNoFAST8 "o" /* uint_fast8_t */ > +#define SCNoFAST16 "o" /* uint_fast16_t */ > +#define SCNoFAST32 "o" /* uint_fast32_t */ > +#define SCNoFAST64 "llo" /* uint_fast64_t */ > +#define SCNoMAX "llo" /* uintmax_t */ > +#define SCNoPTR "lo" /* uintptr_t */ > + > +#define SCNu8 "hhu" /* uint8_t */ > +#define SCNu16 "hu" /* uint16_t */ > +#define SCNu32 "u" /* uint32_t */ > +#define SCNu64 "llu" /* uint64_t */ > +#define SCNuLEAST8 "hhu" /* uint_least8_t */ > +#define SCNuLEAST16 "hu" /* uint_least16_t */ > +#define SCNuLEAST32 "u" /* uint_least32_t */ > +#define SCNuLEAST64 "llu" /* uint_least64_t */ > +#define SCNuFAST8 "u" /* uint_fast8_t */ > +#define SCNuFAST16 "u" /* uint_fast16_t */ > +#define SCNuFAST32 "u" /* uint_fast32_t */ > +#define SCNuFAST64 "llu" /* uint_fast64_t */ > +#define SCNuMAX "llu" /* uintmax_t */ > +#define SCNuPTR "lu" /* uintptr_t */ > + > +#define SCNx8 "hhx" /* uint8_t */ > +#define SCNx16 "hx" /* uint16_t */ > +#define SCNx32 "x" /* uint32_t */ > +#define SCNx64 "llx" /* uint64_t */ > +#define SCNxLEAST8 "hhx" /* uint_least8_t */ > +#define SCNxLEAST16 "hx" /* uint_least16_t */ > +#define SCNxLEAST32 "x" /* uint_least32_t */ > +#define SCNxLEAST64 "llx" /* uint_least64_t */ > +#define SCNxFAST8 "x" /* uint_fast8_t */ > +#define SCNxFAST16 "x" /* uint_fast16_t */ > +#define SCNxFAST32 "x" /* uint_fast32_t */ > +#define SCNxFAST64 "llx" /* uint_fast64_t */ > +#define SCNxMAX "llx" /* uintmax_t */ > +#define SCNxPTR "lx" /* uintptr_t */ > + > +#endif /* !_ARM_INT_FMTIO_H_ */ > diff --git a/StdLib/Include/Ia32/machine/int_fmtio.h > b/StdLib/Include/Ia32/machine/int_fmtio.h > new file mode 100644 > index 0000000..061d594 > --- /dev/null > +++ b/StdLib/Include/Ia32/machine/int_fmtio.h > @@ -0,0 +1,212 @@ > +/* $NetBSD: int_fmtio.h,v 1.9 2014/07/28 11:22:46 joerg Exp $ */ > + > +/*- > + * Copyright (c) 2001 The NetBSD Foundation, Inc. > + * All rights reserved. > + * > + * This code is derived from software contributed to The NetBSD > Foundation > + * by Klaus Klein. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above > copyright > + * notice, this list of conditions and the following disclaimer in > the > + * documentation and/or other materials provided with the > distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND > CONTRIBUTORS > + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT > NOT LIMITED > + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > PARTICULAR > + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR > CONTRIBUTORS > + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, > EXEMPLARY, OR > + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT > OF > + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR > BUSINESS > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, > WHETHER IN > + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR > OTHERWISE) > + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF > ADVISED OF THE > + * POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#ifndef _I386_INT_FMTIO_H_ > +#define _I386_INT_FMTIO_H_ > + > +/* > + * 7.8.1 Macros for format specifiers > + */ > + > +/* fprintf macros for signed integers */ > + > +#define PRId8 "d" /* int8_t */ > +#define PRId16 "d" /* int16_t */ > +#define PRId32 "d" /* int32_t */ > +#define PRId64 "lld" /* int64_t */ > +#define PRIdLEAST8 "d" /* int_least8_t */ > +#define PRIdLEAST16 "d" /* int_least16_t */ > +#define PRIdLEAST32 "d" /* int_least32_t */ > +#define PRIdLEAST64 "lld" /* int_least64_t */ > +#define PRIdFAST8 "d" /* int_fast8_t */ > +#define PRIdFAST16 "d" /* int_fast16_t */ > +#define PRIdFAST32 "d" /* int_fast32_t */ > +#define PRIdFAST64 "lld" /* int_fast64_t */ > +#define PRIdMAX "lld" /* intmax_t */ > +#define PRIdPTR "d" /* intptr_t */ > + > +#define PRIi8 "i" /* int8_t */ > +#define PRIi16 "i" /* int16_t */ > +#define PRIi32 "i" /* int32_t */ > +#define PRIi64 "lli" /* int64_t */ > +#define PRIiLEAST8 "i" /* int_least8_t */ > +#define PRIiLEAST16 "i" /* int_least16_t */ > +#define PRIiLEAST32 "i" /* int_least32_t */ > +#define PRIiLEAST64 "lli" /* int_least64_t */ > +#define PRIiFAST8 "i" /* int_fast8_t */ > +#define PRIiFAST16 "i" /* int_fast16_t */ > +#define PRIiFAST32 "i" /* int_fast32_t */ > +#define PRIiFAST64 "lli" /* int_fast64_t */ > +#define PRIiMAX "lli" /* intmax_t */ > +#define PRIiPTR "i" /* intptr_t */ > + > +/* fprintf macros for unsigned integers */ > + > +#define PRIo8 "o" /* uint8_t */ > +#define PRIo16 "o" /* uint16_t */ > +#define PRIo32 "o" /* uint32_t */ > +#define PRIo64 "llo" /* uint64_t */ > +#define PRIoLEAST8 "o" /* uint_least8_t */ > +#define PRIoLEAST16 "o" /* uint_least16_t */ > +#define PRIoLEAST32 "o" /* uint_least32_t */ > +#define PRIoLEAST64 "llo" /* uint_least64_t */ > +#define PRIoFAST8 "o" /* uint_fast8_t */ > +#define PRIoFAST16 "o" /* uint_fast16_t */ > +#define PRIoFAST32 "o" /* uint_fast32_t */ > +#define PRIoFAST64 "llo" /* uint_fast64_t */ > +#define PRIoMAX "llo" /* uintmax_t */ > +#define PRIoPTR "o" /* uintptr_t */ > + > +#define PRIu8 "u" /* uint8_t */ > +#define PRIu16 "u" /* uint16_t */ > +#define PRIu32 "u" /* uint32_t */ > +#define PRIu64 "llu" /* uint64_t */ > +#define PRIuLEAST8 "u" /* uint_least8_t */ > +#define PRIuLEAST16 "u" /* uint_least16_t */ > +#define PRIuLEAST32 "u" /* uint_least32_t */ > +#define PRIuLEAST64 "llu" /* uint_least64_t */ > +#define PRIuFAST8 "u" /* uint_fast8_t */ > +#define PRIuFAST16 "u" /* uint_fast16_t */ > +#define PRIuFAST32 "u" /* uint_fast32_t */ > +#define PRIuFAST64 "llu" /* uint_fast64_t */ > +#define PRIuMAX "llu" /* uintmax_t */ > +#define PRIuPTR "u" /* uintptr_t */ > + > +#define PRIx8 "x" /* uint8_t */ > +#define PRIx16 "x" /* uint16_t */ > +#define PRIx32 "x" /* uint32_t */ > +#define PRIx64 "llx" /* uint64_t */ > +#define PRIxLEAST8 "x" /* uint_least8_t */ > +#define PRIxLEAST16 "x" /* uint_least16_t */ > +#define PRIxLEAST32 "x" /* uint_least32_t */ > +#define PRIxLEAST64 "llx" /* uint_least64_t */ > +#define PRIxFAST8 "x" /* uint_fast8_t */ > +#define PRIxFAST16 "x" /* uint_fast16_t */ > +#define PRIxFAST32 "x" /* uint_fast32_t */ > +#define PRIxFAST64 "llx" /* uint_fast64_t */ > +#define PRIxMAX "llx" /* uintmax_t */ > +#define PRIxPTR "x" /* uintptr_t */ > + > +#define PRIX8 "X" /* uint8_t */ > +#define PRIX16 "X" /* uint16_t */ > +#define PRIX32 "X" /* uint32_t */ > +#define PRIX64 "llX" /* uint64_t */ > +#define PRIXLEAST8 "X" /* uint_least8_t */ > +#define PRIXLEAST16 "X" /* uint_least16_t */ > +#define PRIXLEAST32 "X" /* uint_least32_t */ > +#define PRIXLEAST64 "llX" /* uint_least64_t */ > +#define PRIXFAST8 "X" /* uint_fast8_t */ > +#define PRIXFAST16 "X" /* uint_fast16_t */ > +#define PRIXFAST32 "X" /* uint_fast32_t */ > +#define PRIXFAST64 "llX" /* uint_fast64_t */ > +#define PRIXMAX "llX" /* uintmax_t */ > +#define PRIXPTR "X" /* uintptr_t */ > + > +/* fscanf macros for signed integers */ > + > +#define SCNd8 "hhd" /* int8_t */ > +#define SCNd16 "hd" /* int16_t */ > +#define SCNd32 "d" /* int32_t */ > +#define SCNd64 "lld" /* int64_t */ > +#define SCNdLEAST8 "hhd" /* int_least8_t */ > +#define SCNdLEAST16 "hd" /* int_least16_t */ > +#define SCNdLEAST32 "d" /* int_least32_t */ > +#define SCNdLEAST64 "lld" /* int_least64_t */ > +#define SCNdFAST8 "d" /* int_fast8_t */ > +#define SCNdFAST16 "d" /* int_fast16_t */ > +#define SCNdFAST32 "d" /* int_fast32_t */ > +#define SCNdFAST64 "lld" /* int_fast64_t */ > +#define SCNdMAX "lld" /* intmax_t */ > +#define SCNdPTR "d" /* intptr_t */ > + > +#define SCNi8 "hhi" /* int8_t */ > +#define SCNi16 "hi" /* int16_t */ > +#define SCNi32 "i" /* int32_t */ > +#define SCNi64 "lli" /* int64_t */ > +#define SCNiLEAST8 "hhi" /* int_least8_t */ > +#define SCNiLEAST16 "hi" /* int_least16_t */ > +#define SCNiLEAST32 "i" /* int_least32_t */ > +#define SCNiLEAST64 "lli" /* int_least64_t */ > +#define SCNiFAST8 "i" /* int_fast8_t */ > +#define SCNiFAST16 "i" /* int_fast16_t */ > +#define SCNiFAST32 "i" /* int_fast32_t */ > +#define SCNiFAST64 "lli" /* int_fast64_t */ > +#define SCNiMAX "lli" /* intmax_t */ > +#define SCNiPTR "i" /* intptr_t */ > + > +/* fscanf macros for unsigned integers */ > + > +#define SCNo8 "hho" /* uint8_t */ > +#define SCNo16 "ho" /* uint16_t */ > +#define SCNo32 "o" /* uint32_t */ > +#define SCNo64 "llo" /* uint64_t */ > +#define SCNoLEAST8 "hho" /* uint_least8_t */ > +#define SCNoLEAST16 "ho" /* uint_least16_t */ > +#define SCNoLEAST32 "o" /* uint_least32_t */ > +#define SCNoLEAST64 "llo" /* uint_least64_t */ > +#define SCNoFAST8 "o" /* uint_fast8_t */ > +#define SCNoFAST16 "o" /* uint_fast16_t */ > +#define SCNoFAST32 "o" /* uint_fast32_t */ > +#define SCNoFAST64 "llo" /* uint_fast64_t */ > +#define SCNoMAX "llo" /* uintmax_t */ > +#define SCNoPTR "o" /* uintptr_t */ > + > +#define SCNu8 "hhu" /* uint8_t */ > +#define SCNu16 "hu" /* uint16_t */ > +#define SCNu32 "u" /* uint32_t */ > +#define SCNu64 "llu" /* uint64_t */ > +#define SCNuLEAST8 "hhu" /* uint_least8_t */ > +#define SCNuLEAST16 "hu" /* uint_least16_t */ > +#define SCNuLEAST32 "u" /* uint_least32_t */ > +#define SCNuLEAST64 "llu" /* uint_least64_t */ > +#define SCNuFAST8 "u" /* uint_fast8_t */ > +#define SCNuFAST16 "u" /* uint_fast16_t */ > +#define SCNuFAST32 "u" /* uint_fast32_t */ > +#define SCNuFAST64 "llu" /* uint_fast64_t */ > +#define SCNuMAX "llu" /* uintmax_t */ > +#define SCNuPTR "u" /* uintptr_t */ > + > +#define SCNx8 "hhx" /* uint8_t */ > +#define SCNx16 "hx" /* uint16_t */ > +#define SCNx32 "x" /* uint32_t */ > +#define SCNx64 "llx" /* uint64_t */ > +#define SCNxLEAST8 "hhx" /* uint_least8_t */ > +#define SCNxLEAST16 "hx" /* uint_least16_t */ > +#define SCNxLEAST32 "x" /* uint_least32_t */ > +#define SCNxLEAST64 "llx" /* uint_least64_t */ > +#define SCNxFAST8 "x" /* uint_fast8_t */ > +#define SCNxFAST16 "x" /* uint_fast16_t */ > +#define SCNxFAST32 "x" /* uint_fast32_t */ > +#define SCNxFAST64 "llx" /* uint_fast64_t */ > +#define SCNxMAX "llx" /* uintmax_t */ > +#define SCNxPTR "x" /* uintptr_t */ > + > +#endif /* !_I386_INT_FMTIO_H_ */ > diff --git a/StdLib/Include/X64/machine/int_fmtio.h > b/StdLib/Include/X64/machine/int_fmtio.h > index 181cc26..c2ebb30 100644 > --- a/StdLib/Include/X64/machine/int_fmtio.h > +++ b/StdLib/Include/X64/machine/int_fmtio.h > @@ -1,4 +1,4 @@ > -/* $NetBSD: int_fmtio.h,v 1.4 2005/12/11 12:16:25 christos Exp $ */ > +/* $NetBSD: int_fmtio.h,v 1.4 2005/12/11 12:16:25 christos Exp $ > */ >=20 > /*- > * Copyright (c) 2001 The NetBSD Foundation, Inc. > @@ -45,175 +45,175 @@ >=20 > /* fprintf macros for signed integers */ >=20 > -#define PRId8 "d" /* int8_t */ > -#define PRId16 "d" /* int16_t */ > -#define PRId32 "d" /* int32_t */ > -#define PRId64 "ld" /* int64_t */ > -#define PRIdLEAST8 "d" /* int_least8_t */ > -#define PRIdLEAST16 "d" /* int_least16_t */ > -#define PRIdLEAST32 "d" /* int_least32_t */ > -#define PRIdLEAST64 "ld" /* int_least64_t */ > -#define PRIdFAST8 "d" /* int_fast8_t */ > -#define PRIdFAST16 "d" /* int_fast16_t */ > -#define PRIdFAST32 "d" /* int_fast32_t */ > -#define PRIdFAST64 "ld" /* int_fast64_t */ > -#define PRIdMAX "ld" /* intmax_t */ > -#define PRIdPTR "ld" /* intptr_t */ > - > -#define PRIi8 "i" /* int8_t */ > -#define PRIi16 "i" /* int16_t */ > -#define PRIi32 "i" /* int32_t */ > -#define PRIi64 "li" /* int64_t */ > -#define PRIiLEAST8 "i" /* int_least8_t */ > -#define PRIiLEAST16 "i" /* int_least16_t */ > -#define PRIiLEAST32 "i" /* int_least32_t */ > -#define PRIiLEAST64 "li" /* int_least64_t */ > -#define PRIiFAST8 "i" /* int_fast8_t */ > -#define PRIiFAST16 "i" /* int_fast16_t */ > -#define PRIiFAST32 "i" /* int_fast32_t */ > -#define PRIiFAST64 "li" /* int_fast64_t */ > -#define PRIiMAX "li" /* intmax_t */ > -#define PRIiPTR "li" /* intptr_t */ > +#define PRId8 "d" /* int8_t */ > +#define PRId16 "d" /* int16_t */ > +#define PRId32 "d" /* int32_t */ > +#define PRId64 "lld" /* int64_t */ /*ll* for GCC build > with EDK2 */ > +#define PRIdLEAST8 "d" /* int_least8_t */ > +#define PRIdLEAST16 "d" /* int_least16_t */ > +#define PRIdLEAST32 "d" /* int_least32_t */ > +#define PRIdLEAST64 "ld" /* int_least64_t */ > +#define PRIdFAST8 "d" /* int_fast8_t */ > +#define PRIdFAST16 "d" /* int_fast16_t */ > +#define PRIdFAST32 "d" /* int_fast32_t */ > +#define PRIdFAST64 "lld" /* int_fast64_t */ > +#define PRIdMAX "lld" /* intmax_t */ > +#define PRIdPTR "ld" /* intptr_t */ > + > +#define PRIi8 "i" /* int8_t */ > +#define PRIi16 "i" /* int16_t */ > +#define PRIi32 "i" /* int32_t */ > +#define PRIi64 "lli" /* int64_t */ /*ll* for GCC build > with EDK2 */ > +#define PRIiLEAST8 "i" /* int_least8_t */ > +#define PRIiLEAST16 "i" /* int_least16_t */ > +#define PRIiLEAST32 "i" /* int_least32_t */ > +#define PRIiLEAST64 "lli" /* int_least64_t */ > +#define PRIiFAST8 "i" /* int_fast8_t */ > +#define PRIiFAST16 "i" /* int_fast16_t */ > +#define PRIiFAST32 "i" /* int_fast32_t */ > +#define PRIiFAST64 "lli" /* int_fast64_t */ > +#define PRIiMAX "lli" /* intmax_t */ > +#define PRIiPTR "li" /* intptr_t */ >=20 > /* fprintf macros for unsigned integers */ >=20 > -#define PRIo8 "o" /* uint8_t */ > -#define PRIo16 "o" /* uint16_t */ > -#define PRIo32 "o" /* uint32_t */ > -#define PRIo64 "lo" /* uint64_t */ > -#define PRIoLEAST8 "o" /* uint_least8_t */ > -#define PRIoLEAST16 "o" /* uint_least16_t */ > -#define PRIoLEAST32 "o" /* uint_least32_t */ > -#define PRIoLEAST64 "lo" /* uint_least64_t */ > -#define PRIoFAST8 "o" /* uint_fast8_t */ > -#define PRIoFAST16 "o" /* uint_fast16_t */ > -#define PRIoFAST32 "o" /* uint_fast32_t */ > -#define PRIoFAST64 "lo" /* uint_fast64_t */ > -#define PRIoMAX "lo" /* uintmax_t */ > -#define PRIoPTR "lo" /* uintptr_t */ > - > -#define PRIu8 "u" /* uint8_t */ > -#define PRIu16 "u" /* uint16_t */ > -#define PRIu32 "u" /* uint32_t */ > -#define PRIu64 "lu" /* uint64_t */ > -#define PRIuLEAST8 "u" /* uint_least8_t */ > -#define PRIuLEAST16 "u" /* uint_least16_t */ > -#define PRIuLEAST32 "u" /* uint_least32_t */ > -#define PRIuLEAST64 "lu" /* uint_least64_t */ > -#define PRIuFAST8 "u" /* uint_fast8_t */ > -#define PRIuFAST16 "u" /* uint_fast16_t */ > -#define PRIuFAST32 "u" /* uint_fast32_t */ > -#define PRIuFAST64 "lu" /* uint_fast64_t */ > -#define PRIuMAX "lu" /* uintmax_t */ > -#define PRIuPTR "lu" /* uintptr_t */ > - > -#define PRIx8 "x" /* uint8_t */ > -#define PRIx16 "x" /* uint16_t */ > -#define PRIx32 "x" /* uint32_t */ > -#define PRIx64 "lx" /* uint64_t */ > -#define PRIxLEAST8 "x" /* uint_least8_t */ > -#define PRIxLEAST16 "x" /* uint_least16_t */ > -#define PRIxLEAST32 "x" /* uint_least32_t */ > -#define PRIxLEAST64 "lx" /* uint_least64_t */ > -#define PRIxFAST8 "x" /* uint_fast8_t */ > -#define PRIxFAST16 "x" /* uint_fast16_t */ > -#define PRIxFAST32 "x" /* uint_fast32_t */ > -#define PRIxFAST64 "lx" /* uint_fast64_t */ > -#define PRIxMAX "lx" /* uintmax_t */ > -#define PRIxPTR "lx" /* uintptr_t */ > - > -#define PRIX8 "X" /* uint8_t */ > -#define PRIX16 "X" /* uint16_t */ > -#define PRIX32 "X" /* uint32_t */ > -#define PRIX64 "lX" /* uint64_t */ > -#define PRIXLEAST8 "X" /* uint_least8_t */ > -#define PRIXLEAST16 "X" /* uint_least16_t */ > -#define PRIXLEAST32 "X" /* uint_least32_t */ > -#define PRIXLEAST64 "lX" /* uint_least64_t */ > -#define PRIXFAST8 "X" /* uint_fast8_t */ > -#define PRIXFAST16 "X" /* uint_fast16_t */ > -#define PRIXFAST32 "X" /* uint_fast32_t */ > -#define PRIXFAST64 "lX" /* uint_fast64_t */ > -#define PRIXMAX "lX" /* uintmax_t */ > -#define PRIXPTR "lX" /* uintptr_t */ > +#define PRIo8 "o" /* uint8_t */ > +#define PRIo16 "o" /* uint16_t */ > +#define PRIo32 "o" /* uint32_t */ > +#define PRIo64 "llo" /* uint64_t */ /*ll* for GCC build > with EDK2 */ > +#define PRIoLEAST8 "o" /* uint_least8_t */ > +#define PRIoLEAST16 "o" /* uint_least16_t */ > +#define PRIoLEAST32 "o" /* uint_least32_t */ > +#define PRIoLEAST64 "llo" /* uint_least64_t */ > +#define PRIoFAST8 "o" /* uint_fast8_t */ > +#define PRIoFAST16 "o" /* uint_fast16_t */ > +#define PRIoFAST32 "o" /* uint_fast32_t */ > +#define PRIoFAST64 "llo" /* uint_fast64_t */ > +#define PRIoMAX "llo" /* uintmax_t */ > +#define PRIoPTR "lo" /* uintptr_t */ > + > +#define PRIu8 "u" /* uint8_t */ > +#define PRIu16 "u" /* uint16_t */ > +#define PRIu32 "u" /* uint32_t */ > +#define PRIu64 "llu" /* uint64_t */ /*ll* for GCC build > with EDK2 */ > +#define PRIuLEAST8 "u" /* uint_least8_t */ > +#define PRIuLEAST16 "u" /* uint_least16_t */ > +#define PRIuLEAST32 "u" /* uint_least32_t */ > +#define PRIuLEAST64 "llu" /* uint_least64_t */ > +#define PRIuFAST8 "u" /* uint_fast8_t */ > +#define PRIuFAST16 "u" /* uint_fast16_t */ > +#define PRIuFAST32 "u" /* uint_fast32_t */ > +#define PRIuFAST64 "llu" /* uint_fast64_t */ > +#define PRIuMAX "llu" /* uintmax_t */ > +#define PRIuPTR "lu" /* uintptr_t */ > + > +#define PRIx8 "x" /* uint8_t */ > +#define PRIx16 "x" /* uint16_t */ > +#define PRIx32 "x" /* uint32_t */ > +#define PRIx64 "llx" /* uint64_t */ /*ll* for GCC build > with EDK2 */ > +#define PRIxLEAST8 "x" /* uint_least8_t */ > +#define PRIxLEAST16 "x" /* uint_least16_t */ > +#define PRIxLEAST32 "x" /* uint_least32_t */ > +#define PRIxLEAST64 "llx" /* uint_least64_t */ > +#define PRIxFAST8 "x" /* uint_fast8_t */ > +#define PRIxFAST16 "x" /* uint_fast16_t */ > +#define PRIxFAST32 "x" /* uint_fast32_t */ > +#define PRIxFAST64 "llx" /* uint_fast64_t */ > +#define PRIxMAX "llx" /* uintmax_t */ > +#define PRIxPTR "lx" /* uintptr_t */ > + > +#define PRIX8 "X" /* uint8_t */ > +#define PRIX16 "X" /* uint16_t */ > +#define PRIX32 "X" /* uint32_t */ > +#define PRIX64 "llX" /* uint64_t */ /*ll* for GCC build > with EDK2 */ > +#define PRIXLEAST8 "X" /* uint_least8_t */ > +#define PRIXLEAST16 "X" /* uint_least16_t */ > +#define PRIXLEAST32 "X" /* uint_least32_t */ > +#define PRIXLEAST64 "llX" /* uint_least64_t */ > +#define PRIXFAST8 "X" /* uint_fast8_t */ > +#define PRIXFAST16 "X" /* uint_fast16_t */ > +#define PRIXFAST32 "X" /* uint_fast32_t */ > +#define PRIXFAST64 "llX" /* uint_fast64_t */ > +#define PRIXMAX "llX" /* uintmax_t */ > +#define PRIXPTR "lX" /* uintptr_t */ >=20 > /* fscanf macros for signed integers */ >=20 > -#define SCNd8 "hhd" /* int8_t */ > -#define SCNd16 "hd" /* int16_t */ > -#define SCNd32 "d" /* int32_t */ > -#define SCNd64 "ld" /* int64_t */ > -#define SCNdLEAST8 "hhd" /* int_least8_t */ > -#define SCNdLEAST16 "hd" /* int_least16_t */ > -#define SCNdLEAST32 "d" /* int_least32_t */ > -#define SCNdLEAST64 "ld" /* int_least64_t */ > -#define SCNdFAST8 "d" /* int_fast8_t */ > -#define SCNdFAST16 "d" /* int_fast16_t */ > -#define SCNdFAST32 "d" /* int_fast32_t */ > -#define SCNdFAST64 "ld" /* int_fast64_t */ > -#define SCNdMAX "ld" /* intmax_t */ > -#define SCNdPTR "ld" /* intptr_t */ > - > -#define SCNi8 "hhi" /* int8_t */ > -#define SCNi16 "hi" /* int16_t */ > -#define SCNi32 "i" /* int32_t */ > -#define SCNi64 "li" /* int64_t */ > -#define SCNiLEAST8 "hhi" /* int_least8_t */ > -#define SCNiLEAST16 "hi" /* int_least16_t */ > -#define SCNiLEAST32 "i" /* int_least32_t */ > -#define SCNiLEAST64 "li" /* int_least64_t */ > -#define SCNiFAST8 "i" /* int_fast8_t */ > -#define SCNiFAST16 "i" /* int_fast16_t */ > -#define SCNiFAST32 "i" /* int_fast32_t */ > -#define SCNiFAST64 "li" /* int_fast64_t */ > -#define SCNiMAX "li" /* intmax_t */ > -#define SCNiPTR "li" /* intptr_t */ > +#define SCNd8 "hhd" /* int8_t */ > +#define SCNd16 "hd" /* int16_t */ > +#define SCNd32 "d" /* int32_t */ > +#define SCNd64 "lld" /* int64_t */ /*ll* for GCC build > with EDK2 */ > +#define SCNdLEAST8 "hhd" /* int_least8_t */ > +#define SCNdLEAST16 "hd" /* int_least16_t */ > +#define SCNdLEAST32 "d" /* int_least32_t */ > +#define SCNdLEAST64 "lld" /* int_least64_t */ > +#define SCNdFAST8 "d" /* int_fast8_t */ > +#define SCNdFAST16 "d" /* int_fast16_t */ > +#define SCNdFAST32 "d" /* int_fast32_t */ > +#define SCNdFAST64 "lld" /* int_fast64_t */ > +#define SCNdMAX "lld" /* intmax_t */ > +#define SCNdPTR "ld" /* intptr_t */ > + > +#define SCNi8 "hhi" /* int8_t */ > +#define SCNi16 "hi" /* int16_t */ > +#define SCNi32 "i" /* int32_t */ > +#define SCNi64 "lli" /* int64_t */ /*ll* for GCC build > with EDK2 */ > +#define SCNiLEAST8 "hhi" /* int_least8_t */ > +#define SCNiLEAST16 "hi" /* int_least16_t */ > +#define SCNiLEAST32 "i" /* int_least32_t */ > +#define SCNiLEAST64 "lli" /* int_least64_t */ > +#define SCNiFAST8 "i" /* int_fast8_t */ > +#define SCNiFAST16 "i" /* int_fast16_t */ > +#define SCNiFAST32 "i" /* int_fast32_t */ > +#define SCNiFAST64 "lli" /* int_fast64_t */ > +#define SCNiMAX "lli" /* intmax_t */ > +#define SCNiPTR "li" /* intptr_t */ >=20 > /* fscanf macros for unsigned integers */ >=20 > -#define SCNo8 "hho" /* uint8_t */ > -#define SCNo16 "ho" /* uint16_t */ > -#define SCNo32 "o" /* uint32_t */ > -#define SCNo64 "lo" /* uint64_t */ > -#define SCNoLEAST8 "hho" /* uint_least8_t */ > -#define SCNoLEAST16 "ho" /* uint_least16_t */ > -#define SCNoLEAST32 "o" /* uint_least32_t */ > -#define SCNoLEAST64 "lo" /* uint_least64_t */ > -#define SCNoFAST8 "o" /* uint_fast8_t */ > -#define SCNoFAST16 "o" /* uint_fast16_t */ > -#define SCNoFAST32 "o" /* uint_fast32_t */ > -#define SCNoFAST64 "lo" /* uint_fast64_t */ > -#define SCNoMAX "lo" /* uintmax_t */ > -#define SCNoPTR "lo" /* uintptr_t */ > - > -#define SCNu8 "hhu" /* uint8_t */ > -#define SCNu16 "hu" /* uint16_t */ > -#define SCNu32 "u" /* uint32_t */ > -#define SCNu64 "lu" /* uint64_t */ > -#define SCNuLEAST8 "hhu" /* uint_least8_t */ > -#define SCNuLEAST16 "hu" /* uint_least16_t */ > -#define SCNuLEAST32 "u" /* uint_least32_t */ > -#define SCNuLEAST64 "lu" /* uint_least64_t */ > -#define SCNuFAST8 "u" /* uint_fast8_t */ > -#define SCNuFAST16 "u" /* uint_fast16_t */ > -#define SCNuFAST32 "u" /* uint_fast32_t */ > -#define SCNuFAST64 "lu" /* uint_fast64_t */ > -#define SCNuMAX "lu" /* uintmax_t */ > -#define SCNuPTR "lu" /* uintptr_t */ > - > -#define SCNx8 "hhx" /* uint8_t */ > -#define SCNx16 "hx" /* uint16_t */ > -#define SCNx32 "x" /* uint32_t */ > -#define SCNx64 "lx" /* uint64_t */ > -#define SCNxLEAST8 "hhx" /* uint_least8_t */ > -#define SCNxLEAST16 "hx" /* uint_least16_t */ > -#define SCNxLEAST32 "x" /* uint_least32_t */ > -#define SCNxLEAST64 "lx" /* uint_least64_t */ > -#define SCNxFAST8 "x" /* uint_fast8_t */ > -#define SCNxFAST16 "x" /* uint_fast16_t */ > -#define SCNxFAST32 "x" /* uint_fast32_t */ > -#define SCNxFAST64 "lx" /* uint_fast64_t */ > -#define SCNxMAX "lx" /* uintmax_t */ > -#define SCNxPTR "lx" /* uintptr_t */ > +#define SCNo8 "hho" /* uint8_t */ > +#define SCNo16 "ho" /* uint16_t */ > +#define SCNo32 "o" /* uint32_t */ > +#define SCNo64 "llo" /* uint64_t */ /*ll* for GCC build > with EDK2 */ > +#define SCNoLEAST8 "hho" /* uint_least8_t */ > +#define SCNoLEAST16 "ho" /* uint_least16_t */ > +#define SCNoLEAST32 "o" /* uint_least32_t */ > +#define SCNoLEAST64 "llo" /* uint_least64_t */ > +#define SCNoFAST8 "o" /* uint_fast8_t */ > +#define SCNoFAST16 "o" /* uint_fast16_t */ > +#define SCNoFAST32 "o" /* uint_fast32_t */ > +#define SCNoFAST64 "llo" /* uint_fast64_t */ > +#define SCNoMAX "llo" /* uintmax_t */ > +#define SCNoPTR "lo" /* uintptr_t */ > + > +#define SCNu8 "hhu" /* uint8_t */ > +#define SCNu16 "hu" /* uint16_t */ > +#define SCNu32 "u" /* uint32_t */ > +#define SCNu64 "llu" /* uint64_t */ /*ll* for GCC build > with EDK2 */ > +#define SCNuLEAST8 "hhu" /* uint_least8_t */ > +#define SCNuLEAST16 "hu" /* uint_least16_t */ > +#define SCNuLEAST32 "u" /* uint_least32_t */ > +#define SCNuLEAST64 "llu" /* uint_least64_t */ > +#define SCNuFAST8 "u" /* uint_fast8_t */ > +#define SCNuFAST16 "u" /* uint_fast16_t */ > +#define SCNuFAST32 "u" /* uint_fast32_t */ > +#define SCNuFAST64 "llu" /* uint_fast64_t */ > +#define SCNuMAX "llu" /* uintmax_t */ > +#define SCNuPTR "lu" /* uintptr_t */ > + > +#define SCNx8 "hhx" /* uint8_t */ > +#define SCNx16 "hx" /* uint16_t */ > +#define SCNx32 "x" /* uint32_t */ > +#define SCNx64 "llx" /* uint64_t */ /*ll* for GCC build > with EDK2 */ > +#define SCNxLEAST8 "hhx" /* uint_least8_t */ > +#define SCNxLEAST16 "hx" /* uint_least16_t */ > +#define SCNxLEAST32 "x" /* uint_least32_t */ > +#define SCNxLEAST64 "llx" /* uint_least64_t */ > +#define SCNxFAST8 "x" /* uint_fast8_t */ > +#define SCNxFAST16 "x" /* uint_fast16_t */ > +#define SCNxFAST32 "x" /* uint_fast32_t */ > +#define SCNxFAST64 "llx" /* uint_fast64_t */ > +#define SCNxMAX "llx" /* uintmax_t */ > +#define SCNxPTR "lx" /* uintptr_t */ >=20 > #endif /* !_AMD64_INT_FMTIO_H_ */ > diff --git a/StdLib/Include/getopt.h b/StdLib/Include/getopt.h > new file mode 100644 > index 0000000..efe16d1 > --- /dev/null > +++ b/StdLib/Include/getopt.h > @@ -0,0 +1,76 @@ > +/* $OpenBSD: getopt.h,v 1.3 2013/11/22 21:32:49 millert Exp $ */ > +/* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */ > + > +/*- > + * Copyright (c) 2000 The NetBSD Foundation, Inc. > + * All rights reserved. > + * > + * This code is derived from software contributed to The NetBSD > Foundation > + * by Dieter Baron and Thomas Klausner. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above > copyright > + * notice, this list of conditions and the following disclaimer in > the > + * documentation and/or other materials provided with the > distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND > CONTRIBUTORS > + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT > NOT LIMITED > + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > PARTICULAR > + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR > CONTRIBUTORS > + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, > EXEMPLARY, OR > + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT > OF > + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR > BUSINESS > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, > WHETHER IN > + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR > OTHERWISE) > + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF > ADVISED OF THE > + * POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#ifndef _GETOPT_H_ > +#define _GETOPT_H_ > + > +#include > + > +/* > + * GNU-like getopt_long() > + */ > +#define no_argument 0 > +#define required_argument 1 > +#define optional_argument 2 > + > +struct option { > + /* name of long option */ > + const char *name; > + /* > + * one of no_argument, required_argument, and optional_argument: > + * whether option takes an argument > + */ > + int has_arg; > + /* if not NULL, set *flag to val when option found */ > + int *flag; > + /* if flag not NULL, value to set *flag to; else return value */ > + int val; > +}; > + > +__BEGIN_DECLS > +int getopt_long(int, char * const *, const char *, > + const struct option *, int *); > +int getopt_long_only(int, char * const *, const char *, > + const struct option *, int *); > +#ifndef _GETOPT_DEFINED_ > +#define _GETOPT_DEFINED_ > +int getopt(int, char * const *, const char *); > + > +extern char *optarg; /* getopt(3) external > variables */ > +extern int opterr; > +extern int optind; > +extern int optopt; > +extern int optreset; > +#endif > +__END_DECLS > + > +#endif /* !_GETOPT_H_ */ > diff --git a/StdLib/Include/inttypes.h b/StdLib/Include/inttypes.h > index 51cdb5b..4854214 100644 > --- a/StdLib/Include/inttypes.h > +++ b/StdLib/Include/inttypes.h > @@ -39,7 +39,7 @@ > #define _INTTYPES_H_ >=20 > #include > -//#include > +#include > #include > #include >=20 > diff --git a/StdLib/Include/sys/socket.h b/StdLib/Include/sys/socket.h > index 11434ed..b9ace77 100644 > --- a/StdLib/Include/sys/socket.h > +++ b/StdLib/Include/sys/socket.h > @@ -82,6 +82,12 @@ typedef __sa_family_t sa_family_t; > #ifndef socklen_t > typedef __socklen_t socklen_t; > #define socklen_t __socklen_t > +/*add some defines that some applications may look for to check for > socklen_t type*/ > +#define _SOCKLEN_T_DEFINED_ > +#define _SOCKLEN_T_DECLARED > +#define __socklen_t_defined > +#define _SOCKLEN_T > +#define __DEFINED_socklen_t > #endif >=20 > #include > diff --git a/StdLib/Include/unistd.h b/StdLib/Include/unistd.h > index b2fd923..5fb2fa7 100644 > --- a/StdLib/Include/unistd.h > +++ b/StdLib/Include/unistd.h > @@ -37,9 +37,7 @@ int dup(int); > int rename(const char *, const char *); >=20 > /* Functions implemented for compatibility. */ > -int getopt(int, char * const [], const char *); > -extern char *optarg; /* getopt(3) external variables */ > -extern int optind; > +#include > pid_t getpgrp(void); > pid_t tcgetpgrp(int); > char *getpass(const char *); > @@ -156,9 +154,6 @@ long sysconf(int); > int tcsetpgrp(int, pid_t); > __aconst char *ttyname(int); >=20 > -extern int opterr; > -extern int optopt; > -extern int optreset; > extern char *suboptarg; >=20 > int setegid(gid_t); > diff --git a/StdLib/LibC/LibC.inf b/StdLib/LibC/LibC.inf > index ad6a117..9539de6 100644 > --- a/StdLib/LibC/LibC.inf > +++ b/StdLib/LibC/LibC.inf > @@ -104,6 +104,7 @@ > LibStdLib > LibStdio > LibString > + LibErr > DevConsole >=20 > ################################################################ > diff --git a/StdLib/LibC/Uefi/Uefi.inf b/StdLib/LibC/Uefi/Uefi.inf > index 1982dd9..817c985 100644 > --- a/StdLib/LibC/Uefi/Uefi.inf > +++ b/StdLib/LibC/Uefi/Uefi.inf > @@ -31,6 +31,7 @@ > Xform.c > compat.c > StubFunctions.c > + getopt_long.c >=20 > [Packages] > StdLib/StdLib.dec > diff --git a/StdLib/LibC/Uefi/compat.c b/StdLib/LibC/Uefi/compat.c > index 251863f..ff62654 100644 > --- a/StdLib/LibC/Uefi/compat.c > +++ b/StdLib/LibC/Uefi/compat.c > @@ -97,45 +97,7 @@ > #include >=20 > #ifndef HAVE_GETOPT > -char *optarg; > -int optind =3D 1; > -int > -getopt(int argc, char **argv, char *args) > -{ > - size_t n; > - size_t nlen =3D strlen(args); > - char cmd; > - char rv; > - > - if (argv[optind] && *argv[optind] =3D=3D '-') { > - cmd =3D *(argv[optind] + 1); > - > - for (n =3D 0; n < nlen; n++) { > - if (args[n] =3D=3D ':') > - continue; > - if (args[n] =3D=3D cmd) { > - rv =3D *(argv[optind] + 1); > - if (args[n+1] =3D=3D ':') { > - if (*(argv[optind] + 2) !=3D '\0') { > - optarg =3D argv[optind] + 2; > - optind +=3D 1; > - } else { > - optarg =3D argv[optind + 1]; > - optind +=3D 2; > - } > - if (!optarg) > - optarg=3D""; > - return rv; > - } else { > - optarg =3D NULL; > - optind +=3D 1; > - return rv; > - } > - } > - } > - } > - return -1; > -} > +#include //functionality for getopt and getopt_long > provided in getopt_long.c > #endif >=20 > #define ISPATHSEPARATOR(x) ((x =3D=3D '/') || (x =3D=3D '\\')) > diff --git a/StdLib/LibC/Uefi/getopt_long.c > b/StdLib/LibC/Uefi/getopt_long.c > new file mode 100644 > index 0000000..c76fd43 > --- /dev/null > +++ b/StdLib/LibC/Uefi/getopt_long.c > @@ -0,0 +1,523 @@ > +/* $OpenBSD: getopt_long.c,v 1.28 2015/09/19 04:02:21 guenther Exp $ > */ > +/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ > + > +/* > + * Copyright (c) 2002 Todd C. Miller > + * > + * Permission to use, copy, modify, and distribute this software for > any > + * purpose with or without fee is hereby granted, provided that the > above > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL > WARRANTIES > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE > LIABLE FOR > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY > DAMAGES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN > AN > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING > OUT OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + * > + * Sponsored in part by the Defense Advanced Research Projects > + * Agency (DARPA) and Air Force Research Laboratory, Air Force > + * Materiel Command, USAF, under agreement number F39502-99-1-0512. > + */ > +/*- > + * Copyright (c) 2000 The NetBSD Foundation, Inc. > + * All rights reserved. > + * > + * This code is derived from software contributed to The NetBSD > Foundation > + * by Dieter Baron and Thomas Klausner. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above > copyright > + * notice, this list of conditions and the following disclaimer in > the > + * documentation and/or other materials provided with the > distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND > CONTRIBUTORS > + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT > NOT LIMITED > + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > PARTICULAR > + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR > CONTRIBUTORS > + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, > EXEMPLARY, OR > + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT > OF > + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR > BUSINESS > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, > WHETHER IN > + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR > OTHERWISE) > + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF > ADVISED OF THE > + * POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#include /*warnx*/ > +#include > +#include > +#include > +#include > + > +int opterr =3D 1; /* if error message should be printed */ > +int optind =3D 1; /* index into parent argv vector */ > +int optopt =3D '?'; /* character checked for validity */ > +int optreset; /* reset getopt */ > +char *optarg; /* argument associated with option */ > + > +#if 0 > +/* DEF_* only work on initialized (non-COMMON) variables */ > +DEF_WEAK(opterr); > +DEF_WEAK(optind); > +DEF_WEAK(optopt); > +#endif > + > +#define PRINT_ERROR ((opterr) && (*options !=3D ':')) > + > +#define FLAG_PERMUTE 0x01 /* permute non-options to the end of > argv */ > +#define FLAG_ALLARGS 0x02 /* treat non-options as args to > option "-1" */ > +#define FLAG_LONGONLY 0x04 /* operate as getopt_long_only */ > + > +/* return values */ > +#define BADCH (int)'?' > +#define BADARG ((*options =3D=3D ':') ? (int)':' : (int)'?') > +#define INORDER (int)1 > + > +#define EMSG "" > + > +static int getopt_internal(int, char * const *, const char *, > + const struct option *, int *, int); > +static int parse_long_options(char * const *, const char *, > + const struct option *, int *, int, int); > +static int gcd(int, int); > +static void permute_args(int, int, int, char * const *); > + > +static char *place =3D EMSG; /* option letter processing */ > + > +/* XXX: set optreset to 1 rather than these two */ > +static int nonopt_start =3D -1; /* first non option argument (for > permute) */ > +static int nonopt_end =3D -1; /* first option after non options (for > permute) */ > + > +/* Error messages */ > +static const char recargchar[] =3D "option requires an argument -- %c"; > +static const char recargstring[] =3D "option requires an argument -- > %s"; > +static const char ambig[] =3D "ambiguous option -- %.*s"; > +static const char noarg[] =3D "option doesn't take an argument -- > %.*s"; > +static const char illoptchar[] =3D "unknown option -- %c"; > +static const char illoptstring[] =3D "unknown option -- %s"; > + > +/* > + * Compute the greatest common divisor of a and b. > + */ > +static int > +gcd(int a, int b) > +{ > + int c; > + > + c =3D a % b; > + while (c !=3D 0) { > + a =3D b; > + b =3D c; > + c =3D a % b; > + } > + > + return (b); > +} > + > +/* > + * Exchange the block from nonopt_start to nonopt_end with the block > + * from nonopt_end to opt_end (keeping the same order of arguments > + * in each block). > + */ > +static void > +permute_args(int panonopt_start, int panonopt_end, int opt_end, > + char * const *nargv) > +{ > + int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos; > + char *swap; > + > + /* > + * compute lengths of blocks and number and size of cycles > + */ > + nnonopts =3D panonopt_end - panonopt_start; > + nopts =3D opt_end - panonopt_end; > + ncycle =3D gcd(nnonopts, nopts); > + cyclelen =3D (opt_end - panonopt_start) / ncycle; > + > + for (i =3D 0; i < ncycle; i++) { > + cstart =3D panonopt_end+i; > + pos =3D cstart; > + for (j =3D 0; j < cyclelen; j++) { > + if (pos >=3D panonopt_end) > + pos -=3D nnonopts; > + else > + pos +=3D nopts; > + swap =3D nargv[pos]; > + ((char **)nargv)[pos] =3D nargv[cstart]; > + ((char **)nargv)[cstart] =3D swap; > + } > + } > +} > + > +/* > + * parse_long_options -- > + * Parse long options in argc/argv argument vector. > + * Returns -1 if short_too is set and the option does not match > long_options. > + */ > +static int > +parse_long_options(char * const *nargv, const char *options, > + const struct option *long_options, int *idx, int short_too, int > flags) > +{ > + char *current_argv, *has_equal; > + size_t current_argv_len; > + int i, match, exact_match, second_partial_match; > + > + current_argv =3D place; > + match =3D -1; > + exact_match =3D 0; > + second_partial_match =3D 0; > + > + optind++; > + > + if ((has_equal =3D strchr(current_argv, '=3D')) !=3D NULL) { > + /* argument found (--option=3Darg) */ > + current_argv_len =3D has_equal - current_argv; > + has_equal++; > + } else > + current_argv_len =3D strlen(current_argv); > + > + for (i =3D 0; long_options[i].name; i++) { > + /* find matching long option */ > + if (strncmp(current_argv, long_options[i].name, > + current_argv_len)) > + continue; > + > + if (strlen(long_options[i].name) =3D=3D current_argv_len) { > + /* exact match */ > + match =3D i; > + exact_match =3D 1; > + break; > + } > + /* > + * If this is a known short option, don't allow > + * a partial match of a single character. > + */ > + if (short_too && current_argv_len =3D=3D 1) > + continue; > + > + if (match =3D=3D -1) /* first partial match */ > + match =3D i; > + else if ((flags & FLAG_LONGONLY) || > + long_options[i].has_arg !=3D long_options[match].has_arg || > + long_options[i].flag !=3D long_options[match].flag || > + long_options[i].val !=3D long_options[match].val) > + second_partial_match =3D 1; > + } > + if (!exact_match && second_partial_match) { > + /* ambiguous abbreviation */ > + if (PRINT_ERROR) > + warnx(ambig, (int)current_argv_len, current_argv); > + optopt =3D 0; > + return (BADCH); > + } > + if (match !=3D -1) { /* option found */ > + if (long_options[match].has_arg =3D=3D no_argument > + && has_equal) { > + if (PRINT_ERROR) > + warnx(noarg, (int)current_argv_len, > + current_argv); > + /* > + * XXX: GNU sets optopt to val regardless of flag > + */ > + if (long_options[match].flag =3D=3D NULL) > + optopt =3D long_options[match].val; > + else > + optopt =3D 0; > + return (BADARG); > + } > + if (long_options[match].has_arg =3D=3D required_argument || > + long_options[match].has_arg =3D=3D optional_argument) { > + if (has_equal) > + optarg =3D has_equal; > + else if (long_options[match].has_arg =3D=3D > + required_argument) { > + /* > + * optional argument doesn't use next nargv > + */ > + optarg =3D nargv[optind++]; > + } > + } > + if ((long_options[match].has_arg =3D=3D required_argument) > + && (optarg =3D=3D NULL)) { > + /* > + * Missing argument; leading ':' indicates no error > + * should be generated. > + */ > + if (PRINT_ERROR) > + warnx(recargstring, > + current_argv); > + /* > + * XXX: GNU sets optopt to val regardless of flag > + */ > + if (long_options[match].flag =3D=3D NULL) > + optopt =3D long_options[match].val; > + else > + optopt =3D 0; > + --optind; > + return (BADARG); > + } > + } else { /* unknown option */ > + if (short_too) { > + --optind; > + return (-1); > + } > + if (PRINT_ERROR) > + warnx(illoptstring, current_argv); > + optopt =3D 0; > + return (BADCH); > + } > + if (idx) > + *idx =3D match; > + if (long_options[match].flag) { > + *long_options[match].flag =3D long_options[match].val; > + return (0); > + } else > + return (long_options[match].val); > +} > + > +/* > + * getopt_internal -- > + * Parse argc/argv argument vector. Called by user level routines. > + */ > +static int > +getopt_internal(int nargc, char * const *nargv, const char *options, > + const struct option *long_options, int *idx, int flags) > +{ > + char *oli; /* option letter list index */ > + int optchar, short_too; > + static int posixly_correct =3D -1; > + > + if (options =3D=3D NULL) > + return (-1); > + > + /* > + * XXX Some GNU programs (like cvs) set optind to 0 instead of > + * XXX using optreset. Work around this braindamage. > + */ > + if (optind =3D=3D 0) > + optind =3D optreset =3D 1; > + > + /* > + * Disable GNU extensions if POSIXLY_CORRECT is set or options > + * string begins with a '+'. > + */ > + if (posixly_correct =3D=3D -1 || optreset) > + posixly_correct =3D (getenv("POSIXLY_CORRECT") !=3D NULL); > + if (*options =3D=3D '-') > + flags |=3D FLAG_ALLARGS; > + else if (posixly_correct || *options =3D=3D '+') > + flags &=3D ~FLAG_PERMUTE; > + if (*options =3D=3D '+' || *options =3D=3D '-') > + options++; > + > + optarg =3D NULL; > + if (optreset) > + nonopt_start =3D nonopt_end =3D -1; > +start: > + if (optreset || !*place) { /* update scanning pointer */ > + optreset =3D 0; > + if (optind >=3D nargc) { /* end of argument vector */ > + place =3D EMSG; > + if (nonopt_end !=3D -1) { > + /* do permutation, if we have to */ > + permute_args(nonopt_start, nonopt_end, > + optind, nargv); > + optind -=3D nonopt_end - nonopt_start; > + } > + else if (nonopt_start !=3D -1) { > + /* > + * If we skipped non-options, set optind > + * to the first of them. > + */ > + optind =3D nonopt_start; > + } > + nonopt_start =3D nonopt_end =3D -1; > + return (-1); > + } > + if (*(place =3D nargv[optind]) !=3D '-' || > + (place[1] =3D=3D '\0' && strchr(options, '-') =3D=3D NULL)) = { > + place =3D EMSG; /* found non-option */ > + if (flags & FLAG_ALLARGS) { > + /* > + * GNU extension: > + * return non-option as argument to option 1 > + */ > + optarg =3D nargv[optind++]; > + return (INORDER); > + } > + if (!(flags & FLAG_PERMUTE)) { > + /* > + * If no permutation wanted, stop parsing > + * at first non-option. > + */ > + return (-1); > + } > + /* do permutation */ > + if (nonopt_start =3D=3D -1) > + nonopt_start =3D optind; > + else if (nonopt_end !=3D -1) { > + permute_args(nonopt_start, nonopt_end, > + optind, nargv); > + nonopt_start =3D optind - > + (nonopt_end - nonopt_start); > + nonopt_end =3D -1; > + } > + optind++; > + /* process next argument */ > + goto start; > + } > + if (nonopt_start !=3D -1 && nonopt_end =3D=3D -1) > + nonopt_end =3D optind; > + > + /* > + * If we have "-" do nothing, if "--" we are done. > + */ > + if (place[1] !=3D '\0' && *++place =3D=3D '-' && place[1] =3D=3D= '\0') > { > + optind++; > + place =3D EMSG; > + /* > + * We found an option (--), so if we skipped > + * non-options, we have to permute. > + */ > + if (nonopt_end !=3D -1) { > + permute_args(nonopt_start, nonopt_end, > + optind, nargv); > + optind -=3D nonopt_end - nonopt_start; > + } > + nonopt_start =3D nonopt_end =3D -1; > + return (-1); > + } > + } > + > + /* > + * Check long options if: > + * 1) we were passed some > + * 2) the arg is not just "-" > + * 3) either the arg starts with -- we are getopt_long_only() > + */ > + if (long_options !=3D NULL && place !=3D nargv[optind] && > + (*place =3D=3D '-' || (flags & FLAG_LONGONLY))) { > + short_too =3D 0; > + if (*place =3D=3D '-') > + place++; /* --foo long option */ > + else if (*place !=3D ':' && strchr(options, *place) !=3D NULL) > + short_too =3D 1; /* could be short option too */ > + > + optchar =3D parse_long_options(nargv, options, long_options, > + idx, short_too, flags); > + if (optchar !=3D -1) { > + place =3D EMSG; > + return (optchar); > + } > + } > + > + if ((optchar =3D (int)*place++) =3D=3D (int)':' || > + (optchar =3D=3D (int)'-' && *place !=3D '\0') || > + (oli =3D strchr(options, optchar)) =3D=3D NULL) { > + /* > + * If the user specified "-" and '-' isn't listed in > + * options, return -1 (non-option) as per POSIX. > + * Otherwise, it is an unknown option character (or ':'). > + */ > + if (optchar =3D=3D (int)'-' && *place =3D=3D '\0') > + return (-1); > + if (!*place) > + ++optind; > + if (PRINT_ERROR) > + warnx(illoptchar, optchar); > + optopt =3D optchar; > + return (BADCH); > + } > + if (long_options !=3D NULL && optchar =3D=3D 'W' && oli[1] =3D=3D ';= ') { > + /* -W long-option */ > + if (*place) /* no space */ > + /* NOTHING */; > + else if (++optind >=3D nargc) { /* no arg */ > + place =3D EMSG; > + if (PRINT_ERROR) > + warnx(recargchar, optchar); > + optopt =3D optchar; > + return (BADARG); > + } else /* white space */ > + place =3D nargv[optind]; > + optchar =3D parse_long_options(nargv, options, long_options, > + idx, 0, flags); > + place =3D EMSG; > + return (optchar); > + } > + if (*++oli !=3D ':') { /* doesn't take argument */ > + if (!*place) > + ++optind; > + } else { /* takes (optional) argument */ > + optarg =3D NULL; > + if (*place) /* no white space */ > + optarg =3D place; > + else if (oli[1] !=3D ':') { /* arg not optional */ > + if (++optind >=3D nargc) { /* no arg */ > + place =3D EMSG; > + if (PRINT_ERROR) > + warnx(recargchar, optchar); > + optopt =3D optchar; > + return (BADARG); > + } else > + optarg =3D nargv[optind]; > + } > + place =3D EMSG; > + ++optind; > + } > + /* dump back option letter */ > + return (optchar); > +} > + > +/* > + * getopt -- > + * Parse argc/argv argument vector. > + * > + * [eventually this will replace the BSD getopt] > + */ > +int > +getopt(int nargc, char * const *nargv, const char *options) > +{ > + > + /* > + * We don't pass FLAG_PERMUTE to getopt_internal() since > + * the BSD getopt(3) (unlike GNU) has never done this. > + * > + * Furthermore, since many privileged programs call getopt() > + * before dropping privileges it makes sense to keep things > + * as simple (and bug-free) as possible. > + */ > + return (getopt_internal(nargc, nargv, options, NULL, NULL, 0)); > +} > + > +/* > + * getopt_long -- > + * Parse argc/argv argument vector. > + */ > +int > +getopt_long(int nargc, char * const *nargv, const char *options, > + const struct option *long_options, int *idx) > +{ > + > + return (getopt_internal(nargc, nargv, options, long_options, idx, > + FLAG_PERMUTE)); > +} > + > +/* > + * getopt_long_only -- > + * Parse argc/argv argument vector. > + */ > +int > +getopt_long_only(int nargc, char * const *nargv, const char *options, > + const struct option *long_options, int *idx) > +{ > + > + return (getopt_internal(nargc, nargv, options, long_options, idx, > + FLAG_PERMUTE|FLAG_LONGONLY)); > +} > -- > 2.40.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109870): https://edk2.groups.io/g/devel/message/109870 Mute This Topic: https://groups.io/mt/102081650/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-