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 /* 23 * Copyright 1993 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 28 /* All Rights Reserved */ 29 30 /* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */ 31 32 #include "errno.h" 33 #include "stdio.h" 34 #include "string.h" 35 #include "unistd.h" 36 #include "stdlib.h" 37 38 #include "lp.h" 39 40 /** 41 ** getaccessfile() - BUILD NAME OF ALLOW OR DENY FILE 42 **/ 43 44 char * 45 #if defined(__STDC__) 46 getaccessfile ( 47 char * dir, 48 char * name, 49 char * prefix, 50 char * base 51 ) 52 #else 53 getaccessfile (dir, name, prefix, base) 54 char *dir, 55 *name, 56 *prefix, 57 *base; 58 #endif 59 { 60 register char *parent, 61 *file, 62 *f; 63 64 /* 65 * It makes no sense talking about the access files if 66 * the directory for the form or printer doesn't exist. 67 */ 68 parent = makepath(dir, name, (char *)0); 69 if (!parent) 70 return (0); 71 if (Access(parent, F_OK) == -1) { 72 Free(parent); 73 return (0); 74 } 75 76 if (!(f = makestr(prefix, base, (char *)0))) { 77 Free(parent); 78 errno = ENOMEM; 79 return (0); 80 } 81 file = makepath(parent, f, (char *)0); 82 Free (f); 83 Free (parent); 84 85 return (file); 86 } 87