getopt/*, regex/*: Add _GETOPT/REGEX*_STANDALONE configurations.

Makefile.am, os_win32/vc14/smart*.vcxproj*: Set *_STANDALONE.  Add new files.

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4759 4ea69e1a-61f1-4043-bf83-b5c94c648137
pull/15/merge
chrfranke 4 years ago
parent c1e71b1c5e
commit b18b59e10e
  1. 4
      smartmontools/ChangeLog
  2. 14
      smartmontools/Makefile.am
  3. 16
      smartmontools/getopt/getopt.c
  4. 29
      smartmontools/getopt/getopt.h
  5. 2
      smartmontools/getopt/getopt1.c
  6. 11
      smartmontools/os_win32/vc14/smartctl.vcxproj
  7. 9
      smartmontools/os_win32/vc14/smartctl.vcxproj.filters
  8. 11
      smartmontools/os_win32/vc14/smartd.vcxproj
  9. 9
      smartmontools/os_win32/vc14/smartd.vcxproj.filters
  10. 4
      smartmontools/regex/regcomp.c
  11. 2
      smartmontools/regex/regex.c
  12. 2
      smartmontools/regex/regex.h
  13. 8
      smartmontools/regex/regex_internal.h

@ -3,7 +3,9 @@ $Id$
2018-08-19 Christian Franke <franke@computer.org>
getopt/*, regex/*: Replace with current version from glibc 2.28
(2018-08-01).
(2018-08-01). Add _GETOPT/REGEX*_STANDALONE configurations.
Makefile.am, os_win32/vc14/smart*.vcxproj*: Set *_STANDALONE.
Add new files.
examplescripts/README: Update mailing list address.
os_solaris_ata.s: Remove old mailing list address.

@ -32,10 +32,10 @@ if OS_WIN32_MINGW
AM_CPPFLAGS += -I$(srcdir)/os_win32
endif
if NEED_GETOPT_LONG
AM_CPPFLAGS += -I$(srcdir)/getopt -DHAVE_GETOPT_LONG -D__GNU_LIBRARY__
AM_CPPFLAGS += -I$(srcdir)/getopt -D_GETOPT_STANDALONE -DHAVE_GETOPT_LONG
endif
if NEED_REGEX
AM_CPPFLAGS += -I$(srcdir)/regex
AM_CPPFLAGS += -I$(srcdir)/regex -D_REGEX_STANDALONE
endif
sbin_PROGRAMS = \
@ -209,12 +209,18 @@ if NEED_GETOPT_LONG
smartctl_SOURCES += \
getopt/getopt.c \
getopt/getopt.h \
getopt/getopt1.c
getopt/getopt1.c \
getopt/getopt_int.h \
getopt/bits/getopt_core.h \
getopt/bits/getopt_ext.h
smartd_SOURCES += \
getopt/getopt.c \
getopt/getopt.h \
getopt/getopt1.c
getopt/getopt1.c \
getopt/getopt_int.h \
getopt/bits/getopt_core.h \
getopt/bits/getopt_ext.h
endif

@ -17,7 +17,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _LIBC
#if !defined(_LIBC) && !defined(_GETOPT_STANDALONE)
# include <config.h>
#endif
@ -26,7 +26,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef _GETOPT_STANDALONE
#include <unistd.h>
#endif
#ifdef _LIBC
/* When used as part of glibc, error printing must be done differently
@ -41,8 +43,12 @@
# define flockfile(fp) _IO_flockfile (fp)
# define funlockfile(fp) _IO_funlockfile (fp)
#else
#ifndef _GETOPT_STANDALONE
# include "gettext.h"
# define _(msgid) gettext (msgid)
#else
# define _(msgid) (msgid)
#endif
/* When used standalone, flockfile and funlockfile might not be
available. */
# ifndef _POSIX_THREAD_SAFE_FUNCTIONS
@ -374,6 +380,14 @@ process_long_option (int argc, char **argv, const char *optstring,
return pfound->val;
}
#ifndef _GL_UNUSED
# ifdef __GNUC__
# define _GL_UNUSED __attribute__((__unused__))
# else
# define _GL_UNUSED
# endif
#endif
/* Initialize internal data upon the first call to getopt. */
static const char *

