bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Proposal: document that getline is a function, not command/statement


From: Denys Vlasenko
Subject: Proposal: document that getline is a function, not command/statement
Date: Wed, 10 Jul 2024 06:30:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0

I *only now* realized that getline is a _function_
and can be part of an expression.

https://www.gnu.org/software/gawk/manual/gawk.html

"getline command" string occurs 21 times.
"getline statement" occurs 2 times.
All examples of its use show it standalone,
not as part of a larger expression, or part of e.g.
a while() statement.

(
I only found people discussing examples of its use
as function in other places, not gawk docs, such as here
https://stackoverflow.com/questions/23596643/what-does-getline-0-in-awk-mean
where "read until EOF/error" idiom is shown:
        while (getline <"FILE" > 0) ...
)

Words "getline function" do occur in gawk.html - just two times.

In manpage, "getline" is under "I/O Statements" together with
real statements, e.g. "print", "next".

Later on manpage, it is called "getline command", not "function".

I propose to change all "getline command"s and "getline statement"s
in docs with "getline function".

Maybe add an example, I like the "while (getline <"FILE" > 0) ..."
thing from stackoverflow.

Thank you.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]