ckpath.c revision 4656d4747c8743290bfbe910c64cd75eb4e4af8d
/*
* 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) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 1996-1998, 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
*/
/*LINTLIBRARY*/
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include "valtools.h"
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include "libadm.h"
#define E_SYNTAX "does not meet suggested filename syntax standard"
#define E_READ "is not readable"
#define E_WRITE "is not writable"
#define E_EXEC "is not executable"
#define E_CREAT "cannot be created"
#define E_ABSOLUTE "must begin with a slash (/)"
#define E_RELATIVE "must not begin with a slash (/)"
#define E_EXIST "does not exist"
#define E_NEXIST "must not already exist"
#define E_BLK "must specify a block special device"
#define E_CHR "must specify a character special device"
#define E_DIR "must specify a directory"
#define E_REG "must be a regular file"
#define E_NONZERO "must be a file of non-zero length"
#define H_READ "must be readable"
#define H_WRITE "must be writable"
#define H_EXEC "must be executable"
#define H_CREAT "will be created if it does not exist"
#define H_ABSOLUTE E_ABSOLUTE
#define H_RELATIVE E_RELATIVE
#define H_EXIST "must already exist"
#define H_NEXIST "must not already exist"
#define MSGSIZ 1024
#define STDHELP \
"A pathname is a filename, optionally preceded by parent directories."
static char *errstr;
static char *badset = "*?[]{}()<> \t'`\"\\|^";
static void
{
static int count;
count = 0;
return;
}
if (!count++)
}
static char *
{
char *msg;
if (pflags & P_ABSOLUTE)
else if (pflags & P_RELATIVE)
return (msg);
}
int
ckpath_stx(int pflags)
{
return (1);
}
return (0);
}
int
{
int fd;
char *pt;
errstr = E_RELATIVE;
return (1);
}
errstr = E_ABSOLUTE;
return (1);
}
return (1);
}
return (1);
}
}
return (1);
}
} else {
return (1);
}
}
}
return (0);
return (1);
}
/* check non zero status */
return (1);
}
}
return (1);
}
return (1);
}
return (1);
}
return (1);
}
return (1);
}
return (1);
}
return (1);
}
return (0);
}
void
{
char buffer[2048];
char *defhlp;
if (input) {
"Pathname %s.", errstr);
return;
}
}
}
void
{
char *defhlp;
}
int
char *prompt)
{
char *defhlp,
buffer[256];
return (2); /* usage error */
if (!prompt) {
if (pflags & P_ABSOLUTE)
prompt = "Enter an absolute pathname";
else if (pflags & P_RELATIVE)
prompt = "Enter a relative pathname";
else
prompt = "Enter a pathname";
}
return (1);
}
if (defstr) {
return (0);
}
goto start;
}
goto start;
}
return (3);
}
"Pathname %s.", errstr);
goto start;
}
return (0);
}