Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Fix hexdump command used for mercurial dirstate parsing



On Oct 30,  5:06pm, Daniel Shahaf wrote:
}
}     setopt localoptions extendedglob
}     local -r -A pad=( $'\0' 0 $'\1' 0 $'\2' 0 $'\3' 0 $'\4' 0 $'\5' 0 $'\6' 0 $'\7' 0 $'\10' 0 $'\11' 0 $'\12' 0 $'\13' 0 $'\14' 0 $'\15' 0 $'\16' 0 $'\17' 0 )
}     REPLY=${(L)val//(#b)(?)/$pad[$match[1]]$(( [##16] ##${match[1]} ))}

I can't help thinking here must be an easier way to do that.

f() {                                              
  setopt localoptions nomultibyte extendedglob
  local val
  read -k $2 -u 0 val <$1
  print -r -- ${(Lj::)${(l:2::0:)${(@s//)val}//(#m)*/$(( [##16] ##$MATCH ))}}
}


-- 
Barton E. Schaefer



Messages sorted by: Reverse Date, Date, Thread, Author