[LWN Logo]

From: Tom Christiansen <tchrist@mox.perl.com>
Subject: TIP: watching for disk overruns
Date: 22 May 1998 13:32:45 GMT

If you're writing a filter that writes to standard output, you
might accidentally fill up the disk and not know it.  One solution 
that doesn't require checking each print statement but still provides
decent error messages and exit status is adding this to your program:

    END { close(STDOUT) || die "can't close stdout: $!" }

--tom
-- 
    I'm sure that that could be indented more readably, but I'm scared of
    the awk parser.             --Larry Wall in <6849@jpl-devvax.JPL.NASA.GOV>