subsys shell devmem_service: Fix includes

* The include for the host libC should be guarded with
  using the host libC instead of the POSIX arch, as this
  supports other C libraries.
* This code uses getopt, which is an extension to the
  C library. Let's explicity select one of the extensions
  which includes it instead of relaying on somebody having
  set it for this file somewhere else.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2023-12-28 12:11:32 +01:00 committed by Anas Nashif
parent d4967b086a
commit 06f15fcc36
1 changed files with 7 additions and 4 deletions

View File

@ -6,15 +6,18 @@
* SPDX-License-Identifier: Apache-2.0
*/
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
#include <zephyr/device.h>
#include <zephyr/shell/shell.h>
#include <zephyr/sys/byteorder.h>
#ifdef CONFIG_ARCH_POSIX
#ifdef CONFIG_NATIVE_LIBC
#include <unistd.h>
#else
#include <zephyr/posix/unistd.h>
#endif
#include <zephyr/device.h>
#include <zephyr/shell/shell.h>
#include <zephyr/sys/byteorder.h>
static inline bool is_ascii(uint8_t data)
{