Permalink
Browse files

errno: pass vars correct to awk

  • Loading branch information...
1 parent 5e3aff3 commit f47fc676e5e70cf4b5e60f5f8d7fee9e7220afef @falconindy committed Jan 8, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 errno
View
10 errno
@@ -11,11 +11,17 @@ upper=/usr/include/asm-generic/errno.h
exec 0< <(cat "$base" "$upper")
numeric_to_symbol() {
- awk '/^#define/ && $3 == '"$1"' { printf "%s = '$1'\n",$2; exit 1; }'
+ awk -v "num=$1" '/^#define/ && $3 == num {
+ printf "%s = '$1'\n", $2
+ exit 1
+ }'
}
symbol_to_numeric() {
- awk '/^#define/ && $2 == "'"$1"'" { printf "'$1' = %s\n",$3; exit 1; }'
+ awk -v "sym=$1" '/^#define/ && $2 == sym {
+ printf "'$1' = %s\n", $3
+ exit 1
+ }'
}
perror() {

0 comments on commit f47fc67

Please sign in to comment.