Move dependencies from display to log.

This commit is contained in:
Renaud 2013-09-18 14:25:39 +08:00
parent 245c4a0477
commit 45ea35f2a7
11 changed files with 50 additions and 46 deletions

View File

@ -148,8 +148,8 @@ exec.o: exec.c exec.h estruct.h line.h utf8.h buffer.h bind.h edef.h \
display.h eval.h file.h flook.h input.h
execute.o: execute.c edef.h estruct.h line.h utf8.h bind.h random.h \
display.h file.h
file.o: file.c file.h buffer.h estruct.h line.h utf8.h crypt.h display.h \
edef.h execute.h fileio.h input.h lock.h window.h
file.o: file.c file.h buffer.h estruct.h line.h utf8.h crypt.h edef.h \
execute.h fileio.h input.h lock.h log.h window.h
fileio.o: fileio.c fileio.h estruct.h line.h utf8.h crypt.h
flook.o: flook.c flook.h estruct.h line.h utf8.h fileio.h
globals.o: globals.c estruct.h line.h utf8.h edef.h
@ -170,12 +170,12 @@ names.o: names.c names.h basic.h bind.h edef.h estruct.h line.h utf8.h \
pklock.o: pklock.c pklock.h estruct.h line.h utf8.h edef.h
posix.o: posix.c termio.h
random.o: random.c random.h basic.h display.h estruct.h line.h utf8.h \
edef.h execute.h input.h search.h
region.o: region.c region.h estruct.h line.h utf8.h display.h edef.h
edef.h execute.h input.h log.h search.h
region.o: region.c region.h estruct.h line.h utf8.h edef.h log.h
search.o: search.c search.h estruct.h line.h utf8.h basic.h display.h \
edef.h input.h
edef.h input.h log.h
spawn.o: spawn.c spawn.h buffer.h estruct.h line.h utf8.h display.h \
edef.h file.h input.h window.h
edef.h file.h input.h log.h window.h
tcap.o: tcap.c display.h estruct.h line.h utf8.h edef.h termio.h
termio.o: termio.c termio.h estruct.h line.h utf8.h edef.h
utf8.o: utf8.c utf8.h
@ -183,7 +183,7 @@ vmsvt.o: vmsvt.c estruct.h line.h utf8.h edef.h
vt52.o: vt52.c estruct.h line.h utf8.h edef.h
window.o: window.c window.h estruct.h line.h utf8.h basic.h display.h \
edef.h execute.h wrapper.h
word.o: word.c word.h basic.h display.h estruct.h line.h utf8.h edef.h \
word.o: word.c word.h basic.h estruct.h line.h utf8.h edef.h log.h \
random.h region.h
wrapper.o: wrapper.c wrapper.h

View File

@ -1552,11 +1552,3 @@ static int newscreensize(int h, int w)
}
#endif
int resterr(void)
{
TTbeep();
mlwrite("(That command is RESTRICTED)");
return FALSE;
}

View File

@ -20,7 +20,4 @@ void mlputs( char *s) ;
void getscreensize( int *widthp, int *heightp) ;
void sizesignal( int signr) ;
int rdonly( void) ;
int resterr( void) ;
#endif

38
file.c
View File

