3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-09 21:49:23 +01:00
Commit Graph

61 Commits

Author SHA1 Message Date
James Prestwood
0b68601c10 client: make COLOR_* macros take a string input
The existing color code escape sequences required the user to set the
color, write the string, then unset with COLOR_OFF. Instead the macros
can be made to take the string itself and automatically terminate the
color with COLOR_OFF. This makes for much more concise strings.
2022-07-07 14:09:03 -05:00
James Prestwood
80051f0124 client: add generic display function for table rows
There was no easy to use API for printing the contents of a table, and
was left up to the caller to handle manually. This adds display_table_row
which makes displaying tables much easier, including automatic support
for line truncation and continuation on the next line.

Lines which are too long will be truncated and displayed on the next
line while also taking into account any colored output. This works with any
number of columns.

This removes the need for the module to play games with encoding newlines
and tabs to make the output look nice.

As a start, this functionality was added to the command display.
2022-07-07 14:08:56 -05:00
James Prestwood
a327e3f4d8 client: remove warning on mkdir return
This fixes up a previous commit which breaks iwctl. The
check was added to satisfy static analysis but it ended
up preventing iwctl from starting. In this case mkdir
can fail (e.g. if the directory already exists) and only
if it fails should the history be read. Otherwise a
successful mkdir return indicates the history folder is
new and there is no reason to try reading it.
2021-02-09 14:49:17 -06:00
James Prestwood
17ba7e415b client: check mkdir return in display_init
Printing a warning is about all that we can do at this
point during initialization.
2021-02-08 14:23:15 -06:00
James Prestwood
3f1cd5a596 display: use l_strlcpy to avoid potential overflow
If 'entry' exceeds the length of 'line' we could overflow. Instead
use l_strlcpy and pass in the remaining amount of data left in
the buffer.
2021-02-08 14:23:04 -06:00
James Prestwood
8539c7aa9e client: remove display_dictionary
This has been replaced by diagnostic_display
2021-01-22 15:02:54 -06:00
James Prestwood
9ac59700d1 client: implement display_dictionary
This takes a Dbus iterator which has been entered into a
dictionary and prints out each key and value. It requires
a mapping which maps keys to types and units. For simple
cases the mapping will consist of a dbus type character
and a units string, e.g. dBm, Kbit/s etc. For more complex
printing which requires processing the value the 'units'
void* cant be set to a function which can be custom written
to handle the value.
2021-01-21 13:48:43 -06:00
Ronan Pigott
0193940e50 client: ignore control sequence length in prompt
Readline uses the characters \001 and \002 to mark the start and end
of zero-length character sequnces in the prompt before prompt
expansion. Without these characters the input point can become offset
from the visual end of the prompt when performing some actions.
2020-12-09 09:40:40 -06:00
Tim Kourt
5d68fbd55f client: Automate display refresh enablement
The display refresh is automatically enabled or disabled depending on
the width of the window. This allows to avoid the incorrect display on
refresh for the small windows.
2020-04-08 21:01:27 -05:00
Tim Kourt
9eeaedf189 client: Rename window change signal for clarity 2020-04-08 21:01:18 -05:00
Tim Kourt
36f962a4f0 client: Rephrase the wait messages 2020-04-08 16:14:29 -05:00
Tim Kourt
61e8a640b1 client: Rewrite workaround for readline
Instead of calling display(""), explicitly use the sequence of
commands to force readline to properly update its internal state
and re-display the prompt.
2020-04-08 16:13:45 -05:00
Marcel Holtmann
d3e00d7f0f client: Use XDG_DATA_HOME for history file if available 2019-12-13 09:33:19 +01:00
Marcel Holtmann
89e476d992 client: Use include path from top source directory 2019-12-13 09:02:42 +01:00
Tim Kourt
f20298dc4a client: Update rl_point to last known position
Keep cursor's position consistent when passphrase is reaching
its maximum by adding characters in the middle of the string

