Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds option to unlock terminal by pressing L thrice #172

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmatrix.1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Use old-style scrolling
Only print the shadows of letters
.TP
.I "\-L"
Locks cmatrix, Unable to quit
Locks cmatrix making the program non-exitable. Unlock again by pressing L thrice.
.TP
.I "\-h, \-?"
Print usage and exit
Expand Down
10 changes: 9 additions & 1 deletion cmatrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ typedef struct cmatrix {
int console = 0;
int xwindow = 0;
int lock = 0;
int lock_count = 0;
cmatrix **matrix = (cmatrix **) NULL;
int *length = NULL; /* Length of cols in each line */
int *spaces = NULL; /* Spaces left to fill */
Expand Down Expand Up @@ -154,7 +155,7 @@ void usage(void) {
printf(" -c: Use Japanese characters as seen in the original matrix. Requires appropriate fonts\n");
printf(" -f: Force the linux $TERM type to be on\n");
printf(" -l: Linux mode (uses matrix console font)\n");
printf(" -L: Lock mode (can be closed from another terminal)\n");
printf(" -L: Lock mode (Press L three times to unlock)\n");
printf(" -o: Use old-style scrolling\n");
printf(" -h: Print usage and exit\n");
printf(" -n: No bold characters (overrides -b and -B, default)\n");
Expand Down Expand Up @@ -598,7 +599,14 @@ if (console) {
bold = 2;
break;
case 'L':
if (lock == 1) {
lock_count++;
}
lock = 1;
if (lock_count == 3) {
lock = 0;
lock_count = 0;
}
break;
case 'n':
bold = 0;
Expand Down