diff options
Diffstat (limited to 'usr/src/cmd/lp/lib/class')
-rw-r--r-- | usr/src/cmd/lp/lib/class/Makefile | 67 | ||||
-rw-r--r-- | usr/src/cmd/lp/lib/class/delclass.c | 89 | ||||
-rw-r--r-- | usr/src/cmd/lp/lib/class/freeclass.c | 61 | ||||
-rw-r--r-- | usr/src/cmd/lp/lib/class/getclass.c | 124 | ||||
-rw-r--r-- | usr/src/cmd/lp/lib/class/llib-llpcls | 44 | ||||
-rw-r--r-- | usr/src/cmd/lp/lib/class/putclass.c | 84 |
6 files changed, 0 insertions, 469 deletions
diff --git a/usr/src/cmd/lp/lib/class/Makefile b/usr/src/cmd/lp/lib/class/Makefile deleted file mode 100644 index c6003dd8b6..0000000000 --- a/usr/src/cmd/lp/lib/class/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# -# cmd/lp/lib/class/Makefile -# - -LIBRARY = liblpcls.a - -OBJECTS = delclass.o \ - freeclass.o \ - getclass.o \ - putclass.o - - -include ../../../../lib/Makefile.lib -include ../../Makefile.lp - -# Specifically request the construction of a static library. -# This library is not installed in the proto area. -LIBS = $(LIBRARY) - -CPPFLAGS = -I../../include $(CPPFLAGS.master) $(C_PICFLAGS) - -POFILE = lp_lib_class.po - -.KEEP_STATE: - -all install : $(LIBS) - -include ../../../../lib/Makefile.targ - -CLEANFILES += llib-llpcls.ln -LINTFLAGS = -nvx -SRCS= $(OBJECTS:%.o=%.c) -LINT_CPPFLAGS = -I../../include $(CPPFLAGS.master) - -lint: lintlib - $(LINT) $(LINTFLAGS) $(LINT_CPPFLAGS) $(SRCS) - -lintlib: - $(LINT) $(LINTFLAGS) $(LINT_CPPFLAGS) -o lpcls llib-llpcls - -include ../Makefile.msg diff --git a/usr/src/cmd/lp/lib/class/delclass.c b/usr/src/cmd/lp/lib/class/delclass.c deleted file mode 100644 index ee88b33bce..0000000000 --- a/usr/src/cmd/lp/lib/class/delclass.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - - -#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */ -/* LINTLIBRARY */ - -#include "stdio.h" -#include "errno.h" -#include "string.h" -#include "sys/types.h" -#include "string.h" - -#include "lp.h" -#include "class.h" - -static int _delclass ( char * ); - -/** - ** delclass() - WRITE CLASS OUT TO DISK - **/ - -int -delclass(char *name) -{ - long lastdir; - - if (!name || !*name) { - errno = EINVAL; - return (-1); - } - - if (STREQU(NAME_ALL, name)) { - lastdir = -1; - while ((name = next_file(Lp_A_Classes, &lastdir))) - if (_delclass(name) == -1) - return (-1); - return (0); - } else - return (_delclass(name)); -} - -/** - ** _delclass() - **/ - -static int -#if defined(__STDC__) -_delclass ( - char * name -) -#else -_delclass (name) - char *name; -#endif -{ - char *path; - - if (!(path = getclassfile(name))) - return (-1); - if (rmfile(path) == -1) { - Free (path); - return (-1); - } - Free (path); - return (0); -} - diff --git a/usr/src/cmd/lp/lib/class/freeclass.c b/usr/src/cmd/lp/lib/class/freeclass.c deleted file mode 100644 index dc6fd9f448..0000000000 --- a/usr/src/cmd/lp/lib/class/freeclass.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - - -#pragma ident "%Z%%M% %I% %E% SMI" -/* LINTLIBRARY */ - -#include <syslog.h> -#include "lp.h" -#include "class.h" - -/** - ** freeclass() - FREE SPACE USED BY CLASS STRUCTURE - **/ - -void -#if defined(__STDC__) -freeclass ( - CLASS * clsbufp -) -#else -freeclass (clsbufp) - CLASS *clsbufp; -#endif -{ - if (!clsbufp) - return; - syslog(LOG_DEBUG, "freeclass(%s)", clsbufp->name ? clsbufp->name : ""); - if (clsbufp->name) - Free (clsbufp->name); - freelist (clsbufp->members); - Free(clsbufp); - - return; -} diff --git a/usr/src/cmd/lp/lib/class/getclass.c b/usr/src/cmd/lp/lib/class/getclass.c deleted file mode 100644 index ad888370f4..0000000000 --- a/usr/src/cmd/lp/lib/class/getclass.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - - -#pragma ident "%Z%%M% %I% %E% SMI" -/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */ - -#include "stdio.h" -#include "string.h" -#include "errno.h" -#include "sys/types.h" -#include <syslog.h> - -#include "lp.h" -#include "class.h" - -/** - ** getclass() - READ CLASS FROM TO DISK - **/ - -CLASS * -getclass(char *name) -{ - static long lastdir = -1; - - CLASS *clsp; - - char *file, - buf[BUFSIZ]; - - int fd; - - syslog(LOG_DEBUG, "getclass(%s)", name ? name : ""); - - if (!name || !*name) { - errno = EINVAL; - return (0); - } - - /* - * Getting ``all''? If so, jump into the directory - * wherever we left off. - */ - if (STREQU(NAME_ALL, name)) { - if (!(name = next_file(Lp_A_Classes, &lastdir))) - return (0); - } else - lastdir = -1; - - /* - * Get the class list. - */ - - if (!(file = getclassfile(name))) - return (0); - - if ((fd = open_locked(file, "r", 0)) < 0) { - Free (file); - return (0); - } - Free (file); - - clsp = (CLASS *)calloc(sizeof (*clsp), 1); - - if (!(clsp->name = Strdup(name))) { - Free (clsp); - close(fd); - errno = ENOMEM; - return (0); - } - - clsp->members = 0; - errno = 0; - while (fdgets(buf, BUFSIZ, fd)) { - buf[strlen(buf) - 1] = 0; - addlist (&clsp->members, buf); - } - if (errno != 0) { - int save_errno = errno; - - freelist (clsp->members); - Free (clsp->name); - Free (clsp); - close(fd); - errno = save_errno; - return (0); - } - close(fd); - - if (!clsp->members) { - Free (clsp->name); - Free (clsp); - errno = EBADF; - return (0); - } - - return (clsp); -} diff --git a/usr/src/cmd/lp/lib/class/llib-llpcls b/usr/src/cmd/lp/lib/class/llib-llpcls deleted file mode 100644 index fea59cd737..0000000000 --- a/usr/src/cmd/lp/lib/class/llib-llpcls +++ /dev/null @@ -1,44 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* LINTLIBRARY */ -/* PROTOLIB1 */ - -/* - * Copyright (c) 1998 by Sun Microsystems, Inc. - * All rights reserved. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -typedef struct CLASS { - char *name; /* name of class (redundant) */ - char **members; /* members of class */ -} CLASS; - -int putclass ( char *, CLASS * ); -int delclass ( char * ); - -void freeclass ( CLASS * ); - diff --git a/usr/src/cmd/lp/lib/class/putclass.c b/usr/src/cmd/lp/lib/class/putclass.c deleted file mode 100644 index 8f85a082af..0000000000 --- a/usr/src/cmd/lp/lib/class/putclass.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1997 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - - -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */ -/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */ - -#include "stdio.h" -#include "errno.h" -#include "sys/types.h" -#include "string.h" - -#include "lp.h" -#include "class.h" - -/** - ** putclass() - WRITE CLASS OUT TO DISK - **/ - -int -putclass(char *name, CLASS *clsbufp) -{ - char *file; - int fd; - - if (!name || !*name) { - errno = EINVAL; - return (-1); - } - - if (STREQU(NAME_ALL, name)) { - errno = EINVAL; - return (-1); - } - - /* - * Open the class file and write out the class members. - */ - - if (!(file = getclassfile(name))) - return (-1); - - if ((fd = open_locked(file, "w", MODE_READ)) < 0) { - Free (file); - return (-1); - } - Free (file); - - errno = 0; - fdprintlist(fd, clsbufp->members); - if (errno != 0) { - close(fd); - return (-1); - } - close(fd); - - return (0); -} |