xref: /onnv-gate/usr/src/cmd/lp/lib/printers/freeprinter.c (revision 3125:084bca4d4623)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*3125Sjacobs  * Common Development and Distribution License (the "License").
6*3125Sjacobs  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
21*3125Sjacobs 
22*3125Sjacobs /*
23*3125Sjacobs  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*3125Sjacobs  * Use is subject to license terms.
25*3125Sjacobs  */
26*3125Sjacobs 
270Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
280Sstevel@tonic-gate /*	  All Rights Reserved  	*/
290Sstevel@tonic-gate 
300Sstevel@tonic-gate 
31*3125Sjacobs #pragma ident	"%Z%%M%	%I%	%E% SMI"
320Sstevel@tonic-gate /* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #include "sys/types.h"
350Sstevel@tonic-gate #include "stdlib.h"
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #include "lp.h"
380Sstevel@tonic-gate #include "printers.h"
39*3125Sjacobs #include <syslog.h>
400Sstevel@tonic-gate 
410Sstevel@tonic-gate /**
420Sstevel@tonic-gate  **  freeprinter() - FREE MEMORY ALLOCATED FOR PRINTER STRUCTURE
430Sstevel@tonic-gate  **/
440Sstevel@tonic-gate 
freeprinter(pp)450Sstevel@tonic-gate void			freeprinter (pp)
460Sstevel@tonic-gate 	PRINTER			*pp;
470Sstevel@tonic-gate {
480Sstevel@tonic-gate 	if (!pp)
490Sstevel@tonic-gate 		return;
50*3125Sjacobs 
51*3125Sjacobs 	syslog(LOG_DEBUG, "freeprinter(%s)", pp->name ? pp->name : "");
520Sstevel@tonic-gate 	if (pp->name)
530Sstevel@tonic-gate 		Free (pp->name);
540Sstevel@tonic-gate 	if (pp->char_sets)
550Sstevel@tonic-gate 		freelist (pp->char_sets);
560Sstevel@tonic-gate 	if (pp->input_types)
570Sstevel@tonic-gate 		freelist (pp->input_types);
58*3125Sjacobs 	if (pp->options)
59*3125Sjacobs 		freelist (pp->options);
600Sstevel@tonic-gate 	if (pp->device)
610Sstevel@tonic-gate 		Free (pp->device);
620Sstevel@tonic-gate 	if (pp->dial_info)
630Sstevel@tonic-gate 		Free (pp->dial_info);
640Sstevel@tonic-gate 	if (pp->fault_rec)
650Sstevel@tonic-gate 		Free (pp->fault_rec);
660Sstevel@tonic-gate 	if (pp->interface)
670Sstevel@tonic-gate 		Free (pp->interface);
680Sstevel@tonic-gate 	if (pp->printer_type)
690Sstevel@tonic-gate 		Free (pp->printer_type);
700Sstevel@tonic-gate 	if (pp->remote)
710Sstevel@tonic-gate 		Free (pp->remote);
720Sstevel@tonic-gate 	if (pp->speed)
730Sstevel@tonic-gate 		Free (pp->speed);
740Sstevel@tonic-gate 	if (pp->stty)
750Sstevel@tonic-gate 		Free (pp->stty);
760Sstevel@tonic-gate 	if (pp->description)
770Sstevel@tonic-gate 		Free (pp->description);
780Sstevel@tonic-gate 	if (pp->fault_alert.shcmd)
790Sstevel@tonic-gate 		Free (pp->fault_alert.shcmd);
800Sstevel@tonic-gate #if	defined(CAN_DO_MODULES)
810Sstevel@tonic-gate 	if (pp->modules)
820Sstevel@tonic-gate 		freelist (pp->modules);
830Sstevel@tonic-gate #endif
840Sstevel@tonic-gate 	if (pp->printer_types)
850Sstevel@tonic-gate 		freelist (pp->printer_types);
86*3125Sjacobs 	Free (pp);
87*3125Sjacobs 
880Sstevel@tonic-gate 	return;
890Sstevel@tonic-gate }
90