@ -21,7 +21,36 @@
#ifndef _GETOPT_H
#define _GETOPT_H 1
#ifndef _GETOPT_STANDALONE
#include <features.h>
#endif
// From <sys/cdefs.h>:
#ifndef __BEGIN_DECLS
# ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
# else
# define __BEGIN_DECLS
# define __END_DECLS
# endif
#endif
#ifndef __THROW
# ifdef __cplusplus
# define __THROW throw()
# elif defined(__GNUC__)
# define __THROW __attribute__ ((__nothrow__))
# else
# define __THROW
# endif
#endif
#ifndef __nonnull
# ifdef __GNUC__
# define __nonnull(x) __attribute__ ((__nonnull__ x))
# else
# define __nonnull(x)
# endif
#endif
/* The type of the 'argv' argument to getopt_long and getopt_long_only
is properly 'char **', since both functions may write to the array

@ -17,7 +17,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _LIBC
#if !defined(_LIBC) && !defined(_GETOPT_STANDALONE)
# include <config.h>
#endif

@ -82,7 +82,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;..\..\getopt;..\..\regex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;HAVE_CONFIG_H;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_GETOPT_STANDALONE;_REGEX_STANDALONE;HAVE_CONFIG_H;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -102,7 +102,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;..\..\getopt;..\..\regex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;HAVE_CONFIG_H;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_GETOPT_STANDALONE;_REGEX_STANDALONE;HAVE_CONFIG_H;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
@ -119,7 +119,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>.;..\..\getopt;..\..\regex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;HAVE_CONFIG_H;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_GETOPT_STANDALONE;_REGEX_STANDALONE;HAVE_CONFIG_H;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
@ -138,7 +138,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>.;..\..\getopt;..\..\regex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;HAVE_CONFIG_H;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_GETOPT_STANDALONE;_REGEX_STANDALONE;HAVE_CONFIG_H;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
@ -284,6 +284,9 @@
<ClInclude Include="..\..\ataidentify.h" />
<ClInclude Include="..\..\dev_areca.h" />
<ClInclude Include="..\..\dev_intelliprop.h" />
<ClInclude Include="..\..\getopt\bits\getopt_core.h" />
<ClInclude Include="..\..\getopt\bits\getopt_ext.h" />
<ClInclude Include="..\..\getopt\getopt_int.h" />
<ClInclude Include="..\..\json.h" />
<ClInclude Include="..\..\nvmecmds.h" />
<ClInclude Include="..\..\nvmeprint.h" />

@ -106,6 +106,15 @@
<ClInclude Include="..\..\nvmeprint.h" />
<ClInclude Include="..\..\dev_intelliprop.h" />
<ClInclude Include="..\..\json.h" />
<ClInclude Include="..\..\getopt\getopt_int.h">
<Filter>getopt</Filter>
</ClInclude>
<ClInclude Include="..\..\getopt\bits\getopt_core.h">
<Filter>getopt</Filter>
</ClInclude>
<ClInclude Include="..\..\getopt\bits\getopt_ext.h">
<Filter>getopt</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\installer.nsi">

@ -82,7 +82,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;..;..\..\getopt;..\..\regex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;HAVE_CONFIG_H;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_GETOPT_STANDALONE;_REGEX_STANDALONE;HAVE_CONFIG_H;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -102,7 +102,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;..;..\..\getopt;..\..\regex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;HAVE_CONFIG_H;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_GETOPT_STANDALONE;_REGEX_STANDALONE;HAVE_CONFIG_H;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
@ -119,7 +119,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>.;..;..\..\getopt;..\..\regex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;HAVE_CONFIG_H;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_GETOPT_STANDALONE;_REGEX_STANDALONE;HAVE_CONFIG_H;_USE_32BIT_TIME_T;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
@ -138,7 +138,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>.;..;..\..\getopt;..\..\regex;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;HAVE_CONFIG_H;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_GETOPT_STANDALONE;_REGEX_STANDALONE;HAVE_CONFIG_H;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
@ -298,6 +298,9 @@
</ClInclude>
<ClInclude Include="..\..\dev_areca.h" />
<ClInclude Include="..\..\dev_intelliprop.h" />
<ClInclude Include="..\..\getopt\bits\getopt_core.h" />
<ClInclude Include="..\..\getopt\bits\getopt_ext.h" />
<ClInclude Include="..\..\getopt\getopt_int.h" />
<ClInclude Include="..\..\nvmecmds.h" />
<ClInclude Include="..\..\nvmeprint.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>

@ -107,6 +107,15 @@
<ClInclude Include="..\..\nvmecmds.h" />
<ClInclude Include="..\..\nvmeprint.h" />
<ClInclude Include="..\..\dev_intelliprop.h" />
<ClInclude Include="..\..\getopt\getopt_int.h">
<Filter>getopt</Filter>
</ClInclude>
<ClInclude Include="..\..\getopt\bits\getopt_core.h">
<Filter>getopt</Filter>
</ClInclude>
<ClInclude Include="..\..\getopt\bits\getopt_ext.h">
<Filter>getopt</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\installer.nsi">

@ -840,7 +840,7 @@ static reg_errcode_t
init_dfa (re_dfa_t *dfa, size_t pat_len)
{
__re_size_t table_size;
#ifndef _LIBC
#if !defined(_LIBC) && !defined(_REGEX_STANDALONE)
const char *codeset_name;
#endif
#ifdef RE_ENABLE_I18N
@ -886,12 +886,14 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
dfa->map_notascii = (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_TO_NONASCII)
!= 0);
#else
# if !defined(_REGEX_STANDALONE)
codeset_name = nl_langinfo (CODESET);
if ((codeset_name[0] == 'U' || codeset_name[0] == 'u')
&& (codeset_name[1] == 'T' || codeset_name[1] == 't')
&& (codeset_name[2] == 'F' || codeset_name[2] == 'f')
&& strcmp (codeset_name + 3 + (codeset_name[3] == '-'), "8") == 0)
dfa->is_utf8 = 1;
# endif
/* We check exhaustively in the loop below if this charset is a
superset of ASCII. */

