#! @@AWK@@ -f
BEGIN { 

ID    =    "cdclpsunrot 1.0"
DATE  =                               "95/03/19(numaguti)" 

EX    =    "un-rotate dcl.ps file"

USAGE =  "% cdclpsunrot <file>"

#----------------------------------------------------------------------------
# NO OPTION

    if (ARGV[1] == "-help" || ARGV[1] == "help") { 
        print "  " ID,DATE
        print " --- " EX
        print " usage : " USAGE
        exit
    }
}

/^%%Orientation: Landscape/ {
     print "%%Orientation: Portrait"
     next
}

/^%%Orientation: Portrait/ {
    print "%%Orientation: Landscape"
    next
}

/^%%BoundingBox/ {
    print "%%BoundingBox: 31 43 563 795"
    next
}

/concat$/ {
    print "[ 0.0 0.1 -0.1 0.0 562 44 ] concat"
    next
}
/^%.*translate$/ {
    sub("% *",""); print
    next
}
/^%.*rotate$/ {
    sub("% *",""); print
    next
}
/^\/P1/ {
    $1=""; print "/P3" $0
    next
}
/^\/P2/ {
    $1=""; print "/P4" $0
    next
}
/^\/P3/ {
    $1=""; print "/P1" $0
    next
}
/^\/P4/ {
    $1=""; print "/P2" $0
    next
}

{
    print
}
