Skip to content
  • Barry Smith's avatar
    Change if () { PetscCall() } three liner and friends to one liners · 1baa6e33
    Barry Smith authored and Satish Balay's avatar Satish Balay committed
    for i in `git ls-files | grep "\.[ch]$"` ; do sed 's?\$?ZZZ?g' $i | tr '\n' '$' | sed 's?\([ ]*\)if (\([-;,.\*+=a-z0-9A-Z_>]*\)) {\$[ ]*PetscCall(\([- ._+=a-z0-9A-Z>*,()]*);\)\$[ ]*}\$?\1if (\2) PetscCall(\3$?g' | tr '$' '\n' | sed 's?ZZZ?$?g' > $i.joe ; mv $i.joe $i  ; done
    
     for i in `git ls-files | grep "\.[hc]$"` ; do sed 's?\$?ZZZ?g' $i | tr '\n' '$' | sed 's?\([ }else]*\)if (\([-;,.\*+=a-z0-9A-Z_>]*\)) {\$[ ]*PetscCall(\([- ._+=a-z0-9A-Z>*,()]*);\)\$\([ ]*\)} \([- ._+=a-z0-9A-Z>*,()]*);\)\$?\1if (\2) PetscCall(\3$\4\5$?g' | tr '$' '\n' | sed 's?ZZZ?$?g' > $i.joe ; mv $i.joe $i  ; done
    
    Yes, really ugly but Barry still cannot master awk
    
    Commit-type: housekeeping
    1baa6e33