mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 07:16:23 -05:00
Introduce fname_t type and remove need of NFILEN filename length constant.
This commit is contained in:
parent
5a0b64f952
commit
494210424c
5
buffer.h
5
buffer.h
@ -4,10 +4,11 @@
|
|||||||
#include "crypt.h"
|
#include "crypt.h"
|
||||||
#include "line.h"
|
#include "line.h"
|
||||||
|
|
||||||
#define NFILEN 80 /* # of bytes, file name */
|
|
||||||
#define NBUFN 16 /* # of bytes, buffer name */
|
#define NBUFN 16 /* # of bytes, buffer name */
|
||||||
#define NPAT 128 /* # of bytes, pattern */
|
#define NPAT 128 /* # of bytes, pattern */
|
||||||
|
|
||||||
|
typedef char fname_t[ 80] ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Text is kept in buffers. A buffer header, described below, exists for every
|
* Text is kept in buffers. A buffer header, described below, exists for every
|
||||||
* buffer in the system. The buffers are kept in a big list, so that commands
|
* buffer in the system. The buffers are kept in a big list, so that commands
|
||||||
@ -30,7 +31,7 @@ struct buffer {
|
|||||||
char b_active; /* window activated flag */
|
char b_active; /* window activated flag */
|
||||||
char b_nwnd; /* Count of windows on buffer */
|
char b_nwnd; /* Count of windows on buffer */
|
||||||
char b_flag; /* Flags */
|
char b_flag; /* Flags */
|
||||||
char b_fname[NFILEN]; /* File name */
|
fname_t b_fname ; /* File name */
|
||||||
char b_bname[NBUFN]; /* Buffer name */
|
char b_bname[NBUFN]; /* Buffer name */
|
||||||
#if CRYPT
|
#if CRYPT
|
||||||
char b_key[NPAT]; /* current encrypted key */
|
char b_key[NPAT]; /* current encrypted key */
|
||||||
|
24
file.c
24
file.c
@ -60,11 +60,11 @@ boolean restflag = FALSE ; /* restricted use? */
|
|||||||
int fileread(int f, int n)
|
int fileread(int f, int n)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
char fname[NFILEN];
|
fname_t fname ;
|
||||||
|
|
||||||
if (restflag) /* don't allow this command if restricted */
|
if (restflag) /* don't allow this command if restricted */
|
||||||
return resterr();
|
return resterr();
|
||||||
if ((s = mlreply("Read file: ", fname, NFILEN)) != TRUE)
|
if ((s = mlreply("Read file: ", fname, sizeof fname)) != TRUE)
|
||||||
return s;
|
return s;
|
||||||
return readin(fname, TRUE);
|
return readin(fname, TRUE);
|
||||||
}
|
}
|
||||||
@ -79,13 +79,13 @@ int fileread(int f, int n)
|
|||||||
int insfile(int f, int n)
|
int insfile(int f, int n)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
char fname[NFILEN];
|
fname_t fname ;
|
||||||
|
|
||||||
if (restflag) /* don't allow this command if restricted */
|
if (restflag) /* don't allow this command if restricted */
|
||||||
return resterr();
|
return resterr();
|
||||||
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
||||||
return rdonly(); /* we are in read only mode */
|
return rdonly(); /* we are in read only mode */
|
||||||
if ((s = mlreply("Insert file: ", fname, NFILEN)) != TRUE)
|
if ((s = mlreply("Insert file: ", fname, sizeof fname)) != TRUE)
|
||||||
return s;
|
return s;
|
||||||
if ((s = ifile(fname)) != TRUE)
|
if ((s = ifile(fname)) != TRUE)
|
||||||
return s;
|
return s;
|
||||||
@ -103,25 +103,25 @@ int insfile(int f, int n)
|
|||||||
*/
|
*/
|
||||||
int filefind(int f, int n)
|
int filefind(int f, int n)
|
||||||
{
|
{
|
||||||
char fname[NFILEN]; /* file user wishes to find */
|
fname_t fname ; /* file user wishes to find */
|
||||||
int s; /* status return */
|
int s; /* status return */
|
||||||
|
|
||||||
if (restflag) /* don't allow this command if restricted */
|
if (restflag) /* don't allow this command if restricted */
|
||||||
return resterr();
|
return resterr();
|
||||||
if ((s = mlreply("Find file: ", fname, NFILEN)) != TRUE)
|
if ((s = mlreply("Find file: ", fname, sizeof fname)) != TRUE)
|
||||||
return s;
|
return s;
|
||||||
return getfile(fname, TRUE);
|
return getfile(fname, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int viewfile(int f, int n)
|
int viewfile(int f, int n)
|
||||||
{ /* visit a file in VIEW mode */
|
{ /* visit a file in VIEW mode */
|
||||||
char fname[NFILEN]; /* file user wishes to find */
|
fname_t fname ; /* file user wishes to find */
|
||||||
int s; /* status return */
|
int s; /* status return */
|
||||||
struct window *wp; /* scan for windows that need updating */
|
struct window *wp; /* scan for windows that need updating */
|
||||||
|
|
||||||
if (restflag) /* don't allow this command if restricted */
|
if (restflag) /* don't allow this command if restricted */
|
||||||
return resterr();
|
return resterr();
|
||||||
if ((s = mlreply("View file: ", fname, NFILEN)) != TRUE)
|
if ((s = mlreply("View file: ", fname, sizeof fname)) != TRUE)
|
||||||
return s;
|
return s;
|
||||||
s = getfile(fname, FALSE);
|
s = getfile(fname, FALSE);
|
||||||
if (s) { /* if we succeed, put it in view mode */
|
if (s) { /* if we succeed, put it in view mode */
|
||||||
@ -481,11 +481,11 @@ int filewrite(int f, int n)
|
|||||||
{
|
{
|
||||||
struct window *wp;
|
struct window *wp;
|
||||||
int s;
|
int s;
|
||||||
char fname[NFILEN];
|
fname_t fname ;
|
||||||
|
|
||||||
if (restflag) /* don't allow this command if restricted */
|
if (restflag) /* don't allow this command if restricted */
|
||||||
return resterr();
|
return resterr();
|
||||||
if ((s = mlreply("Write file: ", fname, NFILEN)) != TRUE)
|
if ((s = mlreply("Write file: ", fname, sizeof fname)) != TRUE)
|
||||||
return s;
|
return s;
|
||||||
if ((s = writeout(fname)) == TRUE) {
|
if ((s = writeout(fname)) == TRUE) {
|
||||||
strcpy(curbp->b_fname, fname);
|
strcpy(curbp->b_fname, fname);
|
||||||
@ -608,11 +608,11 @@ int filename(int f, int n)
|
|||||||
{
|
{
|
||||||
struct window *wp;
|
struct window *wp;
|
||||||
int s;
|
int s;
|
||||||
char fname[NFILEN];
|
fname_t fname ;
|
||||||
|
|
||||||
if (restflag) /* don't allow this command if restricted */
|
if (restflag) /* don't allow this command if restricted */
|
||||||
return resterr();
|
return resterr();
|
||||||
if ((s = mlreply("Name: ", fname, NFILEN)) == ABORT)
|
if ((s = mlreply("Name: ", fname, sizeof fname)) == ABORT)
|
||||||
return s;
|
return s;
|
||||||
if (s == FALSE)
|
if (s == FALSE)
|
||||||
strcpy(curbp->b_fname, "");
|
strcpy(curbp->b_fname, "");
|
||||||
|
2
file.h
2
file.h
@ -11,8 +11,6 @@ void cryptbufferkey( struct buffer *bp) ;
|
|||||||
int set_encryption_key( int f, int n) ;
|
int set_encryption_key( int f, int n) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NFILEN 80 /* # of bytes, file name */
|
|
||||||
|
|
||||||
extern boolean restflag ; /* restricted use? */
|
extern boolean restflag ; /* restricted use? */
|
||||||
|
|
||||||
int fileread( int f, int n) ;
|
int fileread( int f, int n) ;
|
||||||
|
4
main.c
4
main.c
@ -274,8 +274,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* set this to inactive */
|
/* set this to inactive */
|
||||||
bp = bfind(bname, TRUE, 0);
|
bp = bfind(bname, TRUE, 0);
|
||||||
strncpy( bp->b_fname, argv[ carg], NFILEN - 1) ; /* max filename length limited to NFILEN - 1 (79) */
|
strncpy( bp->b_fname, argv[ carg], sizeof bp->b_fname - 1) ; /* max filename length limited to NFILEN - 1 (79) */
|
||||||
bp->b_fname[ NFILEN - 1] = 0 ;
|
bp->b_fname[ sizeof bp->b_fname - 1] = 0 ;
|
||||||
bp->b_active = FALSE;
|
bp->b_active = FALSE;
|
||||||
if (firstfile) {
|
if (firstfile) {
|
||||||
firstbp = bp;
|
firstbp = bp;
|
||||||
|
2
spawn.c
2
spawn.c
@ -401,7 +401,7 @@ int filter_buffer(int f, int n)
|
|||||||
int s; /* return status from CLI */
|
int s; /* return status from CLI */
|
||||||
struct buffer *bp; /* pointer to buffer to zot */
|
struct buffer *bp; /* pointer to buffer to zot */
|
||||||
char line[NLINE]; /* command line send to shell */
|
char line[NLINE]; /* command line send to shell */
|
||||||
char tmpnam[NFILEN]; /* place to store real file name */
|
fname_t tmpnam ; /* place to store real file name */
|
||||||
static char bname1[] = "fltinp";
|
static char bname1[] = "fltinp";
|
||||||
|
|
||||||
static char filnam1[] = "fltinp";
|
static char filnam1[] = "fltinp";
|
||||||
|
Loading…
Reference in New Issue
Block a user