stand.h revision 329114
138451Smsmith/* 238451Smsmith * Copyright (c) 1998 Michael Smith. 338451Smsmith * All rights reserved. 438451Smsmith * 538451Smsmith * Redistribution and use in source and binary forms, with or without 638451Smsmith * modification, are permitted provided that the following conditions 738451Smsmith * are met: 838451Smsmith * 1. Redistributions of source code must retain the above copyright 938451Smsmith * notice, this list of conditions and the following disclaimer. 1038451Smsmith * 2. Redistributions in binary form must reproduce the above copyright 1138451Smsmith * notice, this list of conditions and the following disclaimer in the 1238451Smsmith * documentation and/or other materials provided with the distribution. 1338451Smsmith * 1438451Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1538451Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1638451Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1738451Smsmith * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1838451Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1938451Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2038451Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2138451Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2238451Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2338451Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2438451Smsmith * SUCH DAMAGE. 2538451Smsmith * 2650476Speter * $FreeBSD: stable/11/lib/libstand/stand.h 329114 2018-02-11 02:27:50Z kevans $ 2738451Smsmith * From $NetBSD: stand.h,v 1.22 1997/06/26 19:17:40 drochner Exp $ 2838451Smsmith */ 2938451Smsmith 3038451Smsmith/*- 3138451Smsmith * Copyright (c) 1993 3238451Smsmith * The Regents of the University of California. All rights reserved. 3338451Smsmith * 3438451Smsmith * Redistribution and use in source and binary forms, with or without 3538451Smsmith * modification, are permitted provided that the following conditions 3638451Smsmith * are met: 3738451Smsmith * 1. Redistributions of source code must retain the above copyright 3838451Smsmith * notice, this list of conditions and the following disclaimer. 3938451Smsmith * 2. Redistributions in binary form must reproduce the above copyright 4038451Smsmith * notice, this list of conditions and the following disclaimer in the 4138451Smsmith * documentation and/or other materials provided with the distribution. 4238451Smsmith * 4. Neither the name of the University nor the names of its contributors 4338451Smsmith * may be used to endorse or promote products derived from this software 4438451Smsmith * without specific prior written permission. 4538451Smsmith * 4638451Smsmith * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 4738451Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 4838451Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 4938451Smsmith * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 5038451Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 5138451Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 5238451Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 5338451Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 5438451Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 5538451Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 5638451Smsmith * SUCH DAMAGE. 5738451Smsmith * 5838451Smsmith * @(#)stand.h 8.1 (Berkeley) 6/11/93 5938451Smsmith */ 6038451Smsmith 61146327Sobrien#ifndef STAND_H 62146327Sobrien#define STAND_H 63146327Sobrien 6438451Smsmith#include <sys/types.h> 6538451Smsmith#include <sys/cdefs.h> 6638451Smsmith#include <sys/stat.h> 6759766Sjlemon#include <sys/dirent.h> 68223905Savatar 69223905Savatar/* this header intentionally exports NULL from <string.h> */ 7064185Sjhb#include <string.h> 7138451Smsmith 72135576Sstefanf#define CHK(fmt, args...) printf("%s(%d): " fmt "\n", __func__, __LINE__ , ##args) 73135576Sstefanf#define PCHK(fmt, args...) {printf("%s(%d): " fmt "\n", __func__, __LINE__ , ##args); getchar();} 7439665Smsmith 7538451Smsmith/* Avoid unwanted userlandish components */ 7655206Speter#define _KERNEL 7738451Smsmith#include <sys/errno.h> 7855206Speter#undef _KERNEL 7938451Smsmith 8038451Smsmith/* special stand error codes */ 8138451Smsmith#define EADAPT (ELAST+1) /* bad adaptor */ 8238451Smsmith#define ECTLR (ELAST+2) /* bad controller */ 8338451Smsmith#define EUNIT (ELAST+3) /* bad unit */ 8438451Smsmith#define ESLICE (ELAST+4) /* bad slice */ 8538451Smsmith#define EPART (ELAST+5) /* bad partition */ 8638451Smsmith#define ERDLAB (ELAST+6) /* can't read disk label */ 8738451Smsmith#define EUNLAB (ELAST+7) /* unlabeled disk */ 8838451Smsmith#define EOFFSET (ELAST+8) /* relative seek not supported */ 8938451Smsmith#define ESALAST (ELAST+8) /* */ 9038451Smsmith 9138451Smsmithstruct open_file; 9238451Smsmith 9338451Smsmith/* 9438451Smsmith * This structure is used to define file system operations in a file system 9538451Smsmith * independent way. 9638451Smsmith * 9738451Smsmith * XXX note that filesystem providers should export a pointer to their fs_ops 9838451Smsmith * struct, so that consumers can reference this and thus include the 9938451Smsmith * filesystems that they require. 10038451Smsmith */ 10138451Smsmithstruct fs_ops { 10239468Smsmith const char *fs_name; 10339468Smsmith int (*fo_open)(const char *path, struct open_file *f); 10438451Smsmith int (*fo_close)(struct open_file *f); 10538451Smsmith int (*fo_read)(struct open_file *f, void *buf, 10638451Smsmith size_t size, size_t *resid); 10738451Smsmith int (*fo_write)(struct open_file *f, void *buf, 10838451Smsmith size_t size, size_t *resid); 10938451Smsmith off_t (*fo_seek)(struct open_file *f, off_t offset, int where); 11038451Smsmith int (*fo_stat)(struct open_file *f, struct stat *sb); 11159766Sjlemon int (*fo_readdir)(struct open_file *f, struct dirent *d); 11238451Smsmith}; 11338451Smsmith 11438451Smsmith/* 11538451Smsmith * libstand-supplied filesystems 11638451Smsmith */ 11738451Smsmithextern struct fs_ops ufs_fsops; 11838451Smsmithextern struct fs_ops tftp_fsops; 11938451Smsmithextern struct fs_ops nfs_fsops; 12038451Smsmithextern struct fs_ops cd9660_fsops; 121235537Sgberextern struct fs_ops nandfs_fsops; 122108100Sjakeextern struct fs_ops gzipfs_fsops; 12383610Ssobomaxextern struct fs_ops bzipfs_fsops; 12438451Smsmithextern struct fs_ops dosfs_fsops; 12559766Sjlemonextern struct fs_ops ext2fs_fsops; 12692494Ssobomaxextern struct fs_ops splitfs_fsops; 127269361Smarcelextern struct fs_ops pkgfs_fsops; 12838451Smsmith 12938451Smsmith/* where values for lseek(2) */ 13038451Smsmith#define SEEK_SET 0 /* set file offset to offset */ 13138451Smsmith#define SEEK_CUR 1 /* set file offset to current plus offset */ 13238451Smsmith#define SEEK_END 2 /* set file offset to EOF plus offset */ 13338451Smsmith 13438451Smsmith/* 13538451Smsmith * Device switch 13638451Smsmith */ 13738451Smsmithstruct devsw { 13839468Smsmith const char dv_name[8]; 13938451Smsmith int dv_type; /* opaque type constant, arch-dependant */ 14038451Smsmith int (*dv_init)(void); /* early probe call */ 141298230Sallanjude int (*dv_strategy)(void *devdata, int rw, daddr_t blk, 142313355Stsoome size_t size, char *buf, size_t *rsize); 14338451Smsmith int (*dv_open)(struct open_file *f, ...); 14438451Smsmith int (*dv_close)(struct open_file *f); 14538451Smsmith int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data); 146328889Skevans int (*dv_print)(int verbose); /* print device information */ 14764185Sjhb void (*dv_cleanup)(void); 14838451Smsmith}; 14938451Smsmith 15059766Sjlemon/* 15159766Sjlemon * libstand-supplied device switch 15259766Sjlemon */ 15359766Sjlemonextern struct devsw netdev; 15459766Sjlemon 15538451Smsmithextern int errno; 15638451Smsmith 157298230Sallanjude/* 158298230Sallanjude * Generic device specifier; architecture-dependent 159298230Sallanjude * versions may be larger, but should be allowed to 160298230Sallanjude * overlap. 161298230Sallanjude */ 162298230Sallanjudestruct devdesc 163298230Sallanjude{ 164298230Sallanjude struct devsw *d_dev; 165298230Sallanjude int d_type; 166298230Sallanjude#define DEVT_NONE 0 167298230Sallanjude#define DEVT_DISK 1 168298230Sallanjude#define DEVT_NET 2 169298230Sallanjude#define DEVT_CD 3 170298230Sallanjude#define DEVT_ZFS 4 171329099Skevans#define DEVT_FD 5 172298230Sallanjude int d_unit; 173298230Sallanjude void *d_opendata; 174298230Sallanjude}; 175298230Sallanjude 17638451Smsmithstruct open_file { 17738451Smsmith int f_flags; /* see F_* below */ 17838451Smsmith struct devsw *f_dev; /* pointer to device operations */ 17938451Smsmith void *f_devdata; /* device specific data */ 18038451Smsmith struct fs_ops *f_ops; /* pointer to file system operations */ 18138451Smsmith void *f_fsdata; /* file system specific data */ 18265470Smsmith off_t f_offset; /* current file offset */ 18365470Smsmith char *f_rabuf; /* readahead buffer pointer */ 18465470Smsmith size_t f_ralen; /* valid data in readahead buffer */ 18565470Smsmith off_t f_raoffset; /* consumer offset in readahead buffer */ 18665470Smsmith#define SOPEN_RASIZE 512 18738451Smsmith}; 18838451Smsmith 189192679Sdfr#define SOPEN_MAX 64 19038451Smsmithextern struct open_file files[]; 19138451Smsmith 19238451Smsmith/* f_flags values */ 19338451Smsmith#define F_READ 0x0001 /* file opened for reading */ 19438451Smsmith#define F_WRITE 0x0002 /* file opened for writing */ 19538451Smsmith#define F_RAW 0x0004 /* raw device open - no file system */ 19638451Smsmith#define F_NODEV 0x0008 /* network open - no device */ 197329100Skevans#define F_MASK 0xFFFF 198329100Skevans/* Mode modifier for strategy() */ 199329100Skevans#define F_NORA (0x01 << 16) /* Disable Read-Ahead */ 20038451Smsmith 20155181Speter#define isascii(c) (((c) & ~0x7F) == 0) 20238451Smsmith 20376579Sdcsstatic __inline int isupper(int c) 20476579Sdcs{ 20576579Sdcs return c >= 'A' && c <= 'Z'; 20676579Sdcs} 20776579Sdcs 20876579Sdcsstatic __inline int islower(int c) 20976579Sdcs{ 21076579Sdcs return c >= 'a' && c <= 'z'; 21176579Sdcs} 21276579Sdcs 21376579Sdcsstatic __inline int isspace(int c) 21476579Sdcs{ 21576579Sdcs return c == ' ' || (c >= 0x9 && c <= 0xd); 21676579Sdcs} 21776579Sdcs 21876579Sdcsstatic __inline int isdigit(int c) 21976579Sdcs{ 22076579Sdcs return c >= '0' && c <= '9'; 22176579Sdcs} 22276579Sdcs 22376579Sdcsstatic __inline int isxdigit(int c) 22476579Sdcs{ 22576579Sdcs return isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); 22676579Sdcs} 22776579Sdcs 22876579Sdcsstatic __inline int isalpha(int c) 22976579Sdcs{ 23076579Sdcs return isupper(c) || islower(c); 23176579Sdcs} 23276579Sdcs 23376579Sdcsstatic __inline int isalnum(int c) 23476579Sdcs{ 23576579Sdcs return isalpha(c) || isdigit(c); 23676579Sdcs} 23776579Sdcs 23851169Sdfrstatic __inline int toupper(int c) 23951169Sdfr{ 24051169Sdfr return islower(c) ? c - 'a' + 'A' : c; 24151169Sdfr} 24251169Sdfr 24351169Sdfrstatic __inline int tolower(int c) 24451169Sdfr{ 24551169Sdfr return isupper(c) ? c - 'A' + 'a' : c; 24651169Sdfr} 24751169Sdfr 24839665Smsmith/* sbrk emulation */ 24939665Smsmithextern void setheap(void *base, void *top); 25039665Smsmithextern char *sbrk(int incr); 25138451Smsmith 25239665Smsmith/* Matt Dillon's zalloc/zmalloc */ 25339665Smsmithextern void *malloc(size_t bytes); 25439665Smsmithextern void free(void *ptr); 25539665Smsmith/*#define free(p) {CHK("free %p", p); free(p);} */ /* use for catching guard violations */ 25639665Smsmithextern void *calloc(size_t n1, size_t n2); 25739665Smsmithextern void *realloc(void *ptr, size_t size); 25839665Smsmithextern void *reallocf(void *ptr, size_t size); 25939665Smsmithextern void mallocstats(void); 26039665Smsmith 261100392Speterextern int printf(const char *fmt, ...) __printflike(1, 2); 262102227Smikeextern void vprintf(const char *fmt, __va_list); 263100392Speterextern int sprintf(char *buf, const char *cfmt, ...) __printflike(2, 3); 264266878Shselaskyextern int snprintf(char *buf, size_t size, const char *cfmt, ...) __printflike(3, 4); 265102227Smikeextern void vsprintf(char *buf, const char *cfmt, __va_list); 26638451Smsmith 267276079Sianextern void twiddle(u_int callerdiv); 268276079Sianextern void twiddle_divisor(u_int globaldiv); 26938451Smsmith 27038451Smsmithextern void ngets(char *, int); 27138451Smsmith#define gets(x) ngets((x), 0) 27238451Smsmithextern int fgetstr(char *buf, int size, int fd); 27338451Smsmith 27438451Smsmithextern int open(const char *, int); 27538451Smsmith#define O_RDONLY 0x0 27687632Sjhb#define O_WRONLY 0x1 27738451Smsmith#define O_RDWR 0x2 27838451Smsmithextern int close(int); 27938451Smsmithextern void closeall(void); 28038451Smsmithextern ssize_t read(int, void *, size_t); 28138451Smsmithextern ssize_t write(int, void *, size_t); 28259766Sjlemonextern struct dirent *readdirfd(int); 28338451Smsmith 28438451Smsmithextern void srandom(u_long seed); 285329114Skevansextern long random(void); 28638451Smsmith 28738451Smsmith/* imports from stdlib, locally modified */ 28838451Smsmithextern long strtol(const char *, char **, int); 289246931Skientzleextern unsigned long strtoul(const char *, char **, int); 29038451Smsmithextern char *optarg; /* getopt(3) external variables */ 29142511Smsmithextern int optind, opterr, optopt, optreset; 29238451Smsmithextern int getopt(int, char * const [], const char *); 29338451Smsmith 29438451Smsmith/* pager.c */ 29538451Smsmithextern void pager_open(void); 29638451Smsmithextern void pager_close(void); 29738451Smsmithextern int pager_output(const char *lines); 29839468Smsmithextern int pager_file(const char *fname); 29938451Smsmith 30040891Smsmith/* No signal state to preserve */ 30140891Smsmith#define setjmp _setjmp 30240891Smsmith#define longjmp _longjmp 30340891Smsmith 30438451Smsmith/* environment.c */ 30538451Smsmith#define EV_DYNAMIC (1<<0) /* value was dynamically allocated, free if changed/unset */ 30638451Smsmith#define EV_VOLATILE (1<<1) /* value is volatile, make a copy of it */ 30738451Smsmith#define EV_NOHOOK (1<<2) /* don't call hook when setting */ 30838451Smsmith 30938451Smsmithstruct env_var; 31038451Smsmithtypedef char *(ev_format_t)(struct env_var *ev); 311121532Spetertypedef int (ev_sethook_t)(struct env_var *ev, int flags, 312121532Speter const void *value); 31338451Smsmithtypedef int (ev_unsethook_t)(struct env_var *ev); 31438451Smsmith 31538451Smsmithstruct env_var 31638451Smsmith{ 31738451Smsmith char *ev_name; 31838451Smsmith int ev_flags; 31938451Smsmith void *ev_value; 32038451Smsmith ev_sethook_t *ev_sethook; 32138451Smsmith ev_unsethook_t *ev_unsethook; 32238451Smsmith struct env_var *ev_next, *ev_prev; 32338451Smsmith}; 32438451Smsmithextern struct env_var *environ; 32538451Smsmith 32638451Smsmithextern struct env_var *env_getenv(const char *name); 32764185Sjhbextern int env_setenv(const char *name, int flags, 32864185Sjhb const void *value, ev_sethook_t sethook, 32964185Sjhb ev_unsethook_t unsethook); 33038451Smsmithextern char *getenv(const char *name); 33164185Sjhbextern int setenv(const char *name, const char *value, 33264185Sjhb int overwrite); 333329114Skevansextern int putenv(char *string); 33438451Smsmithextern int unsetenv(const char *name); 33538451Smsmith 33638451Smsmithextern ev_sethook_t env_noset; /* refuse set operation */ 33738451Smsmithextern ev_unsethook_t env_nounset; /* refuse unset operation */ 33838451Smsmith 33938451Smsmith/* BCD conversions (undocumented) */ 34038451Smsmithextern u_char const bcd2bin_data[]; 34138451Smsmithextern u_char const bin2bcd_data[]; 34238451Smsmithextern char const hex2ascii_data[]; 34338451Smsmith 34438451Smsmith#define bcd2bin(bcd) (bcd2bin_data[bcd]) 34538451Smsmith#define bin2bcd(bin) (bin2bcd_data[bin]) 34638451Smsmith#define hex2ascii(hex) (hex2ascii_data[hex]) 34738451Smsmith 34838451Smsmith/* min/max (undocumented) */ 34938451Smsmithstatic __inline int imax(int a, int b) { return (a > b ? a : b); } 35038451Smsmithstatic __inline int imin(int a, int b) { return (a < b ? a : b); } 35138451Smsmithstatic __inline long lmax(long a, long b) { return (a > b ? a : b); } 35238451Smsmithstatic __inline long lmin(long a, long b) { return (a < b ? a : b); } 35338451Smsmithstatic __inline u_int max(u_int a, u_int b) { return (a > b ? a : b); } 35438451Smsmithstatic __inline u_int min(u_int a, u_int b) { return (a < b ? a : b); } 35538451Smsmithstatic __inline quad_t qmax(quad_t a, quad_t b) { return (a > b ? a : b); } 35638451Smsmithstatic __inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); } 35738451Smsmithstatic __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); } 35838451Smsmithstatic __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); } 35938451Smsmith 36038451Smsmith 36138451Smsmith/* null functions for device/filesystem switches (undocumented) */ 36238451Smsmithextern int nodev(void); 36338451Smsmithextern int noioctl(struct open_file *, u_long, void *); 36438451Smsmithextern void nullsys(void); 36538451Smsmith 36639468Smsmithextern int null_open(const char *path, struct open_file *f); 36738451Smsmithextern int null_close(struct open_file *f); 36855137Speterextern int null_read(struct open_file *f, void *buf, size_t size, size_t *resid); 36955137Speterextern int null_write(struct open_file *f, void *buf, size_t size, size_t *resid); 37038451Smsmithextern off_t null_seek(struct open_file *f, off_t offset, int where); 37138451Smsmithextern int null_stat(struct open_file *f, struct stat *sb); 37259766Sjlemonextern int null_readdir(struct open_file *f, struct dirent *d); 37338451Smsmith 37459766Sjlemon 37538451Smsmith/* 37638451Smsmith * Machine dependent functions and data, must be provided or stubbed by 37738451Smsmith * the consumer 37838451Smsmith */ 379329114Skevansextern void exit(int); 38038451Smsmithextern int getchar(void); 38138451Smsmithextern int ischar(void); 38238451Smsmithextern void putchar(int); 38339672Sdfrextern int devopen(struct open_file *, const char *, const char **); 38438451Smsmithextern int devclose(struct open_file *f); 385124570Sjhbextern void panic(const char *, ...) __dead2 __printflike(1, 2); 38638451Smsmithextern struct fs_ops *file_system[]; 387269308Smarcelextern struct fs_ops *exclusive_file_system; 38838451Smsmithextern struct devsw *devsw[]; 38938451Smsmith 39090868Smike/* 39190868Smike * Expose byteorder(3) functions. 39290868Smike */ 39391959Smike#ifndef _BYTEORDER_PROTOTYPED 39491959Smike#define _BYTEORDER_PROTOTYPED 39591959Smikeextern uint32_t htonl(uint32_t); 39691959Smikeextern uint16_t htons(uint16_t); 39791959Smikeextern uint32_t ntohl(uint32_t); 39891959Smikeextern uint16_t ntohs(uint16_t); 39991959Smike#endif 40091959Smike 40191959Smike#ifndef _BYTEORDER_FUNC_DEFINED 40291959Smike#define _BYTEORDER_FUNC_DEFINED 40390868Smike#define htonl(x) __htonl(x) 40490868Smike#define htons(x) __htons(x) 40590868Smike#define ntohl(x) __ntohl(x) 40690868Smike#define ntohs(x) __ntohs(x) 40791959Smike#endif 40890868Smike 409100394Spetervoid *Malloc(size_t, const char *, int); 410100394Spetervoid *Calloc(size_t, size_t, const char *, int); 411100394Spetervoid *Realloc(void *, size_t, const char *, int); 412100394Spetervoid Free(void *, const char *, int); 41339672Sdfr 414100394Speter#if 1 415100394Speter#define malloc(x) Malloc(x, __FILE__, __LINE__) 416100394Speter#define calloc(x, y) Calloc(x, y, __FILE__, __LINE__) 417100394Speter#define free(x) Free(x, __FILE__, __LINE__) 418100394Speter#define realloc(x, y) Realloc(x, y, __FILE__, __LINE__) 419100394Speter#else 420102216Sscottl#define malloc(x) Malloc(x, NULL, 0) 421100394Speter#define calloc(x, y) Calloc(x, y, NULL, 0) 422100394Speter#define free(x) Free(x, NULL, 0) 423100394Speter#define realloc(x, y) Realloc(x, y, NULL, 0) 42439672Sdfr#endif 425146327Sobrien 426146327Sobrien#endif /* STAND_H */ 427