diff options
Diffstat (limited to '')
-rwxr-xr-x | etc/newsyntax | 64 | ||||
-rwxr-xr-x | etc/newsyntax38 | 71 |
2 files changed, 135 insertions, 0 deletions
diff --git a/etc/newsyntax b/etc/newsyntax new file mode 100755 index 0000000..6b5bb03 --- /dev/null +++ b/etc/newsyntax @@ -0,0 +1,64 @@ +#!/bin/sh +# +# newsyntax -- update a screenrc file from 3.2 to 3.3 syntax +# +# please check all comments after running this script and watch out +# for funny passages. +# +if [ $# != 1 ]; then + echo "usage $0 screenrcfile" + exit 1; +fi + +#Ultrix 4.2 /bin/sh does not handle "read a < $1" +#Dean Gaudet <dgaudet@watdragon.uwaterloo.ca> +exec < $1 +read a + +if [ ."$a" = '.#3.3' ]; then + echo "$1 already updated" + exit 0 +fi + +cp $1 $1.old +echo "#3.3" > $1 +echo "# Do not remove the above line. This screen rc file was updated" >> $1 +echo "# by the newsyntax script." >> $1 +sed < $1.old >> $1 \ +-e 's/\([ #]\)flow/\1defflow/g' \ +-e 's/^flow/defflow/g' \ +-e 's/\([ #]\)set[ ]*defflow/\1flow/g' \ +-e 's/^set[ ]*defflow/flow/g' \ +-e 's/\([ #]\)mode/\1defmode/g' \ +-e 's/^mode/defmode/g' \ +-e 's/\([ #]\)set[ ]*defmode/\1defmode/g' \ +-e 's/^set[ ]*defmode/defmode/g' \ +-e 's/\([ #]\)monitor/\1defmonitor/g' \ +-e 's/^monitor/defmonitor/g' \ +-e 's/\([ #]\)set[ ]*defmonitor/\1monitor/g' \ +-e 's/^set[ ]*defmonitor/monitor/g' \ +-e 's/\([ #]\)login/\1deflogin/g' \ +-e 's/^login/deflogin/g' \ +-e 's/\([ #]\)set[ ]*deflogin/\1login/g' \ +-e 's/^set[ ]*deflogin/login/g' \ +-e 's/\([ #]\)wrap/\1defwrap/g' \ +-e 's/^wrap/defwrap/g' \ +-e 's/\([ #]\)set[ ]*defwrap/\1wrap/g' \ +-e 's/^set[ ]*defwrap/wrap/g' \ +-e 's/\([ #]\)scrollback/\1defscrollback/g' \ +-e 's/^scrollback/defscrollback/g' \ +-e 's/\([ #]\)set[ ]*defscrollback/\1scrollback/g' \ +-e 's/^set[ ]*defscrollback/scrollback/g' \ +-e 's/\([ #]\)refresh/\1allPARtial/g' \ +-e 's/^refresh/allPARtial/g' \ +-e 's/\([ #]\)redraw/\1allPARtial/g' \ +-e 's/^redraw/allPARtial/g' \ +-e 's/\([ #]\)set[ ]*allPARtial/\1PARtial/g' \ +-e 's/^set[ ]*allPARtial/PARtial/g' \ +-e 's/\([ #]\)visualbell/\1vbell/g' \ +-e 's/^visualbell/vbell/g' \ +-e 's/PARtial\([ ]*\)on/partial\1off/g' \ +-e 's/PARtial\([ ]*\)off/partial\1on/g' \ +-e 's/allPARtial/refresh/g' \ +-e 's/^set[ ]//g' + diff --git a/etc/newsyntax38 b/etc/newsyntax38 new file mode 100755 index 0000000..b22850d --- /dev/null +++ b/etc/newsyntax38 @@ -0,0 +1,71 @@ +#! /bin/sh +# +# newsyntax38 -- update a screenrc file from 3.3 to 3.8 syntax +# +# Please bring your scripts up to syntax level 3.3 before running this script. +# Please check all comments after running this script and watch out +# for funny passages. +# +# * aka and shellaka are replaced by title and shelltitle. +# +# * Pairs of termcap and terminfo commands are folded into a single +# termcapinfo command where possible. +# +# * trailing blanks are zapped. Unintentionally. +# +# 12.10.95, jnweiger, use at your own risk. +# +if [ $# != 1 ]; then + echo "usage $0 screenrcfile" + echo "" + echo "The named file will be updated in place to the syntax of screen 3.8" + echo "A backup copy will be written to <screenrcfile>.bak" + exit 1; +fi + +#Ultrix 4.2 /bin/sh does not handle "read a < $1" +#Dean Gaudet <dgaudet@watdragon.uwaterloo.ca> +exec < $1 +read a + +if [ "$a" = "#3.8" ]; then + echo "$1 already updated" + exit 0 +fi + +rm -f $1.old $1.dups + +cp $1 $1.old +echo "#3.8" > $1 +echo "# Do not remove the above line. This screen rc file was updated" >> $1 +echo "# by the newsyntax script." >> $1 + +# termcap and terminfo lines can only be folded when there is no parameter +# expansion in the codes. Parameters are denoted differently in +# termcap and termcap syntax. Everything else is identical, I assume. +# Thus codes not containing '%' can be savely folded. + +sed < $1.old > $1.dups \ +-e 's/^\([ #]*\)aka/\1title/' \ +-e 's/^\([ #]*\)shellaka/\1shelltitle/' \ +-e 's/^\([ #]*\)termcap[ ][ ]*\([^%]*$\)/\1termcapinfo \2/' \ +-e 's/^\([ #]*\)terminfo[ ][ ]*\([^%]*$\)/\1termcapinfo \2/' \ +-e 's/\\/\\\\/g' + +# Oh, my bourne shell seems to gobble backslashes while reading. +# Thus the sed above duplicates them in advance. +# Hope this is not just another silly bash featureism. +# It still zaps trailing blanks. I do not know why. But that is nice. + +exec < $1.dups +while read a ; do + if [ "$a" = "$b" ]; then + case "$a" in + *termcapinfo*) continue ;; + esac + fi + echo "$a" >> $1 + b="$a" +done + +rm -f $1.dups |