Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gawk -> awk #1

Open
Veraellyunjie opened this issue Feb 7, 2023 · 2 comments
Open

gawk -> awk #1

Veraellyunjie opened this issue Feb 7, 2023 · 2 comments

Comments

@Veraellyunjie
Copy link

First of all, I applause to you as catless is really missed in standard distributions and you fill the gap.

I tried catless via OpenBSD's awk which I don't know which awk flavor it is - but it definitely is not gawk - and it seems to work. So I'd like to ask you whether you target gawk or whether you target most awk flavors and whether you think it is reasonable and already safe to change the shebang to widely available #!/usr/bin/awk -f

@NikitaIvanovV
Copy link
Owner

Sorry for a long response.

I use PROCINFO variable here:

catless/catless

Lines 15 to 16 in 4ad51f9

# Don't raise fatal error when pager is exited
PROCINFO[pager, "NONFATAL"] = 1

And the GAWK manual says it's specific to GAWK:

https://www.gnu.org/software/gawk/manual/html_node/Auto_002dset.html#index-differences-in-awk-and-gawk-37

I added that line because I remember that less did not work as expected if it's exited it with the q key and the whole file has not been buffered yet. You can reproduce it by running git log | catless. Make sure to run it in a repo that has a rather long history of commits.

@NikitaIvanovV
Copy link
Owner

NikitaIvanovV commented Mar 11, 2023

I just discovered that my fix has an undesirable side effect: if you run a command that takes a long time to finish (something like seq 10000), after quitting less, catless will still keep on going.

In the previous message, by "unexpected behavior" I meant they GAWK printer a fatal error message. But perhaps it's better than what we have know? Or maybe it's easier to rewrite catless in C? 😅 This way both problems will be easily fixed.

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

No branches or pull requests

2 participants