mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-19 07:46:24 -05:00
Rewrite ffputline to perform write at once when not encrypted.
This commit is contained in:
parent
4bf4c48056
commit
45c67abc59
21
fileio.c
21
fileio.c
@ -89,26 +89,23 @@ fio_code ffclose(void)
|
|||||||
* and the "nbuf" is its length, less the free newline. Return the status.
|
* and the "nbuf" is its length, less the free newline. Return the status.
|
||||||
* Check only at the newline.
|
* Check only at the newline.
|
||||||
*/
|
*/
|
||||||
fio_code ffputline( char *buf, int nbuf, int dosflag)
|
fio_code ffputline( unsigned char *buf, int nbuf, int dosflag) {
|
||||||
{
|
|
||||||
int i;
|
|
||||||
#if CRYPT
|
#if CRYPT
|
||||||
char c; /* character to translate */
|
|
||||||
|
|
||||||
if( cryptflag) {
|
if( cryptflag) {
|
||||||
for (i = 0; i < nbuf; ++i) {
|
int i ;
|
||||||
c = buf[i] & 0xff;
|
|
||||||
|
for( i = 0 ; i < nbuf ; i++) {
|
||||||
|
unsigned char c ;
|
||||||
|
|
||||||
|
c = buf[ i] ;
|
||||||
myencrypt( &c, 1) ;
|
myencrypt( &c, 1) ;
|
||||||
fputc( c, ffp) ;
|
fputc( c, ffp) ;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
for (i = 0; i < nbuf; ++i)
|
|
||||||
fputc(buf[i] & 0xFF, ffp);
|
|
||||||
#else
|
|
||||||
for (i = 0; i < nbuf; ++i)
|
|
||||||
fputc(buf[i] & 0xFF, ffp);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
fwrite( buf, 1, nbuf, ffp) ;
|
||||||
|
|
||||||
if( dosflag)
|
if( dosflag)
|
||||||
fputc( '\r', ffp) ;
|
fputc( '\r', ffp) ;
|
||||||
|
|
||||||
|
2
fileio.h
2
fileio.h
@ -25,7 +25,7 @@ extern int ftype ;
|
|||||||
boolean fexist( const char *fname) ;
|
boolean fexist( const char *fname) ;
|
||||||
fio_code ffclose( void) ;
|
fio_code ffclose( void) ;
|
||||||
fio_code ffgetline( void) ;
|
fio_code ffgetline( void) ;
|
||||||
fio_code ffputline( char *buf, int nbuf, int dosflag) ;
|
fio_code ffputline( unsigned char *buf, int nbuf, int dosflag) ;
|
||||||
fio_code ffropen( const char *fn) ;
|
fio_code ffropen( const char *fn) ;
|
||||||
fio_code ffwopen( const char *fn) ;
|
fio_code ffwopen( const char *fn) ;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user