/*
* 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
* 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) 1996, by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* m_pathmax: mks specific library routine.
*
* Copyright 1992 by Mortice Kern Systems Inc. All rights reserved.
*
*/
#ifdef M_RCSID
#ifndef lint
static char rcsID[] = "$Header: /rd/src/libc/mks/rcs/m_pathma.c 1.4 1992/06/19 17:28:24 gord Exp $";
#endif
#endif /* M_RCSID */
#include <mks.h>
#include <unistd.h>
#include <stdlib.h>
#include <limits.h>
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#ifdef m_pathmax
#endif
/*f
* m_pathmax()
* - Determine current configuration value for PC_PATH_MAX
* relative to 'path'.
* - If 'path' is NULL, then relative to "/"
* - Return:
* configuration value
* or M_PATH_MAX if configuration value is indeterminate
* or -1 and errno is set if there's a problem with 'path'
*/
int
char* path;
{
int x;
path = "/";
errno = 0;
if (x == -1) {
if (errno == 0) {
/*
* unlimited size - so we use M_PATH_MAX
*
* M_PATH_MAX defined in mkslocal.h
* - use a sufficiently LARGE number (e.g 1024 or 2048)
*/
if (M_PATH_MAX < _POSIX_PATH_MAX) {
printf("m_pathmax(): Assert failure: ");
printf("M_PATH_MAX < _POSIX_PATH_MAX\n");
(void) exit(126);
}
return M_PATH_MAX;
} else {
/* ASSUME: cannot get errno = EINVAL because PC_PATH_MAX * must be supported, and must
* be associated with all *valid* 'path's
* (if 'path' is not valid, then we
* should get ENOENT or ENOTDIR,
* not EINVAL)
*/
printf("m_pathmax(): Assert failure: ");
printf("pathconf() = -1 and errno = EINVAL\n");
(void) exit(126);
}
return -1;
}
}
return x;
}
#ifdef TEST
/*
* compile with
* "make m_pathma COPTS=TEST" - using MKS make and MKS environment
* or
* "cc -o m_pathma -DTEST m_pathma.c" - to get sunos std libraries
*
*/
int argc;
char ** argv;
{
if (argc > 1) {
int x;
if (x == -1)
#ifdef __STDC__
#else
#endif
} else
}
#endif /* TEST */