The use case is very rare as not many people will attempt to
modify the masked passphrase from the middle.
2019-10-29 18:17:33 -05:00
Tim Kourt
17ee4196f4 client: Increase passphrase buffer to accommodate for nil byte 2019-10-29 18:17:33 -05:00
Tim Kourt
37e6f6f08b client: Cancel agent prompt with CTRL+D
Previously, CTRL+D used to cause termination of the client. Now, the
command will cancel the agent’s prompts in agent mod. In regular mode
the behavior is unchanged.
2019-10-28 14:57:19 -05:00
Marcel Holtmann
152b56a12a treewide: Move the Intel copyright forward to 2019 2019-10-25 00:43:08 +02:00
Tim Kourt
ea0fc68597 client: Check family name before comparison 2019-10-23 17:59:41 -05:00
Tim Kourt
df32279a31 client: Enable non-interactive mode support for agent prompts 2019-09-02 16:12:37 -05:00
Tim Kourt
ebad9bf9be client: Enhance secret masking
Due to the changed IO behavior, pasting of the secrets
into the agent prompt became impossible. The reimplemented
logic allows to add (paste) an arbitrary number of characters
into a desired position of a secret string up to its max lengths.
The deletion has also been reworked to accommodate the new behavior.
2019-08-27 13:25:14 -05:00
Tim Kourt
44fcb2b1d7 client: Preserve command history in between the instances
This also limits the number of entries in history to 24.
2019-08-27 10:30:01 -05:00
Tim Kourt
09f454b19f client: Refactor error message formating 2019-08-15 15:06:59 -05:00
Tim Kourt
34800bfa63 client: Enable word completion for the SSIDs with spaces
"I--> results in "IWD 1"
2019-07-23 17:20:39 -05:00
Tim Kourt
3d0f1dae12 client: Remove 'quit' message 2019-04-09 00:04:47 -05:00
Jason Phan
25823752b3 client: Fix prompt masking
Entering 23 characters at a prompt resulted in 9 extra characters being
added to the line. At this point, you would only be abel to backspace
until the 9th character.

It seems that claling both rl_replace_line("", 0) and rl_redisplay()
before rl_replace_line(masked_input.mask, 0) causes this to happen. Both
calls are redundant anyways as iwctl functions exactly the same without
them (plus no more bug).
2019-03-21 16:16:59 -05:00
Tim Kourt
a7c28c4977 client: Fix display of the quoted params 2018-11-12 10:37:19 -06:00
Tim Kourt
7df4f2e86b client: Fix display refresh after agent prompt
The line count was one line off after the Agent prompt, thus making
the command output to scroll up on each refresh.
2018-11-12 10:36:58 -06:00
Tim Kourt
67f245a497 client: Fix argv for display refresh 2018-11-09 11:34:43 -06:00
Marcel Holtmann
63bafa7adf client: Fix includes for using with -std=c99 compiler option 2018-11-01 22:19:45 +01:00
Marcel Holtmann
72a64fa7fb build: Adjust to the latest ELL signal API changes 2018-11-01 22:09:19 +01:00
Andrew Zaborowski
558341a689 client: Fix two format strings 2018-11-01 15:04:56 -05:00
Tim Kourt
ce4a272186 client: move static array inits out of display_init() 2018-08-03 14:42:04 -05:00
Andrew Zaborowski
f6aa2c7236 client: Fix comparing current prompt against previous
We'd add the new command propmpt to history if it was different from
what current_history() returned which may not be the last command
executed, so we'd possibly add multiple identical commands to history
and skip some that were new.  Instead compare against
history_get(last index).
Also remove an always-true part of the condition on the next line.
2018-08-01 09:32:00 -05:00
Tim Kourt
e3737fd44e client: fix mem leak after arg parsing 2018-07-30 13:18:35 -05:00
Denis Kenzior
67e590cfeb client: Utilize l_parse_args 2018-07-30 08:59:55 -05:00
Tim Kourt
bb4df24fc5 client: workaround for readline prompt setting issue 2018-05-31 19:40:22 -05:00
Tim Kourt
0716334e61 client: Enable agent to control its prompt 2018-05-04 19:37:38 -05:00
Tim Kourt
394e274f5f client: mask passphrase input 2018-05-03 16:34:26 -05:00
Tim Kourt
2817aeb35d client: disable cmd completion for the agent prompt 2018-05-03 16:00:23 -05:00
Tim Kourt
af14445509 client: add agent prompt to display 2018-05-03 16:00:23 -05:00
Tim Kourt
8071b51168 client: do display quit on exit 2017-06-09 14:08:21 -05:00
Tim Kourt
3bfbe72e33 client: Disable cmd refresh on console resize 2017-06-09 14:08:21 -05:00
Tim Kourt
2fb671e0d4 client: add flashing indicator for the updatable tables 2017-06-09 14:08:21 -05:00
Tim Kourt
305af40636 client: fix display completion leak 2017-05-12 17:46:44 -05:00
Tim Kourt
1fed159f4a client: fix leaks 2017-05-12 14:38:03 -05:00
Tim Kourt
b2ea962a67 client: remove unused function 2017-04-28 15:02:15 -05:00
Tim Kourt
e2a81248df client: Display handler for the completion candidates 2017-04-26 18:48:53 -05:00
Tim Kourt
0c64cc226a client: Handle empty entity field 2017-04-26 14:36:25 -05:00
Tim Kourt
f53cb22b7e client: Add display refresh 2017-04-21 12:56:46 -05:00