summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-03-27 12:28:49 +0000
committerRoland McGrath <roland@gnu.org>2003-03-27 12:28:49 +0000
commit374d9002ce875dc5ea257fe92c8737cdb9e62b61 (patch)
treefeaff1abb2b58f23aa35171c1dd115518697eefd /scripts
parent15a686af58c659a0c6c336582b9f1f6514a67137 (diff)
downloadglibc-374d9002ce875dc5ea257fe92c8737cdb9e62b61.tar.gz
glibc-374d9002ce875dc5ea257fe92c8737cdb9e62b61.tar.xz
glibc-374d9002ce875dc5ea257fe92c8737cdb9e62b61.zip
Tweak redirection handling in last change.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/abilist.awk40
1 files changed, 23 insertions, 17 deletions
diff --git a/scripts/abilist.awk b/scripts/abilist.awk
index 97266496fd..f30ff5bd56 100644
--- a/scripts/abilist.awk
+++ b/scripts/abilist.awk
@@ -3,9 +3,9 @@
 
 BEGIN {
   if (parse_names)
-    out = "/dev/stderr";
+    defout = "/dev/stderr";
   else
-    out = "/dev/stdout";
+    defout = "/dev/stdout";
 }
 
 # Per-file header.
@@ -62,11 +62,11 @@ $2 == "g" || $2 == "w" && NF == 7 {
     size = "";
   }
   else {
-    print symbol, version, weak, "?", type, $4, $5 >> out;
+    print symbol, version, weak, "?", type, $4, $5 > defout;
     next;
   }
   if (size == " 0x") {
-    print symbol, version, weak, "?", type, $4, $5 >> out;
+    print symbol, version, weak, "?", type, $4, $5 > defout;
     next;
   }
 
@@ -87,20 +87,10 @@ $2 == "g" || $2 == "w" && NF == 7 {
 NF == 0 || /DYNAMIC SYMBOL TABLE/ || /file format/ { next }
 
 {
-  print "Don't grok this line:", $0 >> out
+  print "Don't grok this line:", $0 > defout
 }
 
 function emit(tofile) {
-  if (tofile) {
-    out = prefix soname ".symlist";
-    if (soname in outfiles)
-      out = out "." ++outfiles[soname];
-    else
-      outfiles[soname] = 1;
-  }
-  else
-    out = "/dev/stdout";
-
   nverlist = 0;
   for (version in versions) {
     if (nverslist == 0) {
@@ -129,17 +119,33 @@ function emit(tofile) {
     ++nverslist;
   }
 
+  if (tofile) {
+    out = prefix soname ".symlist";
+    if (soname in outfiles)
+      out = out "." ++outfiles[soname];
+    else
+      outfiles[soname] = 1;
+    printf "" > out;
+  }
+
   split(verslist, order, "\n");
   for (i = 1; i <= nverslist; ++i) {
     version = order[i];
 
-    print version >> out;
-    outpipe = "sort >> " out;
+    if (tofile) {
+      print version >> out;
+      close(out);
+      outpipe = "sort >> " out;
+    }
+    else
+      outpipe = "sort";
     print versions[version] | outpipe;
     close(outpipe);
 
     delete versions[version];
   }
+  for (version in versions)
+    delete versions[version];
 
   if (tofile)
     print "wrote", out, "for", sofullname;