#ifndef _DISPUTIL_H_56a056fd_ #define _DISPUTIL_H_56a056fd_ /* * APIs exported by disputil.c. */ /* * The possible return values of prompt_and_read(). See * prompt_and_read() for their semantics. */ typedef enum { PR_OK = 1, PR_ABORTED, } PRSTAT; /* * The return values from prompt_and_read's char approval function. * See prompt_and_read for their semantics. */ typedef enum { CHOK_OK = 1, CHOK_BAD, CHOK_TERM, CHOK_TERMNS, CHOK_ABORT, CHOK_DEL, CHOK_CLEAR, } CHOK; /* * Prompt for and accept string input. * * prompt_and_read(pstr,buf,len,flags,approval) prompts with pstr and * reads a string into buf, up to len-1 characters (one is reserved * for a trailing NUL). approval vets characters, for cases when only * certain characters are permitted. flags is zero or more of the * PRF_* flags. See the comment on prompt_and_read for more. */ extern PRSTAT prompt_and_read(const char *, char *, int, unsigned int, CHOK (*)(char)); #define PRF_NOSTD 0x00000001 /* * Ask the player to choose one of a small number of options. * * choose_one(prompt,str1,ret1,str2,ret2,...,strN,retN,(char *)0,retE) * * returns ret1 if str1 is chosen, ret2 if str2, etc; if the user * aborts the choice, retE is returned. */ extern int choose_one(const char *, ...); /* * Get Y/N confirmation of something. Returns true if confirmed * (player replies Y), false if not (replies N or aborts). */ extern int confirm(const char *); #endif