#! @@AWK@@ -f
BEGIN { 

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

EX    =    "rotate dcl.ps file"

USAGE =  "% dclpsrot <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: -1 -1 751 531"
    next
}

/concat$/ {
    print "[ 0.1 0 0 0.1 0 0 ] concat"
    next
}
/translate/ {
    print "% " $0
    next
}
/rotate/ {
    print "% " $0
    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
}
