79e6b0e0f6
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>. This patch proposes to then include <zephyr/kernel.h> instead of <zephyr/zephyr.h> since it is more clear that you are including the Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a catch-all header that may be confusing. Most applications need to include a bunch of other things to compile, e.g. driver headers or subsystem headers like BT, logging, etc. The idea of a catch-all header in Zephyr is probably not feasible anyway. Reason is that Zephyr is not a library, like it could be for example `libpython`. Zephyr provides many utilities nowadays: a kernel, drivers, subsystems, etc and things will likely grow. A catch-all header would be massive, difficult to keep up-to-date. It is also likely that an application will only build a small subset. Note that subsystem-level headers may use a catch-all approach to make things easier, though. NOTE: This patch is **NOT** removing the header, just removing its usage in-tree. I'd advocate for its deprecation (add a #warning on it), but I understand many people will have concerns. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no> |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
getopt.c | ||
getopt.h | ||
getopt_common.c | ||
getopt_common.h | ||
getopt_long.c | ||
Kconfig | ||
README |
[GetOpt] ##################### Origin: [Lattera FreeBSD] [https://github.com/lattera/freebsd/blob/master/lib/libc/stdlib/getopt.c] Status: [So far Zephyr samples were using getopt implementation from: argtable3.c.] Purpose: [Shell users would like to parse options passed to the command handler.] Description: [This library is going to be used by the shell module. Some shell users are not satisfied with subcommands alone and need to use the options for commands as well. A library is needed that allows the developer to parse the arguments string, looking for supported options. Typically, this task is accomplished by the getopt function. For this purpose I decided to port the getopt library available in the FreeBSD project. I had to modify it so that it could be used by all instances of the shell at the same time. Originally this function was using global variables which were defining its state. In my implementation I put those variables in a structure and a pointer to that structure is passed as an additional parameter to getopt function. In proposed implementation each shell backend has its own getopt function state structure which it uses. This module is intended to be used inside the shell command handler by the abstraction layer "SHELL_GETOPT". For example: while ((char c = shell_getopt(shell, argc, argv, "abhc:")) != -1) { /* some code */ } ] Dependencies: [This package does not depend on any other component. Zephyr project will only need this component if the user configures a shell module: SHELL_GETOPT.] URL: [https://github.com/lattera/freebsd] commit: [324e4c082c14aebf00f8dbee0fb7ad285393756a] Maintained-by: [External] License: [BSD 3-Clause "New" or "Revised" License] License Link: [BSD 3-Clause used in getopt: https://spdx.org/licenses/BSD-3-Clause.html] [Project license: https://github.com/lattera/freebsd/blob/master/COPYRIGHT]