crypto patches for SysV/TurboC & Bugfixes
Wayne Davison
davison at drivax.UUCP
Sat Oct 8 06:39:19 AEST 1988
I recently ported my crypto program over to Turbo C using the PC curses that
came over the net long ago. In the process, I discovered a couple bugs, and
made the file more portable. Plus, Keith Waclena just mailed me a patch for
System V support, which I have also integrated. I also made a minor command
change because, as Brad Needham mentioned, some folks can't type ^S, even in
raw mode. ^S still works (if you can type it), but ^V is now the documented
command.
To apply this patch, feed this entire file to Larry Wall's patch program, or
grind out the changes by hand with your favorite editor.
For everyone who took the time to write me, thanx a lot!
--
Wayne Davison ...amdahl!drivax!davison
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Qn qyrzx zkhn ly ubbren tyr loul lon crkxnx skbbkznb jreenplzt jypwneckpc
qklo tyre bokf uen fuel ya u bfnjkuz bnewkjn qn ndlnpx ly uzz ya yre sybl
nplorbkublkj jzknplb, upx lon arzzt uesnx prjznue queonuxb uen, ya jyrebn
snenzt u jyrelnbt xnlukz. Qn zyyh ayequex ly tyre jrblys kp arlren zkwnb.
-- Lon Okljookhne'b Crkxn ly lon Cuzudt
*** old/Makefile Thu Oct 6 18:48:40 1988
--- Makefile Thu Oct 6 20:17:32 1988
***************
*** 1,13 ****
##
! ## Simple Makefile:
##
! ## Edit appropriately.
LIBS = -lcurses -ltermcap
! ## Choose one:
! CFLAGS = -O
! ## or
! #CFLAGS = -O -Drindex=strrchr
!
! crypto: crypto.c
! cc $(CFLAGS) crypto.c -o crypto $(LIBS)
--- 1,20 ----
##
! ## Makefile for crypto.c
##
! ## Choose your poison:
!
! ## BSD
LIBS = -lcurses -ltermcap
! CC = cc -DBSD -O -o crypto
!
! ## System V
! #LIBS = -lcurses
! #CC = cc -s -DSYSV -O -o crypto
!
! ## Turbo C
! #LIBS = scurses.lib
! #CC = tcc -DTURBO -O -Ic:\turboc\include -Lc:\turboc\lib
!
! crypto: local.h crypto.c
! $(CC) crypto.c $(LIBS)
*** old/crypto.c Thu Oct 6 18:49:29 1988
--- crypto.c Thu Oct 6 21:04:43 1988
***************
*** 1,3 ****
#include <stdio.h>
#include <curses.h>
#include <signal.h>
--- 1,7 ----
+ /*----------------------------------------------------------*\
+ || crypto.c -- the cryptogram-solver's friend, version 1.01 ||
+ \*----------------------------------------------------------*/
+
#include <stdio.h>
#include <curses.h>
#include <signal.h>
***************
*** 1,9 ****
#include <stdio.h>
#include <curses.h>
#include <signal.h>
!
! #define COLS 80
! #define ROWS (24-2)
#define INIT_GUESS 1
#define INIT_CYPHER 2
--- 5,12 ----
#include <stdio.h>
#include <curses.h>
#include <signal.h>
! #include <ctype.h>
! #include "local.h"
#define INIT_GUESS 1
#define INIT_CYPHER 2
***************
*** 14,20 ****
#define DRAW_HINT_ON 3
#define DRAW_HINT_OFF 4
- #define BUFF_SIZE 8176
#define PUZZLE_MAX (ROWS-2)
char *buffer, *buff_cp, *buff_titles; /* main buffer pointers */
--- 17,22 ----
#define DRAW_HINT_ON 3
#define DRAW_HINT_OFF 4
#define PUZZLE_MAX (ROWS-2)
char *buffer, *buff_cp, *buff_titles; /* main buffer pointers */
***************
*** 42,54 ****
char toggle_flag = 0, easy_flag = 0, init_flag = 0;
! #define ISPUNCT(ch) ((ch) < 'A' || (ch) > 'z' || ((ch) > 'Z' && (ch) < 'a'))
! #define ISUPPER(ch) ((ch) <= 'Z' && (ch) >= 'A')
! #define ISLOWER(ch) ((ch) >= 'a' && (ch) <= 'z')
! #define TOUPPER(ch) (ISLOWER(ch)? (ch)-('a'-'A') : (ch))
! #define TOLOWER(ch) (ISUPPER(ch)? (ch)+('a'-'A') : (ch))
!
long random();
void wrap_it_up();
char *malloc(), *rindex();
--- 44,52 ----
char toggle_flag = 0, easy_flag = 0, init_flag = 0;
! #ifdef BSD
long random();
+ #endif
void wrap_it_up();
char *malloc(), *rindex();
***************
*** 62,68 ****
/*
|| Remember who we are.
*/
! if( (myname = rindex( *argv, '/' )) == NULL ) {
myname = *argv;
} else {
++myname;
--- 60,66 ----
/*
|| Remember who we are.
*/
! if( (myname = rindex( *argv, PATHCHAR )) == NULL ) {
myname = *argv;
} else {
++myname;
***************
*** 67,72 ****
} else {
++myname;
}
/*
|| Check arg count. If no args, tell them about us.
*/
--- 65,74 ----
} else {
++myname;
}
+ #ifdef TURBO
+ *rindex( myname, '.' ) = '\0';
+ strlwr( myname );
+ #endif
/*
|| Check arg count. If no args, tell them about us.
*/
***************
*** 102,108 ****
while( *++*argv <= '9' && **argv >= '0' ) {
;
}
! *--*argv;
case 'e':
encrypt_flag = 1; /* enable encryption */
break;
--- 104,110 ----
while( *++*argv <= '9' && **argv >= '0' ) {
;
}
! --*argv;
case 'e':
encrypt_flag = 1; /* enable encryption */
break;
***************
*** 209,215 ****
savetty();
noecho();
raw();
!
signal( SIGINT, wrap_it_up );
if( signal( SIGQUIT, SIG_IGN ) != SIG_IGN ) {
signal( SIGQUIT, wrap_it_up );
--- 211,240 ----
savetty();
noecho();
raw();
! nonl();
!
! #ifdef SYSV
! /*
! ** KDW: turn off flow control to allow ^S and ^Q to be used as commands.
! ** (Seems like raw() ought to do this.)
! */
! {
! #include <termio.h>
! struct termio tbuf;
!
! if( ioctl( 0, TCGETA, &tbuf ) == -1 ) {
! perror("ioctl: TCGETA");
! exit( 2 );
! }
! tbuf.c_iflag &= ~IXON;
! if( ioctl( 0, TCSETAF, &tbuf ) == -1 ) {
! perror( "ioctl: TCSETAF" );
! exit( 2 );
! }
! }
! #endif
!
! #ifndef TURBO
signal( SIGINT, wrap_it_up );
if( signal( SIGQUIT, SIG_IGN ) != SIG_IGN ) {
signal( SIGQUIT, wrap_it_up );
***************
*** 214,219 ****
if( signal( SIGQUIT, SIG_IGN ) != SIG_IGN ) {
signal( SIGQUIT, wrap_it_up );
}
/*
|| Select the first (or only) puzzle to solve.
--- 239,245 ----
if( signal( SIGQUIT, SIG_IGN ) != SIG_IGN ) {
signal( SIGQUIT, wrap_it_up );
}
+ #endif
/*
|| Select the first (or only) puzzle to solve.
***************
*** 233,240 ****
ch = getch();
ch = TOLOWER(ch);
switch( ch ) {
! case 'Q'-'@': /* quit the program */
! case '['-'@':
case EOF:
if( !ok_to_exit() ) { /* is it ok to exit? */
ch = char_prompt( ROWS, 34, "Exit? (Y/N)? " );
--- 259,266 ----
ch = getch();
ch = TOLOWER(ch);
switch( ch ) {
! case CTRL_Q: /* quit the program */
! case ESC:
case EOF:
if( !ok_to_exit() ) { /* is it ok to exit? */
ch = char_prompt( ROWS, 34, "Exit? (Y/N)? " );
***************
*** 244,250 ****
}
wrap_it_up(); /* cleanup & exit */
break;
! case 'U'-'@': /* undo a guessed letter */
ch = char_prompt( ROWS, 46, "Undo: " );
if( ISLOWER(ch) ) {
guess[ch-'a'] = '_';
--- 270,276 ----
}
wrap_it_up(); /* cleanup & exit */
break;
! case CTRL_U: /* undo a guessed letter */
ch = char_prompt( ROWS, 46, "Undo: " );
if( ISLOWER(ch) ) {
guess[ch-'a'] = '_';
***************
*** 254,260 ****
status_msg = "Invalid entry";
}
break;
! case 'X'-'@': /* undo all guessed letters */
for( i = 0; i < 26; ++i ) {
guess[i] = '_';
}
--- 280,286 ----
status_msg = "Invalid entry";
}
break;
! case CTRL_X: /* undo all guessed letters */
for( i = 0; i < 26; ++i ) {
guess[i] = '_';
}
***************
*** 261,267 ****
draw_mode = DRAW_CRYPT_MSGS;
puzz->changed = TRUE;
break;
! case 'C'-'@': /* they want to cheat! */
if( !cypher_flag ) {
status_msg = "Unable to cheat -- Sorry!";
break;
--- 287,293 ----
draw_mode = DRAW_CRYPT_MSGS;
puzz->changed = TRUE;
break;
! case CTRL_C: /* they want to cheat! */
if( !cypher_flag ) {
status_msg = "Unable to cheat -- Sorry!";
break;
***************
*** 267,274 ****
break;
}
status_msg = "That's all the cheating I know!";
! ch = (random() % 26);
! for( i = 0; i < 26; ++i ) {
if( used[i] ) {
for( j = 0; j < 26; ++j ) {
if( cypher[j] == i+'a' ) {
--- 293,300 ----
break;
}
status_msg = "That's all the cheating I know!";
! i = (random() % 26);
! for( ch = 0; ch < 26; ++ch ) {
if( used[i] ) {
for( j = 0; j < 26; ++j ) {
if( cypher[j] == i+'a' ) {
***************
*** 296,302 ****
break;
}
}
! ch = (ch + 1) % 26;
}
draw_mode = DRAW_CRYPT_MSGS;
puzz->changed = TRUE;
--- 322,328 ----
break;
}
}
! i = (i + 1) % 26;
}
draw_mode = DRAW_CRYPT_MSGS;
puzz->changed = TRUE;
***************
*** 301,310 ****
draw_mode = DRAW_CRYPT_MSGS;
puzz->changed = TRUE;
break;
! case 'H'-'@': /* Hint (dictionary search) */
hint();
break;
! case 'D'-'@': /* define solution */
if( cypher_flag > 0 ) {
status_msg = "I like my solution better.";
break;
--- 327,336 ----
draw_mode = DRAW_CRYPT_MSGS;
puzz->changed = TRUE;
break;
! case CTRL_H: /* Hint (dictionary search) */
hint();
break;
! case CTRL_D: /* define solution */
if( cypher_flag > 0 ) {
status_msg = "I like my solution better.";
break;
***************
*** 321,327 ****
status_msg = "Defined solution.";
puzz->changed = TRUE;
break;
! case 'S'-'@': /* save current puzzle state */
if( !save_file( ROWS, 34, FALSE ) ) {
break;
}
--- 347,354 ----
status_msg = "Defined solution.";
puzz->changed = TRUE;
break;
! case CTRL_S: /* save current puzzle state */
! case CTRL_V:
if( !save_file( ROWS, 34, FALSE ) ) {
break;
}
***************
*** 331,339 ****
status_msg = "Saved puzzle.";
}
break;
! case 'T'-'@': /* enter new title for cryptogram */
! move( ROWS, 0 );
! clrtobot();
if( string_prompt( ROWS, 0, "Title: " ) ) {
status_msg = "Aborted.";
break;
--- 358,365 ----
status_msg = "Saved puzzle.";
}
break;
! case CTRL_T: /* enter new title for cryptogram */
! mvclrtobot( ROWS, 0 );
if( string_prompt( ROWS, 0, "Title: " ) ) {
status_msg = "Aborted.";
break;
***************
*** 363,372 ****
puzz->title = buff_titles;
puzz->changed = TRUE;
break;
! case 'A'-'@': /* toggle alphabet display mode */
toggle_flag = !toggle_flag;
break;
! case 'N'-'@': /* next puzzle (if multi-puzzled) */
if( ++puz_number > puz_count ) {
puz_number = 0;
}
--- 389,398 ----
puzz->title = buff_titles;
puzz->changed = TRUE;
break;
! case CTRL_A: /* toggle alphabet display mode */
toggle_flag = !toggle_flag;
break;
! case CTRL_N: /* next puzzle (if multi-puzzled) */
if( ++puz_number > puz_count ) {
puz_number = 0;
}
***************
*** 373,379 ****
select_puzzle( puz_number );
draw_mode = DRAW_CRYPT_MSGS;
break;
! case 'P'-'@': /* previous puzzle (if multi-puzzled) */
if( --puz_number < 0 ) {
puz_number = puz_count;
}
--- 399,405 ----
select_puzzle( puz_number );
draw_mode = DRAW_CRYPT_MSGS;
break;
! case CTRL_P: /* previous puzzle (if multi-puzzled) */
if( --puz_number < 0 ) {
puz_number = puz_count;
}
***************
*** 380,386 ****
select_puzzle( puz_number );
draw_mode = DRAW_CRYPT_MSGS;
break;
! case 'M'-'@': /* display Menu of puzzles */
if( !puzzle_prompt() ) { /* check if they hit Esc */
wrap_it_up(); /* cleanup & exit */
}
--- 406,412 ----
select_puzzle( puz_number );
draw_mode = DRAW_CRYPT_MSGS;
break;
! case CTRL_M: /* display Menu of puzzles */
if( !puzzle_prompt() ) { /* check if they hit Esc */
wrap_it_up(); /* cleanup & exit */
}
***************
*** 389,396 ****
break;
case '?': /* output command summary */
clear();
! mvprintw( 0, 13, "%s -- a cryptogram solver, By: Wayne Davison\n",
! myname );
refresh();
help2();
mvaddstr( ROWS+1, 32, "[Press any key]" );
--- 415,421 ----
break;
case '?': /* output command summary */
clear();
! mvprintw( 0, 23, "%s v1.01, By: Wayne Davison\n", myname );
refresh();
help2();
mvaddstr( ROWS+1, 32, "[Press any key]" );
***************
*** 396,403 ****
mvaddstr( ROWS+1, 32, "[Press any key]" );
refresh();
getch(); /* (fall through) */
! case 'L'-'@':
! case 'R'-'@':
clear();
draw_mode = DRAW_CRYPT_MSGS;
break;
--- 421,428 ----
mvaddstr( ROWS+1, 32, "[Press any key]" );
refresh();
getch(); /* (fall through) */
! case CTRL_L:
! case CTRL_R:
clear();
draw_mode = DRAW_CRYPT_MSGS;
break;
***************
*** 446,452 ****
if( ISLOWER(ch2) ) {
guess[ch-'a'] = ch2;
puzz->changed = TRUE;
! } else if( ch2 != '\010' && ch2 != '\177' ) {
guess[ch-'a'] = '_';
puzz->changed = TRUE;
}
--- 471,477 ----
if( ISLOWER(ch2) ) {
guess[ch-'a'] = ch2;
puzz->changed = TRUE;
! } else if( ch2 != BKSP && ch2 != DEL ) {
guess[ch-'a'] = '_';
puzz->changed = TRUE;
}
***************
*** 549,554 ****
}
}
if( ch == '\n' ) {
if( line_start[0] == '{' && *(buff_cp-1) == '}'
&& line_start[1] == '-' ) {
if( (ch = line_start[2]) == 'c' || ch == 'g' ) {
--- 574,580 ----
}
}
if( ch == '\n' ) {
+ *buff_cp = '\0';
if( line_start[0] == '{' && *(buff_cp-1) == '}'
&& line_start[1] == '-' ) {
if( (ch = line_start[2]) == 'c' || ch == 'g' ) {
***************
*** 634,640 ****
*buff_cp++ = '\0';
line_start = buff_cp;
continue;
! } else if( ch == '\010' && buff_cp != line_start ) {
--buff_cp; /* Backspace erases last char */
continue;
} else if( ch == '\t' ) {
--- 660,666 ----
*buff_cp++ = '\0';
line_start = buff_cp;
continue;
! } else if( ch == '\b' && buff_cp != line_start ) {
--buff_cp; /* Backspace erases last char */
continue;
} else if( ch == '\t' ) {
***************
*** 698,704 ****
mvprintw( i+j, 0, "%2d. %s", i+1, puzzle[i].title? puzzle[i].title
: "<Untitled>" );
}
! mvaddstr( i+j+1, 0, "<Press Esc to exit, ^S to save all the puzzles>" );
/*
|| Ask the user which puzzle to start with.
*/
--- 724,730 ----
mvprintw( i+j, 0, "%2d. %s", i+1, puzzle[i].title? puzzle[i].title
: "<Untitled>" );
}
! mvaddstr( i+j+1, 0, "<Press Esc to exit, ^V to save all the puzzles>" );
/*
|| Ask the user which puzzle to start with.
*/
***************
*** 892,899 ****
clrtoeol();
refresh();
cp = string;
! while( (ch = getch()) != '\r' ) {
! if( ch == '['-'@' || ch == 'C'-'@' || ch == EOF ) {
*string = '\0';
return( 1 );
}
--- 918,925 ----
clrtoeol();
refresh();
cp = string;
! while( (ch = getch()) != '\r' && ch != '\n' ) {
! if( ch == ESC || ch == CTRL_C || ch == EOF ) {
*string = '\0';
return( 1 );
}
***************
*** 897,908 ****
*string = '\0';
return( 1 );
}
! if( ch == 'S'-'@' && col == 0 ) {
return( 2 );
}
! if( (ch == 'H'-'@' || ch == '\177') && cp != string ) {
--cp;
! ch = '\010';
addch( ch );
addch( ' ' );
} else if( ch >= ' ' && cp-string < 80 ) {
--- 923,934 ----
*string = '\0';
return( 1 );
}
! if( (ch == CTRL_S || ch == CTRL_V) && col == 0 ) {
return( 2 );
}
! if( (ch == BKSP || ch == DEL) && cp != string ) {
--cp;
! ch = '\b';
addch( ch );
addch( ' ' );
} else if( ch >= ' ' && cp-string < 80 ) {
***************
*** 1032,1039 ****
/*
|| Prompt for hint-word selection.
*/
! move( ROWS, 0 );
! clrtobot();
if( status_msg ) {
mvaddstr( ROWS+1, 0, status_msg );
status_msg = NULL;
--- 1058,1064 ----
/*
|| Prompt for hint-word selection.
*/
! mvclrtobot( ROWS, 0 );
if( status_msg ) {
mvaddstr( ROWS+1, 0, status_msg );
status_msg = NULL;
***************
*** 1184,1190 ****
for( ;; ) {
screen_update( DRAW_HINT_ON );
ch = getch();
! if( (ch = TOLOWER(ch)) == 'y' || ch == 'M'-'@' ) {
addch( 'Y' );
refresh();
match();
--- 1209,1215 ----
for( ;; ) {
screen_update( DRAW_HINT_ON );
ch = getch();
! if( (ch = TOLOWER(ch)) == 'y' || ch == CTRL_M ) {
addch( 'Y' );
refresh();
match();
***************
*** 1243,1250 ****
puzz->hint_cp = puzz->ptr;
break;
case 'q': /* quit hint mode */
! case 'Q'-'@':
! case '['-'@':
return;
case '?': /* output help */
help3( 1 );
--- 1268,1275 ----
puzz->hint_cp = puzz->ptr;
break;
case 'q': /* quit hint mode */
! case CTRL_Q:
! case ESC:
return;
case '?': /* output help */
help3( 1 );
***************
*** 1281,1287 ****
register char *s, *t;
register int j, slen, tlen;
! fchan = fopen( "/usr/dict/words", "r" );
if( !fchan ) {
status_msg = "Couldn't find dictionary!";
screen_update( DRAW_HINT_OFF );
--- 1306,1312 ----
register char *s, *t;
register int j, slen, tlen;
! fchan = fopen( DICTIONARY, "r" );
if( !fchan ) {
status_msg = "Couldn't find dictionary!";
screen_update( DRAW_HINT_OFF );
***************
*** 1347,1354 ****
refresh();
switch( j ) {
case 'q':
! case 'Q'-'@':
! case '['-'@':
screen_update( DRAW_HINT_OFF );
goto noloop;
case 'y':
--- 1372,1379 ----
refresh();
switch( j ) {
case 'q':
! case CTRL_Q:
! case ESC:
screen_update( DRAW_HINT_OFF );
goto noloop;
case 'y':
***************
*** 1352,1358 ****
screen_update( DRAW_HINT_OFF );
goto noloop;
case 'y':
! case 'M'-'@':
for( s = str, t = puzz->hint_cp; *s; ++s, ++t ) {
if( *t != '\'' ) {
guess[TOLOWER(*t)-'a'] = *s;
--- 1377,1383 ----
screen_update( DRAW_HINT_OFF );
goto noloop;
case 'y':
! case CTRL_M:
for( s = str, t = puzz->hint_cp; *s; ++s, ++t ) {
if( *t != '\'' ) {
guess[TOLOWER(*t)-'a'] = *s;
***************
*** 1418,1424 ****
printf( "^A toggle the Alpha display between the two different output modes.\n\r" );
printf( "^T enter a (new) Title for this puzzle.\n\r" );
printf( "^D Define the current guess to be the solution. Useful before a save.\n\r" );
! printf( "^S<file> Save the current puzzle, guess, & cypher information in a file.\n\r" );
printf( " Use the command: %s <file> to restore where you were.\n\r", myname );
printf( "^N go to the Next puzzle when multiple puzzles are present.\n\r" );
printf( "^P go to the Previous puzzle when multiple puzzles are present.\n\r" );
--- 1443,1449 ----
printf( "^A toggle the Alpha display between the two different output modes.\n\r" );
printf( "^T enter a (new) Title for this puzzle.\n\r" );
printf( "^D Define the current guess to be the solution. Useful before a save.\n\r" );
! printf( "^V<file> saVe the current puzzle, guess, & cypher information in a file.\n\r" );
printf( " Use the command: %s <file> to restore where you were.\n\r", myname );
printf( "^N go to the Next puzzle when multiple puzzles are present.\n\r" );
printf( "^P go to the Previous puzzle when multiple puzzles are present.\n\r" );
***************
*** 1457,1459 ****
clear();
screen_update( DRAW_CRYPT );
}
--- 1482,1496 ----
clear();
screen_update( DRAW_CRYPT );
}
+
+ #ifdef TURBO
+ char *ttyname( fn )
+ int fn;
+ {
+ if( isatty( fn ) ) {
+ return( "con" );
+ } else {
+ return( NULL );
+ }
+ }
+ #endif
*** old/local.h Thu Oct 6 19:01:05 1988
--- local.h Thu Oct 6 21:19:41 1988
***************
*** 0 ****
--- 1,63 ----
+ /*--------------------------------------------------------------*\
+ || local.h -- A local definition file for crypto version 1.01 ||
+ \*--------------------------------------------------------------*/
+
+ #define COLS 80
+ #define ROWS (24-2)
+
+ #define BUFF_SIZE 8176
+
+ #ifdef TURBO
+ # define PCCURSES
+ # define PATHCHAR '\\'
+ #else
+ # define PATHCHAR '/'
+ #endif
+
+ #ifndef BSD
+ # define rindex strrchr
+ # ifdef SYSV
+ # define srandom srand48
+ # define random(x) (int) drand48(x)
+ # ifndef DICTIONARY
+ # define DICTIONARY "/usr/lib/spell/list"
+ # endif
+ # else
+ # define random rand
+ # define srandom srand
+ # endif
+ #endif
+
+ #ifndef DICTIONARY
+ # define DICTIONARY "/usr/dict/words"
+ #endif
+
+ #ifndef PCCURSES
+ # define mvclrtobot( y, x ) move( y, x ), clrtobot();
+ #endif
+
+ #define CTRL_A '\001'
+ #define CTRL_C '\003'
+ #define CTRL_D '\004'
+ #define CTRL_H '\010'
+ #define CTRL_L '\014'
+ #define CTRL_M '\015'
+ #define CTRL_N '\016'
+ #define CTRL_P '\020'
+ #define CTRL_Q '\021'
+ #define CTRL_R '\022'
+ #define CTRL_S '\023'
+ #define CTRL_T '\024'
+ #define CTRL_U '\025'
+ #define CTRL_V '\026'
+ #define CTRL_X '\030'
+
+ #define BKSP '\010'
+ #define DEL '\177'
+ #define ESC '\033'
+
+ #define ISPUNCT( x ) !isalpha( x )
+ #define ISUPPER( x ) isupper( x )
+ #define ISLOWER( x ) islower( x )
+ #define TOUPPER( x ) (islower( x ) ? toupper( x ) : ( x ))
+ #define TOLOWER( x ) (isupper( x ) ? tolower( x ) : ( x ))
*** old/crypto.man Thu Oct 6 18:49:36 1988
--- crypto.man Thu Sep 29 20:04:12 1988
***************
*** 1,6 ****
.TH CRYPTO 1 LOCAL
.SH NAME
! crypto \- a program to generate and/or solve cryptograms
.SH SYNOPSIS
.B crypto
[-cegrsu] [file(s)]
--- 1,6 ----
.TH CRYPTO 1 LOCAL
.SH NAME
! crypto \- the cryptogram puzzler's friend
.SH SYNOPSIS
.B crypto
[-cegrsu] [file(s)]
***************
*** 6,15 ****
[-cegrsu] [file(s)]
.SH DESCRIPTION
.I Crypto
! is a fun program for playing around with cryptograms. It can be used
! to encode text with a random or user-picked cypher, to interactively solve
! cryptogram puzzles, to non-interactively apply a solution to a text file,
! and to save the results to the file of your choice.
.PP
In normal usage, text is taken from the specified file (or
the standard input), encoded (if needed) and displayed for
--- 6,30 ----
[-cegrsu] [file(s)]
.SH DESCRIPTION
.I Crypto
! is a fun program for playing around with cryptograms. It can be used to:
! .TP 3
! .B o
! Encode regular text with a random or user-picked cypher
! .TP 3
! .B o
! Use pre-encoded files which might include the solution
! .TP 3
! .B o
! Interactivley place letters into the puzzle
! .TP 3
! .B o
! Non-interactivley encode/decode puzzle text
! .TP 3
! .B o
! Search /usr/dict/words for possible matches of a particular word
! .TP 3
! .B o
! Create/access multi-puzzle files
.PP
In normal usage, text is taken from the specified file (or
the standard input), encoded (if needed) and displayed for
***************
*** 53,59 ****
the command-line. Each puzzle has a unique guess, cypher, and title.
.PP
When multiple puzzles are loaded, you will be presented with a menu
! of choices for your initial puzzle. From there, the save command (^S)
saves all the puzzles into a single file. This menu can be visited at
any time with the menu command (^M).
.PP
--- 68,74 ----
the command-line. Each puzzle has a unique guess, cypher, and title.
.PP
When multiple puzzles are loaded, you will be presented with a menu
! of choices for your initial puzzle. From there, the save command (^V)
saves all the puzzles into a single file. This menu can be visited at
any time with the menu command (^M).
.PP
***************
*** 57,62 ****
saves all the puzzles into a single file. This menu can be visited at
any time with the menu command (^M).
.PP
Here is a complete list of the interactive commands available. You can
get a summary of this list with the command
.I crypto -i
--- 72,87 ----
saves all the puzzles into a single file. This menu can be visited at
any time with the menu command (^M).
.PP
+ An easy way to create a multi-puzzle file would be to execute the command:
+ .sp
+ fortune | crypto -e >>puzz
+ .sp
+ ten times. You could then use the command:
+ .sp
+ crypto puzz
+ .sp
+ to solve all ten puzzles at your leisure.
+ .PP
Here is a complete list of the interactive commands available. You can
get a summary of this list with the command
.I crypto -i
***************
*** 82,89 ****
Cheat -- if I know the solution, I will correct one letter in the
puzzle each time you decide to cheat.
.TP 13
! .B ^S<file>
! Save the current puzzle, guess, and cypher information in a file.
This allows you to continue where ever you left off with
the command crypto <file>
.TP 13
--- 107,114 ----
Cheat -- if I know the solution, I will correct one letter in the
puzzle each time you decide to cheat.
.TP 13
! .B ^V<file>
! saVe the current puzzle, guess, and cypher information in a file.
This allows you to continue where ever you left off with
the command crypto <file>
.TP 13
More information about the Comp.sources.bugs
mailing list