chkpath.h revision d4188195113bc7f546b026033c66ea3e12de0e02
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore/*
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * CDDL HEADER START
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore *
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * The contents of this file are subject to the terms of the
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * Common Development and Distribution License (the "License").
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * You may not use this file except in compliance with the License.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore *
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * or http://www.opensolaris.org/os/licensing.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * See the License for the specific language governing permissions
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * and limitations under the License.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore *
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * When distributing Covered Code, include this CDDL HEADER in each
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * If applicable, add the following below this CDDL HEADER, with the
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * fields enclosed by brackets "[]" replaced with your own identifying
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * information: Portions Copyright [yyyy] [name of copyright owner]
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore *
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * CDDL HEADER END
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore */
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore/*
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore * Use is subject to license terms.
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore */
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#pragma ident "%Z%%M% %I% %E% SMI"
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#include <sys/types.h>
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#include <sys/syscall.h>
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#include <errno.h>
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore#define CHKNULL(p) \
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore if ((p) == (char *)0 || (p) == (char *)-1) { \
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore errno = EFAULT; \
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore return (-1); \
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore } else if (*(p) == 0) { \
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore p = "."; \
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore }
7a4f122cf63a91c2888629e433b5f5ee7536a802Garrett D'Amore