@ -17,7 +17,7 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#ifndef _LIBC
#if !defined(_LIBC) && !defined(_REGEX_STANDALONE)
# include <config.h>
# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__

@ -29,7 +29,7 @@ extern "C" {
/* Define __USE_GNU to declare GNU extensions that violate the
POSIX name space rules. */
#ifdef _GNU_SOURCE
#if defined(_GNU_SOURCE) || defined(_REGEX_STANDALONE)
# define __USE_GNU 1
#endif

@ -26,7 +26,9 @@
#include <stdlib.h>
#include <string.h>
#ifndef _REGEX_STANDALONE
#include <langinfo.h>
#endif
#include <locale.h>
#include <wchar.h>
#include <wctype.h>
@ -35,7 +37,7 @@
/* Properties of integers. Although Gnulib has intprops.h, glibc does
without for now. */
#ifndef _LIBC
#if !defined(_LIBC) && !defined(_REGEX_STANDALONE)
# include "intprops.h"
#else
/* True if the real type T is signed. */
@ -132,7 +134,11 @@
# define RE_ENABLE_I18N
#endif
#ifdef __GNUC__
#define BE(expr, val) __builtin_expect (expr, val)
#else
#define BE(expr, val) (expr)
#endif
/* Number of ASCII characters. */
#define ASCII_CHARS 0x80

Loading…
Cancel
Save