1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 23 /* All Rights Reserved */ 24 25 26 /* 27 * Copyright (c) 2001 by Sun Microsystems, Inc. 28 * All rights reserved. 29 */ 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 33 #include "lpsched.h" 34 35 static char cerrbuf[160] = ""; /* fix for bugid 1100252 */ 36 37 38 /** 39 ** cancel() - CANCEL A REQUEST 40 **/ 41 42 int 43 cancel (RSTATUS *prs, int spool) 44 { 45 if (prs->request->outcome & RS_DONE) 46 return (0); 47 48 prs->request->outcome |= RS_CANCELLED; 49 50 if (spool || (prs->request->actions & ACT_NOTIFY)) 51 prs->request->outcome |= RS_NOTIFY; 52 53 if (prs->request->outcome & RS_PRINTING) { 54 terminate(prs->printer->exec); 55 } 56 else if (prs->request->outcome & RS_FILTERING) { 57 terminate (prs->exec); 58 } 59 else if (prs->request->outcome | RS_NOTIFY) { 60 /* start fix for bugid 1100252 */ 61 if (prs->printer->status & PS_REMOTE) { 62 snprintf(cerrbuf, sizeof (cerrbuf), 63 "Remote status=%d, canceled by remote system\n", 64 prs->reason); 65 } 66 notify (prs, cerrbuf, 0, 0, 0); 67 cerrbuf[0] = (char) NULL; 68 /* end fix for bugid 1100252 */ 69 } 70 check_request (prs); 71 72 return (1); 73 } 74