mirror of
https://github.com/reactos/reactos.git
synced 2024-10-01 23:14:53 +00:00
b2494542da
From releases/0.4.9 to releases/0.4.10 we introduced tons of compiler warnings within the whole host-tools component although the 'offending' code did not change in between both. I am not aware which commit unhid them exactly during 0.4.10-dev', but I will follow the footsteps of master with the fixes. releases/0.4.9 still had 0 warnings within host-tools, and releases/0.4.13 managed to achieve the same again! fix is a pick from: 0.4.11-dev-436-gda019b0fc5
(the mkhive\registry.c part) 0.4.13-dev-132-gf47f45dbdd
(picked the remaining parts of that) 0.4.13-dev-133-gc02257ef57
0.4.13-dev-134-g2c11c41115
the warnings could be observed with MSVC 2010SP1 (16.0.40219.1) x86 target in dbg configuration: where the 0.4.13-dev-132-gf47f45dbdd
part fixed the: [6/12736] Performing build step for 'host-tools' [13/250] Building CXX object sdk\tools\hhpcomp\CMakeFiles\hhpcomp.dir\hhpcomp.cpp.obj C:\0410rls\reactos\sdk\tools\hhpcomp\hhpcomp.cpp(59) : warning C4996: 'chdir': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _chdir. See online help for details. C:\VS2010_SP1\VC\INCLUDE\direct.h(123) : see declaration of 'chdir' C:\0410rls\reactos\sdk\tools\hhpcomp\chmc\chmc.c(160) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(723) : see declaration of 'fileno' C:\0410rls\reactos\sdk\tools\hhpcomp\chmc\chmc.c(447) : warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details. C:\VS2010_SP1\VC\INCLUDE\string.h(238) : see declaration of 'strdup' C:\0410rls\reactos\sdk\tools\hhpcomp\chmc\chmc.c(476) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(723) : see declaration of 'fileno' C:\0410rls\reactos\sdk\tools\hhpcomp\chmc\chmc.c(511) : warning C4996: 'unlink': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(299) : see declaration of 'unlink' C:\0410rls\reactos\sdk\tools\hpp\hpp.c(44) : warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details. C:\VS2010_SP1\VC\INCLUDE\string.h(238) : see declaration of 'strdup' C:\0410rls\reactos\sdk\tools\isohybrid\isohybrid.c(1201) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(723) : see declaration of 'fileno' C:\0410rls\reactos\sdk\tools\isohybrid\isohybrid.c(1204) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(723) : see declaration of 'fileno' C:\0410rls\reactos\sdk\tools\kbdtool\parser.c(448) : warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details. C:\VS2010_SP1\VC\INCLUDE\string.h(238) : see declaration of 'strdup' C:\0410rls\reactos\sdk\tools\kbdtool\parser.c(523) : warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details. C:\VS2010_SP1\VC\INCLUDE\string.h(238) : see declaration of 'strdup' C:\0410rls\reactos\sdk\tools\kbdtool\parser.c(598) : warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details. C:\VS2010_SP1\VC\INCLUDE\string.h(238) : see declaration of 'strdup' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\libschily\stdio\ffileread.c(30) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(723) : see declaration of 'fileno' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\libschily\stdio\fcons.c(62) : warning C4996: 'fdopen': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fdopen. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(721) : see declaration of 'fdopen' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\libschily\stdio\flag.c(44) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(723) : see declaration of 'fileno' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\libschily\stdio\flag.c(73) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(723) : see declaration of 'fileno' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\libschily\stdio\flag.c(98) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(723) : see declaration of 'fileno' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\libschily\stdio\filewrite.c(82) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(723) : see declaration of 'fileno' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\libschily\fconv.c(231) : warning C4996: 'ecvt': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _ecvt. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdlib.h(864) : see declaration of 'ecvt' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\libschily\fconv.c(320) : warning C4996: 'fcvt': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fcvt. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdlib.h(865) : see declaration of 'fcvt' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\libschily\format.c(745) : warning C4996: 'gcvt': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _gcvt. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdlib.h(866) : see declaration of 'gcvt' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\libschily\searchinpath.c(221) : warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details. C:\VS2010_SP1\VC\INCLUDE\string.h(238) : see declaration of 'strdup' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\libsiconv\sic_nls.c(450) : warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details. C:\VS2010_SP1\VC\INCLUDE\string.h(238) : see declaration of 'strdup' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\boot.c(169) : warning C4996: 'access': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _access. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(299) : see declaration of 'access' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\boot.c(225) : warning C4996: 'access': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _access. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(299) : see declaration of 'access' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\boot.c(414) : warning C4996: 'open': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _open. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(312) : see declaration of 'open' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\boot.c(420) : warning C4996: 'read': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _read. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(313) : see declaration of 'read' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\boot.c(425) : warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(302) : see declaration of 'close' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\boot.c(464) : warning C4996: 'open': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _open. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(312) : see declaration of 'open' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\boot.c(467) : warning C4996: 'read': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _read. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(313) : see declaration of 'read' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\boot.c(469) : warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(302) : see declaration of 'close' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\boot.c(536) : warning C4996: 'open': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _open. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(312) : see declaration of 'open' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\boot.c(541) : warning C4996: 'read': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _read. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(313) : see declaration of 'read' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\boot.c(549) : warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(302) : see declaration of 'close' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\eltorito.c(447) : warning C4996: 'open': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _open. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(312) : see declaration of 'open' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\eltorito.c(453) : warning C4996: 'read': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _read. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(313) : see declaration of 'read' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\eltorito.c(457) : warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(302) : see declaration of 'close' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\eltorito.c(585) : warning C4996: 'open': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _open. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(312) : see declaration of 'open' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\eltorito.c(594) : warning C4996: 'read': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _read. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(313) : see declaration of 'read' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\eltorito.c(615) : warning C4996: 'lseek': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _lseek. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(310) : see declaration of 'lseek' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\eltorito.c(623) : warning C4996: 'write': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _write. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(318) : see declaration of 'write' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\eltorito.c(624) : warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(302) : see declaration of 'close' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\match.c(74) : warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details. C:\VS2010_SP1\VC\INCLUDE\string.h(238) : see declaration of 'strdup' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\match.c(201) : warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details. C:\VS2010_SP1\VC\INCLUDE\string.h(238) : see declaration of 'strdup' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\multi.c(124) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(723) : see declaration of 'fileno' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\multi.c(126) : warning C4996: 'lseek': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _lseek. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(310) : see declaration of 'lseek' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\multi.c(130) : warning C4996: 'read': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _read. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(313) : see declaration of 'read' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\multi.c(124) : warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(723) : see declaration of 'fileno' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\multi.c(126) : warning C4996: 'lseek': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _lseek. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(310) : see declaration of 'lseek' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\multi.c(130) : warning C4996: 'read': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _read. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(313) : see declaration of 'read' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\tree.c(1628) : warning C4996: 'access': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _access. See online help for details. C:\VS2010_SP1\VC\INCLUDE\io.h(299) : see declaration of 'access' C:\0410rls\reactos\sdk\tools\mkisofs\schilytools\mkisofs\write.c(204) : warning C4996: 'unlink': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(299) : see declaration of 'unlink' C:\0410rls\reactos\sdk\tools\wpp\preproc.c(162) : warning C4013: 'open' undefined; assuming extern returning int C:\0410rls\reactos\sdk\tools\wpp\preproc.c(165) : warning C4013: 'close' undefined; assuming extern returning int C:\0410rls\reactos\sdk\tools\widl\widl.c(863) : warning C4996: 'fdopen': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fdopen. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(721) : see declaration of 'fdopen' C:\0410rls\reactos\sdk\tools\widl\widl.c(910) : warning C4996: 'unlink': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(299) : see declaration of 'unlink' C:\0410rls\reactos\sdk\tools\widl\widl.c(912) : warning C4996: 'unlink': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(299) : see declaration of 'unlink' C:\0410rls\reactos\sdk\tools\widl\widl.c(914) : warning C4996: 'unlink': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(299) : see declaration of 'unlink' C:\0410rls\reactos\sdk\tools\widl\widl.c(916) : warning C4996: 'unlink': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(299) : see declaration of 'unlink' C:\0410rls\reactos\sdk\tools\widl\widl.c(918) : warning C4996: 'unlink': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(299) : see declaration of 'unlink' C:\0410rls\reactos\sdk\tools\widl\widl.c(920) : warning C4996: 'unlink': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(299) : see declaration of 'unlink' C:\0410rls\reactos\sdk\tools\widl\widl.c(922) : warning C4996: 'unlink': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(299) : see declaration of 'unlink' C:\0410rls\reactos\sdk\tools\widl\widl.c(924) : warning C4996: 'unlink': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(299) : see declaration of 'unlink' C:\0410rls\reactos\sdk\tools\widl\widl.c(926) : warning C4996: 'unlink': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(299) : see declaration of 'unlink' C:\0410rls\reactos\sdk\tools\widl\typelib.c(264) : warning C4013: 'read' undefined; assuming extern returning int C:\0410rls\reactos\sdk\tools\widl\typelib.c(270) : warning C4013: 'lseek' undefined; assuming extern returning int C:\0410rls\reactos\sdk\tools\widl\typelib.c(343) : warning C4013: 'open' undefined; assuming extern returning int C:\0410rls\reactos\sdk\tools\widl\typelib.c(383) : warning C4013: 'close' undefined; assuming extern returning int C:\0410rls\reactos\sdk\tools\widl\utils.c(281) : warning C4013: 'open' undefined; assuming extern returning int C:\0410rls\reactos\sdk\tools\widl\utils.c(283) : warning C4013: 'write' undefined; assuming extern returning int C:\0410rls\reactos\sdk\tools\widl\utils.c(285) : warning C4013: 'close' undefined; assuming extern returning int [194/250] Building C object sdk\tools\widl\CMakeFiles\widl.dir\parser.yy.c.obj parser.l(488) : warning C4996: 'unlink': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(299) : see declaration of 'unlink' parser.l(542) : warning C4996: 'fdopen': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fdopen. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(721) : see declaration of 'fdopen' parser.l(562) : warning C4996: 'unlink': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details. C:\VS2010_SP1\VC\INCLUDE\stdio.h(299) : see declaration of 'unlink' [197/250] Building C object sdk\tools\widl\CMakeFiles\widl.dir\parser.tab.c.obj parser.y(454) : warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details. C:\VS2010_SP1\VC\INCLUDE\string.h(238) : see declaration of 'strdup' ... and so on ... too many to name them all ---------- 0.4.13-dev-134-g2c11c41115
part fixed the: C:\0410rls\reactos\sdk\tools\widl\getopt.c(233) : warning C4013: '_getopt_internal' undefined; assuming extern returning int ---------- 0.4.13-dev-133-gc02257ef57
part fixed the: C:\0410rls\reactos\sdk\tools\isohybrid\isohybrid.c(978) : warning C4101: 'orig_gpt_size' : unreferenced local variable C:\0410rls\reactos\sdk\tools\isohybrid\isohybrid.c(978) : warning C4101: 'gpt_size' : unreferenced local variable ---------- partial port (registry.c) of 0.4.11-dev-436-gda019b0fc5
fixed the: C:\0410rls\reactos\sdk\tools\mkhive\registry.c(369) : warning C4101: 'SubKeyCell' : unreferenced local variable
156 lines
3.7 KiB
C
156 lines
3.7 KiB
C
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||
Copyright (C) 1987-2019 Free Software Foundation, Inc.
|
||
This file is part of the GNU C Library and is also part of gnulib.
|
||
Patches to this file should be submitted to both projects.
|
||
|
||
The GNU C Library is free software; you can redistribute it and/or
|
||
modify it under the terms of the GNU Lesser General Public
|
||
License as published by the Free Software Foundation; either
|
||
version 2.1 of the License, or (at your option) any later version.
|
||
|
||
The GNU C Library is distributed in the hope that it will be useful,
|
||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
Lesser General Public License for more details.
|
||
|
||
You should have received a copy of the GNU Lesser General Public
|
||
License along with the GNU C Library; if not, see
|
||
<http://www.gnu.org/licenses/>. */
|
||
|
||
#include "getopt.h"
|
||
#include "getopt_int.h"
|
||
|
||
int
|
||
getopt_long (int argc, char *__getopt_argv_const *argv, const char *options,
|
||
const struct option *long_options, int *opt_index)
|
||
{
|
||
return _getopt_internal (argc, (char **) argv, options, long_options,
|
||
opt_index, 0, 0);
|
||
}
|
||
|
||
int
|
||
_getopt_long_r (int argc, char **argv, const char *options,
|
||
const struct option *long_options, int *opt_index,
|
||
struct _getopt_data *d)
|
||
{
|
||
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
|
||
0, d, 0);
|
||
}
|
||
|
||
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
||
If an option that starts with '-' (not '--') doesn't match a long option,
|
||
but does match a short option, it is parsed as a short option
|
||
instead. */
|
||
|
||
int
|
||
getopt_long_only (int argc, char *__getopt_argv_const *argv,
|
||
const char *options,
|
||
const struct option *long_options, int *opt_index)
|
||
{
|
||
return _getopt_internal (argc, (char **) argv, options, long_options,
|
||
opt_index, 1, 0);
|
||
}
|
||
|
||
int
|
||
_getopt_long_only_r (int argc, char **argv, const char *options,
|
||
const struct option *long_options, int *opt_index,
|
||
struct _getopt_data *d)
|
||
{
|
||
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
|
||
1, d, 0);
|
||
}
|
||
|
||
|
||
#ifdef TEST
|
||
|
||
#include <stdio.h>
|
||
#include <stdlib.h>
|
||
|
||
int
|
||
main (int argc, char **argv)
|
||
{
|
||
int c;
|
||
int digit_optind = 0;
|
||
|
||
while (1)
|
||
{
|
||
int this_option_optind = optind ? optind : 1;
|
||
int option_index = 0;
|
||
static const struct option long_options[] =
|
||
{
|
||
{"add", 1, 0, 0},
|
||
{"append", 0, 0, 0},
|
||
{"delete", 1, 0, 0},
|
||
{"verbose", 0, 0, 0},
|
||
{"create", 0, 0, 0},
|
||
{"file", 1, 0, 0},
|
||
{0, 0, 0, 0}
|
||
};
|
||
|
||
c = getopt_long (argc, argv, "abc:d:0123456789",
|
||
long_options, &option_index);
|
||
if (c == -1)
|
||
break;
|
||
|
||
switch (c)
|
||
{
|
||
case 0:
|
||
printf ("option %s", long_options[option_index].name);
|
||
if (optarg)
|
||
printf (" with arg %s", optarg);
|
||
printf ("\n");
|
||
break;
|
||
|
||
case '0':
|
||
case '1':
|
||
case '2':
|
||
case '3':
|
||
case '4':
|
||
case '5':
|
||
case '6':
|
||
case '7':
|
||
case '8':
|
||
case '9':
|
||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||
printf ("digits occur in two different argv-elements.\n");
|
||
digit_optind = this_option_optind;
|
||
printf ("option %c\n", c);
|
||
break;
|
||
|
||
case 'a':
|
||
printf ("option a\n");
|
||
break;
|
||
|
||
case 'b':
|
||
printf ("option b\n");
|
||
break;
|
||
|
||
case 'c':
|
||
printf ("option c with value '%s'\n", optarg);
|
||
break;
|
||
|
||
case 'd':
|
||
printf ("option d with value '%s'\n", optarg);
|
||
break;
|
||
|
||
case '?':
|
||
break;
|
||
|
||
default:
|
||
printf ("?? getopt returned character code 0%o ??\n", c);
|
||
}
|
||
}
|
||
|
||
if (optind < argc)
|
||
{
|
||
printf ("non-option ARGV-elements: ");
|
||
while (optind < argc)
|
||
printf ("%s ", argv[optind++]);
|
||
printf ("\n");
|
||
}
|
||
|
||
exit (0);
|
||
}
|
||
|
||
#endif /* TEST */
|