misc.h revision 589271a44eaf1e2b6b05d80b025dc8b94e009aef
/*
* 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
* 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
*/
/*
*/
#ifndef _MISC_H
#define _MISC_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* This file contains declarations pertaining to the miscellaneous routines.
*/
#include <setjmp.h>
#include <termios.h>
/*
* Define macros bzero and bcopy for convenience
*/
#ifndef bzero
#endif
#ifndef bcopy
#endif
#ifndef bcmp
#endif
/*
* Minimum and maximum macros
*/
#ifndef min
#define min(x, y) ((x) < (y) ? (x) : (y))
#endif /* min */
#ifndef max
#define max(x, y) ((x) > (y) ? (x) : (y))
#endif /* max */
/*
* This defines the structure of a saved environment. It consists of the
* environment itself, a pointer to the next environment on the stack, and
* flags to tell whether the environment is active, etc.
*/
struct env {
char flags; /* flags */
};
extern struct env *current_env;
/*
* This macro saves the current environment in the given structure and
* pushes the structure onto our enivornment stack. It initializes the
* flags to zero (inactive).
*/
#define saveenv(x) { \
x.ptr = current_env; \
current_env = &x; \
x.flags = 0; \
}
/*
* This macro marks the environment on the top of the stack active. It
* assumes that there is an environment on the stack.
*/
/*
* This macro marks the environment on the top of the stack inactive. It
* assumes that there is an environment on the stack.
*/
/*
* This macro pops an environment off the top of the stack. It
* assumes that there is an environment on the stack.
*/
/*
* These are the flags for the environment struct.
*/
/*
* This structure is used to keep track of the state of the tty. This
* is necessary because some of the commands turn off echoing.
*/
struct ttystate {
int ttyflags; /* changes to tty state */
int ttyfile; /* file for ioctls */
int vmin; /* min read satisfier */
int vtime; /* read timing */
};
/*
* ttyflags - changes we can make to the tty state.
*/
/*
* This is the number lines assumed for the tty. It is designed to work
* on terminals as well as sun monitors.
*/
#define TTY_LINES 24
/*
* format parameter to dump()
*/
#define HEX_ONLY 0 /* print hex only */
/*
* Prototypes for ANSI C
*/
void destroy_data(char *data);
void fullabort(void) __NORETURN;
void enter_critical(void);
void exit_critical(void);
void echo_off(void);
void echo_on(void);
void charmode_on(void);
void charmode_off(void);
char *alloc_string(char *s);
char **build_argvlist(char **, int *, int *, char *);
int conventional_name(char *name);
#ifdef i386
int emcpower_name(char *name);
#endif
#if defined(_FIRMWARE_NEEDS_FDISK)
int fdisk_physical_name(char *name);
#endif /* defined(_FIRMWARE_NEEDS_FDISK) */
int whole_disk_name(char *name);
int canonical_name(char *name);
int canonical4x_name(char *name);
diskaddr_t mb2bn(float);
diskaddr_t gb2bn(float);
int get_tty_lines();
/*
* Macro to handle internal programming errors that
* should "never happen".
*/
fullabort(); }
extern char *confirm_list[];
/*
* This defines the size of the blind selection verfication prompt
*/
#ifdef __cplusplus
}
#endif
#endif /* _MISC_H */