Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

errno: pass vars correct to awk

  • Loading branch information...
commit f47fc676e5e70cf4b5e60f5f8d7fee9e7220afef 1 parent 5e3aff3
Dave Reisner authored January 08, 2012

Showing 1 changed file with 8 additions and 2 deletions. Show diff stats Hide diff stats

  1. 10  errno
10  errno
@@ -11,11 +11,17 @@ upper=/usr/include/asm-generic/errno.h
11 11
 exec 0< <(cat "$base" "$upper")
12 12
 
13 13
 numeric_to_symbol() {
14  
-  awk '/^#define/ && $3 == '"$1"' { printf "%s = '$1'\n",$2; exit 1; }'
  14
+  awk -v "num=$1" '/^#define/ && $3 == num {
  15
+    printf "%s = '$1'\n", $2
  16
+    exit 1
  17
+  }'
15 18
 }
16 19
 
17 20
 symbol_to_numeric() {
18  
-  awk '/^#define/ && $2 == "'"$1"'" { printf "'$1' = %s\n",$3; exit 1; }'
  21
+  awk -v "sym=$1" '/^#define/ && $2 == sym {
  22
+    printf "'$1' = %s\n", $3
  23
+    exit 1
  24
+  }'
19 25
 }
20 26
 
21 27
 perror() {

0 notes on commit f47fc67

Please sign in to comment.
Something went wrong with that request. Please try again.