@ -16,7 +16,6 @@
#include "buffer.h"
#include "crypt.h"
#include "display.h"
#include "estruct.h"
#include "edef.h"
#include "execute.h"
@ -24,6 +23,7 @@
#include "input.h"
#include "line.h"
#include "lock.h"
#include "log.h"
#include "window.h"
#if PKCODE
@ -166,7 +166,7 @@ int set_encryption_key(int f, int n)
strcpy(curbp->b_key, key);
cryptbufferkey( curbp) ;
mlwrite(" "); /* clear it off the bottom line */
logwrite(" "); /* clear it off the bottom line */
return TRUE;
}
@ -228,7 +228,7 @@ int getfile(char *fname, int lockfl)
curwp->w_linep = lp;
curwp->w_flag |= WFMODE | WFHARD;
cknewwindow();
mlwrite("(Old buffer)");
logwrite("(Old buffer)");
return TRUE;
}
}
@ -244,7 +244,7 @@ int getfile(char *fname, int lockfl)
}
}
if (bp == NULL && (bp = bfind(bname, TRUE, 0)) == NULL) {
mlwrite("Cannot create buffer");
logwrite("Cannot create buffer");
return FALSE;
}
if (--curbp->b_nwnd == 0) { /* Undisplay. */
@ -315,12 +315,12 @@ int readin(char *fname, int lockfl)
goto out;
if (s == FIOFNF) { /* File not found. */
mlwrite("(New file)");
logwrite("(New file)");
goto out;
}
/* read the file in */
mlwrite("(Reading file)");
logwrite("(Reading file)");
nline = 0;
while ((s = ffgetline()) == FIOSUC) {
nbytes = fpayload ;
@ -344,7 +344,7 @@ int readin(char *fname, int lockfl)
}
if( s == FIOERR)
mlwrite( "File read error") ;
logwrite( "File read error") ;
switch( ftype) {
case FTYPE_DOS:
@ -383,7 +383,7 @@ int readin(char *fname, int lockfl)
strcat( mesg, ", eol = ") ;
strcat( mesg, eolname[ found_eol]) ;
strcat(mesg, ")");
mlwrite(mesg);
logwrite(mesg);
out:
for (wp = wheadp; wp != NULL; wp = wp->w_wndp) {
@ -515,14 +515,14 @@ int filesave(int f, int n)
if ((curbp->b_flag & BFCHG) == 0) /* Return, no changes. */
return TRUE;
if (curbp->b_fname[0] == 0) { /* Must have a name. */
mlwrite("No file name");
logwrite("No file name");
return FALSE;
}
/* complain about truncated files */
if ((curbp->b_flag & BFTRUNC) != 0) {
if (mlyesno("Truncated file ... write it out") == FALSE) {
mlwrite("(Aborted)");
logwrite("(Aborted)");
return FALSE;
}
}
@ -560,16 +560,16 @@ int writeout(char *fn)
#endif
if ((s = ffwopen(fn)) != FIOSUC) { /* Open writes message. */
mlwrite( "Cannot open file for writing") ;
logwrite( "Cannot open file for writing") ;
return FALSE;
}
mlwrite("(Writing...)"); /* tell us were writing */
logwrite("(Writing...)"); /* tell us were writing */
lp = lforw(curbp->b_linep); /* First line. */
nline = 0; /* Number of lines. */
while (lp != curbp->b_linep) {
s = ffputline( &lp->l_text[0], llength(lp), curbp->b_mode & MDDOS) ;
if( s != FIOSUC) {
mlwrite( "Write I/O error") ;
logwrite( "Write I/O error") ;
break;
}
@ -580,11 +580,11 @@ int writeout(char *fn)
s = ffclose();
if (s == FIOSUC) { /* No close error. */
if (nline == 1)
mlwrite("(Wrote 1 line)");
logwrite("(Wrote 1 line)");
else
mlwrite("(Wrote %d lines)", nline);
logwrite("(Wrote %d lines)", nline);
} else
mlwrite( "Error closing file") ;
logwrite( "Error closing file") ;
} else /* Ignore close error */
ffclose(); /* if a write error. */
if (s != FIOSUC) /* Some sort of error. */
@ -647,10 +647,10 @@ int ifile(char *fname)
if ((s = ffropen(fname)) == FIOERR) /* Hard file open. */
goto out;
if (s == FIOFNF) { /* File not found. */
mlwrite("(No such file)");
logwrite("(No such file)");
return FALSE;
}
mlwrite("(Inserting file)");
logwrite("(Inserting file)");
#if CRYPT
s = resetkey();
@ -699,7 +699,7 @@ int ifile(char *fname)
if (nline > 1)
strcat(mesg, "s");
strcat(mesg, ")");
mlwrite(mesg);
logwrite(mesg);
out:
/* advance to the next line and mark the window for changes */

11
log.c
View File

@ -28,3 +28,14 @@ int rdonly(void)
}
int resterr(void)
{
/* TTbeep();
mlwrite("(That command is RESTRICTED)");
return FALSE;
*/
return logger( FALSE, TRUE, "(That command is RESTRICTED)");
}

1
log.h
View File

@ -1,4 +1,5 @@
int rdonly( void) ;
int resterr( void) ;
extern void (*logwrite)( const char *, ...) ;
extern int (*logger)( int, int, const char *, ...) ;

View File

@ -18,6 +18,7 @@
#include "execute.h"
#include "input.h"
#include "line.h"
#include "log.h"
#include "search.h"
int tabsize; /* Tab size (0: use real tabs) */

View File

@ -12,10 +12,10 @@
#include <stdio.h>
#include "display.h"
#include "estruct.h"
#include "edef.h"
#include "line.h"
#include "log.h"
/*
* Kill the region. Ask "getregion"
@ -72,7 +72,7 @@ int copyregion(int f, int n)
++loffs;
}
}
mlwrite("(region copied)");
logwrite("(region copied)");
return TRUE;
}
@ -169,7 +169,7 @@ int getregion(struct region *rp)
long bsize;
if (curwp->w_markp == NULL) {
mlwrite("No mark set in this window");
logwrite("No mark set in this window");
return FALSE;
}
if (curwp->w_dotp == curwp->w_markp) {
@ -211,6 +211,6 @@ int getregion(struct region *rp)
}
}
}
mlwrite("Bug: lost mark");
logwrite("Bug: lost mark");
return FALSE;
}

View File

@ -68,6 +68,7 @@
#include "edef.h"
#include "input.h"
#include "line.h"
#include "log.h"
#if defined(MAGIC)
/*

View File

@ -17,6 +17,7 @@
#include "edef.h"
#include "file.h"
#include "input.h"
#include "log.h"
#include "window.h"
#if VMS

10
word.c
View File

@ -13,10 +13,10 @@
#include <stdio.h>
#include "basic.h"
#include "display.h"
#include "estruct.h"
#include "edef.h"
#include "line.h"
#include "log.h"
#include "random.h"
#include "region.h"
@ -419,7 +419,7 @@ int fillpara(int f, int n)
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */
if (fillcol == 0) { /* no fill column set */
mlwrite("No fill column set");
logwrite("No fill column set");
return FALSE;
}
#if PKCODE
@ -518,14 +518,14 @@ int justpara(int f, int n)
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return rdonly(); /* we are in read only mode */
if (fillcol == 0) { /* no fill column set */
mlwrite("No fill column set");
logwrite("No fill column set");
return FALSE;
}
justflag = TRUE;
leftmarg = curwp->w_doto;
if (leftmarg + 10 > fillcol) {
leftmarg = 0;
mlwrite("Column too narrow");
logwrite("Column too narrow");
return FALSE;
}
@ -710,7 +710,7 @@ int wordcount(int f, int n)
else
avgch = 0;
mlwrite("Words %D Chars %D Lines %d Avg chars/word %f",
logwrite("Words %D Chars %D Lines %d Avg chars/word %f",
nwords, nchars, nlines + 1, avgch);
return TRUE;
}