#! @@AWK@@ -f
BEGIN { 

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

EX    =    "remove corner mark and background from dcl.ps file"

USAGE =  "% dclpsrmcm <file>"

#----------------------------------------------------------------------------
# NO OPTIONS

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

}

/^%%BeginObject: background/ {
    while ($0 != "%%EndObject") getline
    next
}

/^%%BeginObject/ {
    inmark=1
    while (inmark == 1) {
        if ($NF == "M") lastm = $0
        if ($NF == "M" || $NF == "L") {
            if ($1 != 79 && $1 != 7421 && $2 != 0 && $2 != 5300) {
                inmark=0
                print "N"
                if ($NF == "L") print lastm
                print 
            } 
        } else if ($1 != "N" && $1 != "S") {
            print
        }
        getline
    }
}

{
    print
}
