awk: manpage correction

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

awk: manpage correction

Matthias Kilian
This describes return value of cmd | getline [var] and the behaviour
of fflush() without arguments[1].


diff -x CVS -rNu ../awk.orig/awk.1 ./awk.1
--- ../awk.orig/awk.1 Fri May 13 20:55:02 2005
+++ ./awk.1 Wed Mar 29 15:45:26 2006
@@ -610,9 +610,14 @@
 will read subsequent records from the stream.
 The stream remains open until explicitly closed with a call to
 .Fn close .
-.It Fn fflush expr
+.Ic getline
+returns 1 for a successful input, 0 for end of file, and \-1 for an error.
+.It Fn fflush [expr]
 Flushes any buffered output for the file or pipe
-.Fa expr .
+.Fa expr
+or all open files or pipes if
+.Fa expr
+is omitted.
 .Fa expr
 should match the string that was used to open the file or pipe.
 .It Ic getline


Ciao,
        Kili

[1] on awk's fflush(): in run.c, the function flush_all(void)
obsolete; all calls to it could be replaced by fflush(NULL). I'll
try to rip of a separate patch for this from my current patch chaos.

Reply | Threaded
Open this post in threaded view
|

awk: nuke flush_all() (was: awk: manpage correction)

Matthias Kilian
On Wed, Mar 29, 2006 at 03:54:52PM +0200, Matthias Kilian wrote:
> [1] on awk's fflush(): in run.c, the function flush_all(void)
> obsolete; all calls to it could be replaced by fflush(NULL). I'll
> try to rip of a separate patch for this from my current patch chaos.

Here it is (actually, there's only one call to flush_all()).  Any
comments?

Ciao,
        Kili

diff -x CVS -rNu ../awk.orig/run.c ./run.c
--- ../awk.orig/run.c Fri Oct 21 21:21:03 2005
+++ ./run.c Wed Mar 29 16:06:18 2006
@@ -92,7 +92,6 @@
 Node *curnode = NULL; /* the node being executed, for debugging */
 
 void stdinit(void);
-void flush_all(void);
 
 /* buffer memory management */
 int adjbuf(char **pbuf, int *psiz, int minlen, int quantum, char **pbptr,
@@ -1545,7 +1544,7 @@
  return x;
  case FFLUSH:
  if (isrec(x) || strlen(getsval(x)) == 0) {
- flush_all(); /* fflush() or fflush("") -> all */
+ fflush(NULL); /* fflush() or fflush("") -> all */
  u = 0;
  } else if ((fp = openfile(FFLUSH, getsval(x))) == NULL)
  u = EOF;
@@ -1736,15 +1735,6 @@
  WARNING( "i/o error occurred while closing %s", files[i].fname );
  }
  }
-}
-
-void flush_all(void)
-{
- int i;
-
- for (i = 0; i < FOPEN_MAX; i++)
- if (files[i].fp)
- fflush(files[i].fp);
 }
 
 void backsub(char **pb_ptr, char **sptr_ptr);

Reply | Threaded
Open this post in threaded view
|

Re: awk: manpage correction

Jason McIntyre-2
In reply to this post by Matthias Kilian
On Wed, Mar 29, 2006 at 03:54:52PM +0200, Matthias Kilian wrote:

> This describes return value of cmd | getline [var] and the behaviour
> of fflush() without arguments[1].
>
>
> diff -x CVS -rNu ../awk.orig/awk.1 ./awk.1
> --- ../awk.orig/awk.1 Fri May 13 20:55:02 2005
> +++ ./awk.1 Wed Mar 29 15:45:26 2006
> @@ -610,9 +610,14 @@
>  will read subsequent records from the stream.
>  The stream remains open until explicitly closed with a call to
>  .Fn close .
> -.It Fn fflush expr
> +.Ic getline
> +returns 1 for a successful input, 0 for end of file, and \-1 for an error.
> +.It Fn fflush [expr]
>  Flushes any buffered output for the file or pipe
> -.Fa expr .
> +.Fa expr
> +or all open files or pipes if
> +.Fa expr
> +is omitted.
>  .Fa expr
>  should match the string that was used to open the file or pipe.
>  .It Ic getline
>

fixed, thanks.
jmc