1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-07-03 06:35:25 +00:00

Insure consistency when building with CRYPT on or off.

clarify fileio dependencies t crypt.
This commit is contained in:
Renaud 2013-06-10 13:30:06 +08:00
parent 45c67abc59
commit 787189d50c
8 changed files with 51 additions and 23 deletions

View File

@ -221,8 +221,5 @@ static int mod95(int val)
val += 95;
return val;
}
#else
static void myennocrypt(void)
{
}
#endif

1
edef.h
View File

@ -65,7 +65,6 @@ extern struct kill *kbufp; /* current kill buffer chunk pointer */
extern struct kill *kbufh; /* kill buffer header pointer */
extern int kused; /* # of bytes used in KB */
extern struct window *swindow; /* saved window pointer */
extern int cryptflag; /* currently encrypting? */
extern int *kbdptr; /* current position in keyboard buf */
extern int *kbdend; /* ptr to end of the keyboard */
extern int kbdmode; /* current keyboard macro mode */

View File

@ -491,7 +491,9 @@ struct buffer {
#define MDVIEW 0x0010 /* read-only buffer */
#define MDOVER 0x0020 /* overwrite mode */
#define MDMAGIC 0x0040 /* regular expresions in search */
#if CRYPT
#define MDCRYPT 0x0080 /* encrytion mode active */
#endif
#define MDASAVE 0x0100 /* auto-save mode */
#define MDUTF8 0x0200 /* utf8 mode */
#define MDDOS 0x0400 /* CRLF eol mode */

4
file.c
View File

@ -124,7 +124,7 @@ static int resetkey(void)
int s; /* return status */
/* turn off the encryption flag */
cryptflag = FALSE;
is_crypted = FALSE;
/* if we are in crypt mode */
if (curbp->b_mode & MDCRYPT) {
@ -135,7 +135,7 @@ static int resetkey(void)
}
/* let others know... */
cryptflag = TRUE;
is_crypted = TRUE;
/* and set up the key to be used! */
/* de-encrypt it */

View File

@ -11,17 +11,27 @@
*/
#include <stdio.h>
#include "crypt.h"
#include "display.h"
#include <stdlib.h>
#include <string.h>
#include "estruct.h"
#include "edef.h"
#include "display.h"
static FILE *ffp; /* File pointer, all functions. */
static boolean eofflag ; /* end-of-file flag */
char *fline = NULL; /* dynamic return line */
int flen = 0; /* current length of fline */
int ftype ;
#if CRYPT
#include "crypt.h"
boolean is_crypted ; /* currently encrypting? */
#endif
char *fline = NULL ; /* dynamic return line */
int flen = 0 ; /* current length of fline */
int ftype ;
static FILE *ffp ; /* File pointer, all functions. */
static boolean eofflag ; /* end-of-file flag */
/*
* Open a file for reading.
@ -91,7 +101,7 @@ fio_code ffclose(void)
*/
fio_code ffputline( unsigned char *buf, int nbuf, int dosflag) {
#if CRYPT
if( cryptflag) {
if( is_crypted) {
int i ;
for( i = 0 ; i < nbuf ; i++) {
@ -213,7 +223,7 @@ fio_code ffgetline(void)
/* terminate and decrypt the string */
fline[i] = 0;
#if CRYPT
if (cryptflag)
if( is_crypted)
myencrypt(fline, strlen(fline));
#endif
return FIOSUC;

View File

@ -18,9 +18,13 @@ typedef enum {
#define FTYPE_MAC 4
/* FTYPE_MIXED [ 3, 5, 6, 7] */
extern char *fline ; /* dynamic return line */
extern int flen ; /* current length of fline */
extern int ftype ;
#if CRYPT
extern boolean is_crypted ; /* currently encrypting? */
#endif
extern char *fline ; /* dynamic return line */
extern int flen ; /* current length of fline */
extern int ftype ;
boolean fexist( const char *fname) ;
fio_code ffclose( void) ;

View File

@ -13,13 +13,28 @@ int revexist = FALSE; /* does reverse video exist? */
int flickcode = FALSE; /* do flicker supression? */
const char *modename[] = { /* name of modes */
"WRAP", "CMODE", "SPELL", "EXACT", "VIEW", "OVER",
"MAGIC", "CRYPT", "ASAVE", "UTF-8", "DOS"
"MAGIC",
#if CRYPT
"CRYPT",
#else
"",
#endif
"ASAVE", "UTF-8", "DOS"
};
const char *mode2name[] = { /* name of modes */
"Wrap", "Cmode", "Spell", "Exact", "View", "Over",
"Magic", "Crypt", "Asave", "utf-8", "Dos"
"Magic",
#if CRYPT
"Crypt",
#else
"",
#endif
"Asave", "utf-8", "Dos"
};
const char modecode[] = "WCSEVOMYAUD"; /* letters to represent modes */
int gmode = 0; /* global editor mode */
int gflags = GFREAD; /* global control flag */
#if PKCODE & IBMPC
@ -62,7 +77,6 @@ struct kill *kbufp = NULL; /* current kill buffer chunk pointer */
struct kill *kbufh = NULL; /* kill buffer header pointer */
int kused = KBLOCK; /* # of bytes used in kill buffer */
struct window *swindow = NULL; /* saved window pointer */
int cryptflag = FALSE; /* currently encrypting? */
int *kbdptr; /* current position in keyboard buf */
int *kbdend = &kbdm[0]; /* ptr to end of the keyboard */
int kbdmode = STOP; /* current keyboard macro mode */

2
main.c
View File

@ -114,7 +114,9 @@ static void usage( void) {
" -a|A process error file\n"
" -e|E edit file\n"
" -g|G<n> go to line <n>\n"
#if CRYPT
" -k|K<key> use code key\n"
#endif
" -n|N accept null chars\n"
" -r|R restrictive use\n"
" -s|S<string> search string\n"