1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-11-16 17:46:40 -05:00

Introduce newmlarg as alternative to mlreply.

Rewrite gotoline accordingly.
This commit is contained in:
Renaud 2015-09-29 10:43:19 +08:00
parent 198980b81f
commit 7f5f0dd7b3
3 changed files with 16 additions and 10 deletions

13
basic.c
View File

@ -90,21 +90,22 @@ int gotoeol(int f, int n)
* *
* @n: The specified line position at the current buffer. * @n: The specified line position at the current buffer.
*/ */
int gotoline(int f, int n) int gotoline( int f, int n) {
{
int status ;
char arg[ NSTRING] ; /* Buffer to hold argument. */
/* Get an argument if one doesnt exist. */ /* Get an argument if one doesnt exist. */
if( f == FALSE) { if( f == FALSE) {
status = mlreply( "Line to GOTO: ", arg, sizeof arg) ; int status ;
char *arg ; /* Buffer to hold argument. */
status = newmlarg( &arg, "Line to GOTO: ", 0) ;
if( status != TRUE) { if( status != TRUE) {
mloutstr( "(Aborted)") ; mloutstr( "(Aborted)") ;
return status ; return status ;
} }
n = atoi( arg) ; n = atoi( arg) ;
free( arg) ;
} }
/* Handle the case where the user may be passed something like this: /* Handle the case where the user may be passed something like this:
* em filename + * em filename +
* In this case we just go to the end of the buffer. * In this case we just go to the end of the buffer.

View File

@ -146,6 +146,10 @@ int mlreply( const char *prompt, char *buf, int nbuf) {
return nextarg( prompt, buf, nbuf, nlc) ; return nextarg( prompt, buf, nbuf, nlc) ;
} }
int newmlarg( char **outbufref, const char *prompt, int size) {
return newnextarg( outbufref, prompt, size, nlc) ;
}
int newmlargt( char **outbufref, const char *prompt, int size) { int newmlargt( char **outbufref, const char *prompt, int size) {
return newnextarg( outbufref, prompt, size, metac) ; return newnextarg( outbufref, prompt, size, metac) ;
} }

View File

@ -24,6 +24,7 @@ extern const int nlc ; /* end of input char */
int mlyesno( const char *prompt) ; int mlyesno( const char *prompt) ;
int mlreply( const char *prompt, char *buf, int nbuf) ; int mlreply( const char *prompt, char *buf, int nbuf) ;
int newmlarg( char **outbufref, const char *prompt, int size) ;
int newmlargt( char **outbufref, const char *prompt, int size) ; int newmlargt( char **outbufref, const char *prompt, int size) ;
int ectoc( int c) ; int ectoc( int c) ;
fn_t getname( void) ; fn_t getname( void) ;