mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 20:24:35 +03:00
Use a platform-specific routine for long option usage
Related to https://github.com/htop-dev/htop/pull/564
This commit is contained in:
@ -846,6 +846,20 @@ void Platform_getBattery(double* percent, ACPresence* isOnAC) {
|
||||
Platform_Battery_cacheTime = now;
|
||||
}
|
||||
|
||||
void Platform_longOptionsUsage(const char* name)
|
||||
{
|
||||
#ifdef HAVE_LIBCAP
|
||||
printf(
|
||||
" --drop-capabilities[=none|basic|strict] Drop Linux capabilities when running as root\n"
|
||||
" none - do not drop any capabilities\n"
|
||||
" basic (default) - drop all capabilities not needed by %s\n"
|
||||
" strict - drop all capabilities except those needed for\n"
|
||||
" core functionality\n", name);
|
||||
#else
|
||||
(void) name;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Platform_getLongOption(int opt, int argc, char** argv) {
|
||||
#ifndef HAVE_LIBCAP
|
||||
(void) argc;
|
||||
|
@ -27,19 +27,6 @@ in the source distribution for its full text.
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBCAP
|
||||
#define PLATFORM_LONG_OPTIONS \
|
||||
{"drop-capabilities", optional_argument, 0, 128},
|
||||
#define PLATFORM_LONG_OPTIONS_USAGE \
|
||||
" --drop-capabilities[=none|basic|strict] Drop Linux capabilities when running as root\n" \
|
||||
" none - do not drop any capabilities\n" \
|
||||
" basic (default) - drop all capabilities not needed by htop\n" \
|
||||
" strict - drop all capabilities except those needed for core functionality\n"
|
||||
#else
|
||||
#define PLATFORM_LONG_OPTIONS
|
||||
#define PLATFORM_LONG_OPTIONS_USAGE
|
||||
#endif
|
||||
|
||||
|
||||
extern const ProcessField Platform_defaultFields[];
|
||||
|
||||
@ -95,6 +82,15 @@ static inline void Platform_getRelease(char** string) {
|
||||
*string = Generic_uname();
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBCAP
|
||||
#define PLATFORM_LONG_OPTIONS \
|
||||
{"drop-capabilities", optional_argument, 0, 128},
|
||||
#else
|
||||
#define PLATFORM_LONG_OPTIONS
|
||||
#endif
|
||||
|
||||
void Platform_longOptionsUsage(const char* name);
|
||||
|
||||
bool Platform_getLongOption(int opt, int argc, char** argv);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user