diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2020-09-09 10:51:24 +0200 |
---|---|---|
committer | Olivier Fourdan <fourdan@gmail.com> | 2021-01-29 12:52:09 +0000 |
commit | 3cdac5ba07a79761652d960e0e907601f82718bc (patch) | |
tree | 459b3da7c79d56029c10fe0c02a4bf3dd25843ad /mi | |
parent | a81c98e42a954580ca0d43c89169dc2069c87b96 (diff) | |
download | xserver-3cdac5ba07a79761652d960e0e907601f82718bc.tar.gz |
mi: List extensions in usage message
Not all extensions can be enabled or disabled at runtime, list the
extensions which can from the help message rather than on error only.
v2:
* Print the header message in the ListStaticExtensions() (Peter
Hutterer)
* Do not export ListStaticExtensions() as Xserver API
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Diffstat (limited to 'mi')
-rw-r--r-- | mi/miinitext.c | 26 | ||||
-rw-r--r-- | mi/miinitext.h | 83 |
2 files changed, 101 insertions, 8 deletions
diff --git a/mi/miinitext.c b/mi/miinitext.c index 358d485b3..8cb26d0c4 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -107,6 +107,8 @@ SOFTWARE. #include "os.h" #include "globals.h" +#include "miinitext.h" + /* List of built-in (statically linked) extensions */ static const ExtensionModule staticExtensions[] = { {GEExtensionInit, "Generic Event Extension", &noGEExtension}, @@ -182,6 +184,21 @@ static const ExtensionModule staticExtensions[] = { #endif }; +void +ListStaticExtensions(void) +{ + const ExtensionModule *ext; + int i; + + ErrorF(" Only the following extensions can be run-time enabled/disabled:\n"); + for (i = 0; i < ARRAY_SIZE(staticExtensions); i++) { + ext = &staticExtensions[i]; + if (ext->disablePtr != NULL) { + ErrorF("\t%s\n", ext->name); + } + } +} + Bool EnableDisableExtension(const char *name, Bool enable) { @@ -227,14 +244,7 @@ EnableDisableExtensionError(const char *name, Bool enable) if (enable == FALSE) return; } - ErrorF("[mi] Only the following extensions can be run-time %s:\n", - enable ? "enabled" : "disabled"); - for (i = 0; i < ARRAY_SIZE(staticExtensions); i++) { - ext = &staticExtensions[i]; - if (ext->disablePtr != NULL) { - ErrorF("[mi] %s\n", ext->name); - } - } + ListStaticExtensions(); } static ExtensionModule *ExtensionModuleList = NULL; diff --git a/mi/miinitext.h b/mi/miinitext.h new file mode 100644 index 000000000..a1ceb9aa8 --- /dev/null +++ b/mi/miinitext.h @@ -0,0 +1,83 @@ +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * Copyright (c) 2000 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#ifndef MIINITEXT_H +#define MIINITEXT_H + +void ListStaticExtensions(void); + +#endif /* MIINITEXT_H */ |