Commit Graph

26 Commits

Author SHA1 Message Date
James Prestwood 69e9945ef7 device: command: remove default device concept
There was quite a bit of framework behind setting/resetting a default
device, which is now no longer needed.
2022-08-11 15:47:20 -05:00
James Prestwood 9aefec6124 client: allow entity name to be passed to completion
There is a limitation of libreadline where no context/userdata
can be passed to completion functions. Thi affects iwctl since
the entity value isn't known to completion functions.

Workarounds such as getting the default device are employed but
its not a great solution.

Instead hack around this limitation by parsing the prompt to
extract the entity (second arg). Then use a generic match function
given to readline which can call the actual match function and
include the entity.
2022-08-11 15:47:02 -05:00
Fangrui Song fa1c12453b build: treewide: Set retain attribute
LLD 13 and GNU ld 2.37 support -z start-stop-gc which allows garbage
collection of C identifier name sections despite the __start_/__stop_
references. GNU ld before 2015-10 had the behavior as well. Simply set
the retain attribute so that GCC 11 (if configure-time binutils is 2.36
or newer)/Clang 13 will set the SHF_GNU_RETAIN section attribute to
prevent garbage collection.

Without the patch, there are linker errors with -z start-stop-gc
(LLD default) when -Wl,--gc-sections is used:

```
ld.lld: error: undefined symbol: __start___eap
>>> referenced by eap.c
>>>               src/eap.o:(eap_init)
```

The remain attribute will not be needed if the metadata sections are
referenced by code directly.
2021-11-11 14:27:33 -06:00
Tim Kourt 8d73480d99 client: Separate command option words by dash 2019-10-29 12:48:17 -05:00
Marcel Holtmann 152b56a12a treewide: Move the Intel copyright forward to 2019 2019-10-25 00:43:08 +02:00
Tim Kourt 19529a4d3a client: Don't register agent without a need
Register agent iff no '--dontask' command-line option has been provided
or there are some other command line options besides '--dontask'
2019-09-19 12:36:12 -05:00
Tim Kourt 411834e089 client: Remove unused API 2019-09-19 12:36:12 -05:00
Tim Kourt 62d286a745 client: Add '--dontask' command-line option
This option prevents iwctl from prompting user for the secrets
if they were not provided as the command-line arguments.
2019-09-19 11:26:19 -05:00
Tim Kourt 0a1cd37228 client: Enable lookup of command options with no arguments.
Previously, command_option_get used to return NULL in the following
two scenarios: when command-line option with a such name didn’t exists
or its argument was not provided. This worked great for the cmd-line
options with the required arguments. With introduction of the cmd-line
options with no or optional arguments the function was changed to return
a boolean value indicating the existence of a such option and then, if
it had an argument - value_out variable would have been set.

Thereafter, this patch modifies the current usages of command_option_get.
Note, in these particular applications of command_option_get there is no
need to check the returned value from command_option_get, since these
options have the required arguments and we can only check if the value_out
parameter has been set or not.
2019-09-19 11:25:53 -05:00
Tim Kourt 6d31c9313f client: Introduce command options
Enable parsing of the command-line options by the command module.
The parsed command-line option values are stored in command_options
list and made available through the module’s public API:
command_option_get – allows querying options by name,
command_has_options – checks existence of the options.
2019-08-15 15:06:59 -05:00
Tim Kourt f1dd6b1084 client: Fix network name completion after restart of iwd
Previously, on service disappeared event the list of the known
proxy objects was cleared, but pointers to the default entity
per command family wasn’t reset. Reset default entities for
the command families to remove the dead pointers to the deleted
proxy objects.

==1325== Invalid read of size 8
==1325==    at 0x4055D4: proxy_interface_is_same (dbus-proxy.c:439)
==1325==    by 0x407C28: match_by_partial_name (network.c:220)
==1325==    by 0x40547C: proxy_interface_find_all (dbus-proxy.c:424)
==1325==    by 0x405592: proxy_property_str_completion (dbus-proxy.c:153)
==1325==    by 0x407DA9: network_name_completion (network.c:241)
==1325==    by 0x4E596D5: rl_completion_matches (in /usr/lib64/libreadline.so.7.0)
2019-07-18 23:37:54 -05:00
Tim Kourt 1d931d8a68 client: add noninteractive support for cmds 2018-08-06 12:42:03 -05:00
Tim Kourt 2ba4efe39e client: add new command statuses
Split CMD_STATUS_OK into CMD_STATUS_DONE and CMD_STATUS_TRIGGERED.
The split is necessary for the enablement of noninteractive mode.
2018-08-06 12:32:22 -05:00
Denis Kenzior 67e590cfeb client: Utilize l_parse_args 2018-07-30 08:59:55 -05:00
Tim Kourt c5cf3b083f client: add cmd line token finder
This allows to inspect the cmd line for the existence of a provided
token. This enables the completers to look back to what was entered
before them and make decisions based on that information. For
example, this can be used in completion of the property values
to identify the property for which the value is being completed.
2018-07-25 11:47:10 -05:00
Tim Kourt fd23c87110 client: define default entity setter for cmd families 2018-05-31 19:30:44 -05:00
Tim Kourt bfbffa1111 client: Add 'forget' cmd for known network 2017-04-26 14:36:25 -05:00
Tim Kourt e0117febd5 client: Introduce cmd execution status 2017-04-26 14:36:25 -05:00
Tim Kourt 02b52adf61 client: Entity argument completion 2017-04-21 12:56:46 -05:00
Tim Kourt c85ea2f924 client: Command family argument completion 2017-04-21 12:56:46 -05:00
Tim Kourt 34797796ed client: Introduce command completion 2017-04-21 12:56:46 -05:00
Tim Kourt 6c2eae6999 client: Add COMMAND_FAMILY 2017-04-13 13:21:19 -05:00
Tim Kourt dcf2a0cae5 client: Implement command execution 2017-04-13 13:20:58 -05:00
Tim Kourt 17569c8d8b client: define basic command ops 2017-04-12 15:32:17 -05:00
Tim Kourt 4fc6a3038a client: Allow command registration 2017-04-11 16:48:15 -05:00
Tim Kourt db679448bc client: Introduce command files
The purpose of these files is to encapsulate all of
the command processing functionality
2017-04-11 16:48:15 -05:00