mirror of
https://github.com/rfivet/uemacs.git
synced 2025-02-20 23:17:13 -05:00
Move "input.c" towards ANSI function declarations
This commit is contained in:
parent
453f80d269
commit
2b3627510d
14
edef.h
14
edef.h
@ -499,3 +499,17 @@ extern int ttputc(int c);
|
|||||||
extern void ttflush(void);
|
extern void ttflush(void);
|
||||||
extern int ttgetc(void);
|
extern int ttgetc(void);
|
||||||
extern int typahead(void);
|
extern int typahead(void);
|
||||||
|
|
||||||
|
/* input.c */
|
||||||
|
extern int mlyesno(char *prompt);
|
||||||
|
extern int mlreply(char *prompt, char *buf, int nbuf);
|
||||||
|
extern int mlreplyt(char *prompt, char *buf, int nbuf, int eolchar);
|
||||||
|
extern int ectoc(int c);
|
||||||
|
extern int ctoec(int c);
|
||||||
|
extern int (*getname(void))(void);
|
||||||
|
extern int tgetc(void);
|
||||||
|
extern int get1key(void);
|
||||||
|
extern int getcmd(void);
|
||||||
|
extern int getstring(char *prompt, char *buf, int nbuf, int eolchar);
|
||||||
|
extern void outstring(char *s);
|
||||||
|
extern void ostring(char *s);
|
||||||
|
92
input.c
92
input.c
@ -27,11 +27,7 @@
|
|||||||
* ABORT. The ABORT status is returned if the user bumps out of the question
|
* ABORT. The ABORT status is returned if the user bumps out of the question
|
||||||
* with a ^G. Used any time a confirmation is required.
|
* with a ^G. Used any time a confirmation is required.
|
||||||
*/
|
*/
|
||||||
|
int mlyesno(char *prompt)
|
||||||
mlyesno(prompt)
|
|
||||||
|
|
||||||
char *prompt;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
char c; /* input character */
|
char c; /* input character */
|
||||||
char buf[NPAT]; /* prompt to user */
|
char buf[NPAT]; /* prompt to user */
|
||||||
@ -64,30 +60,22 @@ char *prompt;
|
|||||||
* return. Handle erase, kill, and abort keys.
|
* return. Handle erase, kill, and abort keys.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mlreply(prompt, buf, nbuf)
|
int mlreply(char *prompt, char *buf, int nbuf)
|
||||||
char *prompt;
|
|
||||||
char *buf;
|
|
||||||
{
|
{
|
||||||
return (nextarg(prompt, buf, nbuf, ctoec('\n')));
|
return (nextarg(prompt, buf, nbuf, ctoec('\n')));
|
||||||
}
|
}
|
||||||
|
|
||||||
mlreplyt(prompt, buf, nbuf, eolchar)
|
int mlreplyt(char *prompt, char *buf, int nbuf, int eolchar)
|
||||||
|
|
||||||
char *prompt;
|
|
||||||
char *buf;
|
|
||||||
int eolchar;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
return (nextarg(prompt, buf, nbuf, eolchar));
|
return (nextarg(prompt, buf, nbuf, eolchar));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ectoc: expanded character to character
|
/*
|
||||||
colapse the CONTROL and SPEC flags back into an ascii code */
|
* ectoc:
|
||||||
|
* expanded character to character
|
||||||
ectoc(c)
|
* collapse the CONTROL and SPEC flags back into an ascii code
|
||||||
|
*/
|
||||||
int c;
|
int ectoc(int c)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (c & CONTROL)
|
if (c & CONTROL)
|
||||||
c = c & ~(CONTROL | 0x40);
|
c = c & ~(CONTROL | 0x40);
|
||||||
@ -96,25 +84,24 @@ int c;
|
|||||||
return (c);
|
return (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ctoec: character to extended character
|
/*
|
||||||
pull out the CONTROL and SPEC prefixes (if possible) */
|
* ctoec:
|
||||||
|
* character to extended character
|
||||||
ctoec(c)
|
* pull out the CONTROL and SPEC prefixes (if possible)
|
||||||
|
*/
|
||||||
int c;
|
int ctoec(int c)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (c >= 0x00 && c <= 0x1F)
|
if (c >= 0x00 && c <= 0x1F)
|
||||||
c = CONTROL | (c + '@');
|
c = CONTROL | (c + '@');
|
||||||
return (c);
|
return (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get a command name from the command line. Command completion means
|
/*
|
||||||
that pressing a <SPACE> will attempt to complete an unfinished command
|
* get a command name from the command line. Command completion means
|
||||||
name if it is unique.
|
* that pressing a <SPACE> will attempt to complete an unfinished command
|
||||||
*/
|
* name if it is unique.
|
||||||
|
*/
|
||||||
int (*getname()) ()
|
int (*getname(void))(void)
|
||||||
{
|
{
|
||||||
register int cpos; /* current column on screen output */
|
register int cpos; /* current column on screen output */
|
||||||
register int c;
|
register int c;
|
||||||
@ -131,7 +118,7 @@ int (*getname()) ()
|
|||||||
/* if we are executing a command line get the next arg and match it */
|
/* if we are executing a command line get the next arg and match it */
|
||||||
if (clexec) {
|
if (clexec) {
|
||||||
if (macarg(buf) != TRUE)
|
if (macarg(buf) != TRUE)
|
||||||
return (FALSE);
|
return NULL;
|
||||||
return (fncmatch(&buf[0]));
|
return (fncmatch(&buf[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +136,7 @@ int (*getname()) ()
|
|||||||
} else if (c == ectoc(abortc)) { /* Bell, abort */
|
} else if (c == ectoc(abortc)) { /* Bell, abort */
|
||||||
ctrlg(FALSE, 0);
|
ctrlg(FALSE, 0);
|
||||||
TTflush();
|
TTflush();
|
||||||
return ((int (*)()) NULL);
|
return NULL;
|
||||||
|
|
||||||
} else if (c == 0x7F || c == 0x08) { /* rubout/erase */
|
} else if (c == 0x7F || c == 0x08) { /* rubout/erase */
|
||||||
if (cpos != 0) {
|
if (cpos != 0) {
|
||||||
@ -261,7 +248,7 @@ int (*getname()) ()
|
|||||||
/* tgetc: Get a key from the terminal driver, resolve any keyboard
|
/* tgetc: Get a key from the terminal driver, resolve any keyboard
|
||||||
macro action */
|
macro action */
|
||||||
|
|
||||||
int tgetc()
|
int tgetc(void)
|
||||||
{
|
{
|
||||||
int c; /* fetched character */
|
int c; /* fetched character */
|
||||||
|
|
||||||
@ -313,7 +300,7 @@ int tgetc()
|
|||||||
are the SPEC and CONTROL prefixes.
|
are the SPEC and CONTROL prefixes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
get1key()
|
int get1key(void)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
@ -337,7 +324,7 @@ get1key()
|
|||||||
/* GETCMD: Get a command from the keyboard. Process all applicable
|
/* GETCMD: Get a command from the keyboard. Process all applicable
|
||||||
prefix keys
|
prefix keys
|
||||||
*/
|
*/
|
||||||
getcmd()
|
int getcmd(void)
|
||||||
{
|
{
|
||||||
int c; /* fetched keystroke */
|
int c; /* fetched keystroke */
|
||||||
#if VT220
|
#if VT220
|
||||||
@ -445,12 +432,7 @@ getcmd()
|
|||||||
to specify the proper terminator. If the terminator is not
|
to specify the proper terminator. If the terminator is not
|
||||||
a return ('\n') it will echo as "<NL>"
|
a return ('\n') it will echo as "<NL>"
|
||||||
*/
|
*/
|
||||||
getstring(prompt, buf, nbuf, eolchar)
|
int getstring(char *prompt, char *buf, int nbuf, int eolchar)
|
||||||
|
|
||||||
char *prompt;
|
|
||||||
char *buf;
|
|
||||||
int eolchar;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register int cpos; /* current character position in string */
|
register int cpos; /* current character position in string */
|
||||||
register int c;
|
register int c;
|
||||||
@ -708,20 +690,24 @@ int eolchar;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
outstring(s)
|
/*
|
||||||
/* output a string of characters */
|
* output a string of characters
|
||||||
char *s; /* string to output */
|
*
|
||||||
|
* char *s; string to output
|
||||||
|
*/
|
||||||
|
void outstring(char *s)
|
||||||
{
|
{
|
||||||
if (disinp)
|
if (disinp)
|
||||||
while (*s)
|
while (*s)
|
||||||
TTputc(*s++);
|
TTputc(*s++);
|
||||||
}
|
}
|
||||||
|
|
||||||
ostring(s)
|
/*
|
||||||
/* output a string of output characters */
|
* output a string of output characters
|
||||||
char *s; /* string to output */
|
*
|
||||||
|
* char *s; string to output
|
||||||
|
*/
|
||||||
|
void ostring(char *s)
|
||||||
{
|
{
|
||||||
if (discmd)
|
if (discmd)
|
||||||
while (*s)
|
while (*s)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user