Unix Technical Forum

awk: ignore SIGPIPE

This is a discussion on awk: ignore SIGPIPE within the lucky.openbsd.tech forums, part of the OpenBSD category; --> Hi, IMHO, awk(1) should ignore SIGPIPE. Currently, if awk(1) get's a SIGPIPE when writing to a pipe, it just ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > lucky.openbsd.tech

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-22-2008, 12:16 PM
Matthias Kilian
 
Posts: n/a
Default awk: ignore SIGPIPE

Hi,

IMHO, awk(1) should ignore SIGPIPE. Currently, if awk(1) get's a
SIGPIPE when writing to a pipe, it just dies. With the patch below,
it dies, too, but at least you get a reasonable error message.

diff -x CVS -rNu ../awk.orig/main.c ./main.c
--- ../awk.orig/main.c Thu Dec 30 14:06:17 2004
+++ ./main.c Wed Mar 29 15:05:20 2006
@@ -69,6 +69,7 @@
exit(1);
}
signal(SIGFPE, fpecatch);
+ signal(SIGPIPE, SIG_IGN);
yyin = NULL;
symtab = makesymtab(NSYMTAB);
while (argc > 1 && argv[1][0] == '-' && argv[1][1] != '\0') {


Sample awk script:

#!/usr/bin/awk -f
BEGIN {
for (i = 0; i < 32768; i++)
print "" | "./foo"
x = close("./foo")
print x
}


Matching "foo":

#!/bin/sh
echo foo


Any Comments?


Ciao,
Kili

ps: I've some more diffs to awk(1) around, but I first have to sort
out what's usable and what is junk or still incomplete.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:13 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com