mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-20 16:22:38 -05:00
Introduce newmlarg as alternative to mlreply.
Rewrite gotoline accordingly.
This commit is contained in:
parent
198980b81f
commit
7f5f0dd7b3
21
basic.c
21
basic.c
@ -90,25 +90,26 @@ int gotoeol(int f, int n)
|
||||
*
|
||||
* @n: The specified line position at the current buffer.
|
||||
*/
|
||||
int gotoline(int f, int n)
|
||||
{
|
||||
int status ;
|
||||
char arg[ NSTRING] ; /* Buffer to hold argument. */
|
||||
|
||||
int gotoline( int f, int n) {
|
||||
/* Get an argument if one doesnt exist. */
|
||||
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) {
|
||||
mloutstr( "(Aborted)") ;
|
||||
return status ;
|
||||
}
|
||||
|
||||
n = atoi( arg) ;
|
||||
free( arg) ;
|
||||
}
|
||||
/* Handle the case where the user may be passed something like this:
|
||||
* em filename +
|
||||
* In this case we just go to the end of the buffer.
|
||||
*/
|
||||
|
||||
/* Handle the case where the user may be passed something like this:
|
||||
* em filename +
|
||||
* In this case we just go to the end of the buffer.
|
||||
*/
|
||||
if (n == 0)
|
||||
return gotoeob(f, n);
|
||||
|
||||
|
4
input.c
4
input.c
@ -146,6 +146,10 @@ int mlreply( const char *prompt, char *buf, int nbuf) {
|
||||
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) {
|
||||
return newnextarg( outbufref, prompt, size, metac) ;
|
||||
}
|
||||
|
1
input.h
1
input.h
@ -24,6 +24,7 @@ extern const int nlc ; /* end of input char */
|
||||
|
||||
int mlyesno( const char *prompt) ;
|
||||
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 ectoc( int c) ;
|
||||
fn_t getname( void) ;
|
||||
|
Loading…
Reference in New Issue
Block a user