Skip to content

stty: Finish '--save' support#5054

Merged
tertsdiepraam merged 1 commit intouutils:mainfrom
dezgeg:stty-save
Jul 8, 2023
Merged

stty: Finish '--save' support#5054
tertsdiepraam merged 1 commit intouutils:mainfrom
dezgeg:stty-save

Conversation

@dezgeg
Copy link
Contributor

@dezgeg dezgeg commented Jul 7, 2023

Argument parsing for this exists, but the option doesn't change output in any way. Finish the support.

Closes #3862.

I haven't found any documentation on the format of this or looked at any code, but it would appear to be simple hex printing of some (not all) struct termios fields:

$ cat termiostest.c
#include <stdio.h>
#include <termios.h>

int main() {
    struct termios t;
    tcgetattr(0, &t);
    while (1)
        ;
}
$ gcc -g termiostest.c
$ gdb ./a.out
(gdb) run
(gdb) p/x t
$1 = {c_iflag = 0x100, c_oflag = 0x5, c_cflag = 0xbf, c_lflag = 0x8a3b, c_line = 0x0, c_cc = {0x3, 0x1c, 0x7f, 0x15, 0x4, 0x0, 0x1, 0x0, 0x11, 0x13, 0x1a, 0x0, 0x12, 0xf, 0x17, 0x16, 0x0 <repeats 16 times>},
  c_ispeed = 0xf, c_ospeed = 0xf}
$ stty --save
100:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

Argument parsing for this exists, but the option doesn't change output
in any way. Finish the support.

Closes uutils#3862
@github-actions
Copy link

github-actions bot commented Jul 8, 2023

GNU testsuite comparison:

Skipping an intermittent issue tests/tail-2/inotify-dir-recreate

@tertsdiepraam
Copy link
Collaborator

Nice! Yeah I couldn't find any docs either, that's why I left it out of my original implementation. This looks good though :)

Copy link
Collaborator

@tertsdiepraam tertsdiepraam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should set up some way to test stty too, but that's out of scope for this PR. On my local machine, the output seems to match up with GNU. Great work!

@tertsdiepraam tertsdiepraam merged commit d969bff into uutils:main Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stty: Implement --save / -g

2 participants