mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 15:26:23 -05:00
Introduce bname_t type and reduce need of NBUFN buffer name length constant.
This commit is contained in:
parent
494210424c
commit
fc79c8e013
12
buffer.c
12
buffer.c
@ -59,9 +59,9 @@ int usebuffer(int f, int n)
|
||||
{
|
||||
struct buffer *bp;
|
||||
int s;
|
||||
char bufn[NBUFN];
|
||||
bname_t bufn ;
|
||||
|
||||
if ((s = mlreply("Use buffer: ", bufn, NBUFN)) != TRUE)
|
||||
if ((s = mlreply("Use buffer: ", bufn, sizeof bufn)) != TRUE)
|
||||
return s;
|
||||
if ((bp = bfind(bufn, TRUE, 0)) == NULL)
|
||||
return FALSE;
|
||||
@ -168,9 +168,9 @@ int killbuffer(int f, int n)
|
||||
{
|
||||
struct buffer *bp;
|
||||
int s;
|
||||
char bufn[NBUFN];
|
||||
bname_t bufn ;
|
||||
|
||||
if ((s = mlreply("Kill buffer: ", bufn, NBUFN)) != TRUE)
|
||||
if ((s = mlreply("Kill buffer: ", bufn, sizeof bufn)) != TRUE)
|
||||
return s;
|
||||
if ((bp = bfind(bufn, FALSE, 0)) == NULL) /* Easy if unknown. */
|
||||
return TRUE;
|
||||
@ -218,10 +218,10 @@ int zotbuf(struct buffer *bp)
|
||||
int namebuffer(int f, int n)
|
||||
{
|
||||
struct buffer *bp; /* pointer to scan through all buffers */
|
||||
char bufn[NBUFN]; /* buffer to hold buffer name */
|
||||
bname_t bufn ; /* buffer to hold buffer name */
|
||||
|
||||
/* prompt for and get the new buffer name */
|
||||
ask:if (mlreply("Change buffer name to: ", bufn, NBUFN) !=
|
||||
ask:if (mlreply("Change buffer name to: ", bufn, sizeof bufn) !=
|
||||
TRUE)
|
||||
return FALSE;
|
||||
|
||||
|
7
buffer.h
7
buffer.h
@ -4,10 +4,11 @@
|
||||
#include "crypt.h"
|
||||
#include "line.h"
|
||||
|
||||
#define NBUFN 16 /* # of bytes, buffer name */
|
||||
#define NPAT 128 /* # of bytes, pattern */
|
||||
|
||||
typedef char fname_t[ 80] ;
|
||||
typedef char fname_t[ 80] ; /* file name */
|
||||
typedef char bname_t[ 16] ; /* buffer name */
|
||||
#define NBUFN sizeof( bname_t)
|
||||
|
||||
/*
|
||||
* Text is kept in buffers. A buffer header, described below, exists for every
|
||||
@ -32,7 +33,7 @@ struct buffer {
|
||||
char b_nwnd; /* Count of windows on buffer */
|
||||
char b_flag; /* Flags */
|
||||
fname_t b_fname ; /* File name */
|
||||
char b_bname[NBUFN]; /* Buffer name */
|
||||
bname_t b_bname ; /* Buffer name */
|
||||
#if CRYPT
|
||||
char b_key[NPAT]; /* current encrypted key */
|
||||
#endif
|
||||
|
12
exec.c
12
exec.c
@ -319,7 +319,7 @@ int nextarg(const char *prompt, char *buffer, int size, int terminator)
|
||||
int storemac(int f, int n)
|
||||
{
|
||||
struct buffer *bp; /* pointer to macro buffer */
|
||||
char bname[NBUFN]; /* name of buffer to use */
|
||||
bname_t bname ; /* name of buffer to use */
|
||||
|
||||
/* must have a numeric argument to this function */
|
||||
if (f == FALSE) {
|
||||
@ -366,7 +366,7 @@ int storeproc(int f, int n)
|
||||
{
|
||||
struct buffer *bp; /* pointer to macro buffer */
|
||||
int status; /* return status */
|
||||
char bname[NBUFN]; /* name of buffer to use */
|
||||
bname_t bname ; /* name of buffer to use */
|
||||
|
||||
/* a numeric argument means its a numbered macro */
|
||||
if (f == TRUE)
|
||||
@ -374,7 +374,7 @@ int storeproc(int f, int n)
|
||||
|
||||
/* get the name of the procedure */
|
||||
if ((status =
|
||||
mlreply("Procedure name: ", &bname[1], NBUFN - 2)) != TRUE)
|
||||
mlreply("Procedure name: ", &bname[1], sizeof bname - 2)) != TRUE)
|
||||
return status;
|
||||
|
||||
/* construct the macro buffer name */
|
||||
@ -441,10 +441,10 @@ int execbuf(int f, int n)
|
||||
{
|
||||
struct buffer *bp; /* ptr to buffer to execute */
|
||||
int status; /* status return */
|
||||
char bufn[NSTRING]; /* name of buffer to execute */
|
||||
bname_t bufn ; /* name of buffer to execute */
|
||||
|
||||
/* find out what buffer the user wants to execute */
|
||||
if ((status = mlreply("Execute buffer: ", bufn, NBUFN)) != TRUE)
|
||||
if ((status = mlreply("Execute buffer: ", bufn, sizeof bufn)) != TRUE)
|
||||
return status;
|
||||
|
||||
/* find the pointer to that buffer */
|
||||
@ -952,7 +952,7 @@ int dofile(char *fname)
|
||||
struct buffer *bp; /* buffer to place file to exeute */
|
||||
struct buffer *cb; /* temp to hold current buf while we read */
|
||||
int status; /* results of various calls */
|
||||
char bname[NBUFN]; /* name of buffer */
|
||||
bname_t bname ; /* name of buffer */
|
||||
|
||||
makename(bname, fname); /* derive the name of the buffer */
|
||||
unqname(bname); /* make sure we don't stomp things */
|
||||
|
4
file.c
4
file.c
@ -215,7 +215,7 @@ int getfile( const char *fname, boolean lockfl)
|
||||
struct line *lp;
|
||||
int i;
|
||||
int s;
|
||||
char bname[NBUFN]; /* buffer name to put file */
|
||||
bname_t bname ; /* buffer name to put file */
|
||||
|
||||
#if MSDOS
|
||||
mklower(fname); /* msdos isn't case sensitive */
|
||||
@ -238,7 +238,7 @@ int getfile( const char *fname, boolean lockfl)
|
||||
makename(bname, fname); /* New buffer name. */
|
||||
while ((bp = bfind(bname, FALSE, 0)) != NULL) {
|
||||
/* old buffer name conflict code */
|
||||
s = mlreply("Buffer name: ", bname, NBUFN);
|
||||
s = mlreply("Buffer name: ", bname, sizeof bname);
|
||||
if (s == ABORT) /* ^G to just quit */
|
||||
return s;
|
||||
if (s == FALSE) { /* CR to clobber it */
|
||||
|
2
main.c
2
main.c
@ -156,7 +156,7 @@ int main(int argc, char **argv)
|
||||
int searchflag; /* Do we need to search at start? */
|
||||
int saveflag; /* temp store for lastflag */
|
||||
int errflag; /* C error processing? */
|
||||
char bname[NBUFN]; /* buffer name of file to read */
|
||||
bname_t bname ; /* buffer name of file to read */
|
||||
#if CRYPT
|
||||
int cryptflag; /* encrypting on the way in? */
|
||||
char ekey[NPAT]; /* startup encryption key */
|
||||
|
Loading…
Reference in New Issue
Block a user