--- pgp/src/more.c 2018/04/24 16:38:22 1.1.1.2 +++ pgp/src/more.c 2018/04/24 16:39:57 1.1.1.4 @@ -24,28 +24,31 @@ #include #ifdef UNIX #include +#include "system.h" #endif #ifdef sco #include #include +FILE *popen(); #endif #include "mpilib.h" #include "language.h" #include "fileio.h" #include "pgp.h" - -/* Prototype for getch() */ - -int getch( void ); +#include "more.h" +#include "charset.h" #ifdef MSDOS +#ifndef __GO32__ +#include +#endif #define DEFAULT_LINES 25 /* MSDOS actually has a 25-line screen */ #else #define DEFAULT_LINES 24 #endif /* MSDOS */ #define DEFAULT_COLUMNS 80 -int screen_lines = DEFAULT_LINES, screen_columns = DEFAULT_COLUMNS; +static int screen_lines = DEFAULT_LINES, screen_columns = DEFAULT_COLUMNS; #define TAB 0x09 /* ASCII tab char */ #define CR '\r' /* Carriage return char */ @@ -252,7 +255,7 @@ int more_file(char *fileName) return(-1); fread(buf, 1, 16, inFile); - if (compressSignature(buf) >= 0) + if (compressSignature( (byte *) buf) >= 0) { fprintf(pgpout, PSTR("\n\007File '%s' is not a text file; cannot display.\n"), fileName); return(-1); @@ -265,7 +268,15 @@ int more_file(char *fileName) if ((p = getenv("PAGER")) != NULL) strncpy(pager, p, sizeof(pager) - 1); } - /* Use built-in pager if PAGER is not set or if this is for your eyes only */ + if (strcmp(pager, "cat") == 0) + { fclose(inFile); + writePhantomOutput(fileName); + return 0; + } + + /* Use built-in pager if PAGER is not set or if this is for your eyes only, + this currently doesn't work, the _CONSOLE filename isn't used as the real + filename anymore */ if ((strcmp(fileName,CONSOLE_FILENAME) != 0) && (strlen(pager) != 0) && strcmp("pgp", pager)) { @@ -282,6 +293,7 @@ int more_file(char *fileName) *p = '\\'; #endif #endif + fflush(pgpout); return(system(cmd)); } @@ -335,7 +347,8 @@ int more_file(char *fileName) rest of the line */ if (chars == screen_columns - 1) { chars = 0; - while ((ch = getc(inFile)) != CR && ch != LF && ch != EOF ); + while ((ch = getc(inFile)) != CR && ch != LF && ch != EOF ) + ; if (ch != EOF) ungetc(ch,inFile); } @@ -402,15 +415,18 @@ static FILE *savepgpout; int -open_more() +open_more(void) { +#ifdef UNIX char *p; +#endif if (mfile || piping) close_more(); savepgpout = pgpout; #ifdef UNIX + fflush(pgpout); if (pager[0] == '\0') { if ((p = getenv("PAGER")) != NULL) @@ -442,7 +458,7 @@ open_more() } int -close_more() +close_more(void) { if (!mfile && !piping) return 0;