Skip to content

Commit 0365a63

Browse files
Merge pull request #130 from a1346054/fixes
Minor cleanup
2 parents 65c1bd6 + 198f8ea commit 0365a63

11 files changed

+47
-54
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ script:
2727
mkdir build && cd build && cmake -DCMAKE_C_COMPILER="${CC}" ..
2828
fi
2929
- make
30-

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,3 @@ if (UNIX)
8585
endif ()
8686
endforeach ()
8787
endif ()
88-

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Contributing
22

33
When contributing to this repository, please first discuss the change you wish to make via issue,
4-
email, or any other method with the owners of this repository before making a change.
4+
email, or any other method with the owners of this repository before making a change.
55

66
Please note we have a code of conduct, please follow it in all your interactions with the project.
77

88
## Pull Request Process
99

10-
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
10+
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
1111
build.
12-
2. Update the README.md with details of changes to the interface, this includes new environment
12+
2. Update the README.md with details of changes to the interface, this includes new environment
1313
variables, exposed ports, useful file locations and container parameters.
1414
3. Increase the version numbers in any examples files and the README.md to the new version that this
1515
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
16-
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
16+
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
1717
do not have permission to do that, you may request the second reviewer to merge it for you.
1818

1919
## Code of Conduct

COPYING

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GNU GENERAL PUBLIC LICENSE
22
Version 3, 29 June 2007
33

4-
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
4+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
55
Everyone is permitted to copy and distribute verbatim copies
66
of this license document, but changing it is not allowed.
77

@@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
645645
GNU General Public License for more details.
646646

647647
You should have received a copy of the GNU General Public License
648-
along with this program. If not, see <http://www.gnu.org/licenses/>.
648+
along with this program. If not, see <https://www.gnu.org/licenses/>.
649649

650650
Also add information on how to contact you by electronic and paper mail.
651651

@@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
664664
You should also get your employer (if you work as a programmer) or school,
665665
if any, to sign a "copyright disclaimer" for the program, if necessary.
666666
For more information on this, and how to apply and follow the GNU GPL, see
667-
<http://www.gnu.org/licenses/>.
667+
<https://www.gnu.org/licenses/>.
668668

669669
The GNU General Public License does not permit incorporating your program
670670
into proprietary programs. If your program is a subroutine library, you
671671
may consider it more useful to permit linking proprietary applications with
672672
the library. If this is what you want to do, use the GNU Lesser General
673673
Public License instead of this License. But first, please read
674-
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
674+
<https://www.gnu.org/licenses/why-not-lgpl.html>.

ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ I am submitting a <!-- Feature Request / Bug Report -->
33
### Problem or Feature in Brief
44
<!--- Explain the problem in detail here -->
55

6-
###
6+
###
77

88
### Solution (if any)
99
<!-- If you would like to offer any solutions, provide it here or leave this section

Makefile.am

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,32 @@ install-data-local:
1919
echo " Installing matrix fonts in /usr/share/consolefonts..."; \
2020
mkdir -p $(DESTDIR)/usr/share/consolefonts; \
2121
$(INSTALL_DATA) $(srcdir)/matrix.fnt $(DESTDIR)/usr/share/consolefonts; \
22-
$(INSTALL_DATA) $(srcdir)/matrix.psf.gz $(DESTDIR)/usr/share/consolefonts; \
22+
$(INSTALL_DATA) $(srcdir)/matrix.psf.gz $(DESTDIR)/usr/share/consolefonts; \
2323
fi; \
2424
if test -d /usr/lib/kbd/consolefonts; then \
2525
echo " Installing matrix fonts in /usr/lib/kbd/consolefonts..."; \
26-
$(INSTALL_DATA) $(srcdir)/matrix.fnt $(DESTDIR)/usr/lib/kbd/consolefonts; \
27-
$(INSTALL_DATA) $(srcdir)/matrix.psf.gz $(DESTDIR)/usr/lib/kbd/consolefonts; \
26+
$(INSTALL_DATA) $(srcdir)/matrix.fnt $(DESTDIR)/usr/lib/kbd/consolefonts; \
27+
$(INSTALL_DATA) $(srcdir)/matrix.psf.gz $(DESTDIR)/usr/lib/kbd/consolefonts; \
2828
fi; \
2929
if test -d /usr/share/fonts/misc; then \
3030
echo " Installing X window matrix fonts in /usr/share/fonts/misc..."; \
3131
echo " Running mkfontdir /usr/share/fonts/misc..."; \
3232
$(MKFONTDIR) $(DESTDIR)/usr/share/fonts/misc; \
33-
$(INSTALL_DATA) $(srcdir)/mtx.pcf $(DESTDIR)/usr/share/fonts/misc; \
34-
$(INSTALL_DATA) $(srcdir)/mtx.pcf $(DESTDIR)/usr/share/fonts/misc; \
33+
$(INSTALL_DATA) $(srcdir)/mtx.pcf $(DESTDIR)/usr/share/fonts/misc; \
34+
$(INSTALL_DATA) $(srcdir)/mtx.pcf $(DESTDIR)/usr/share/fonts/misc; \
3535
echo " Done. If this is the first time you have installed CMatrix you will"; \
3636
echo " probably have to restart X window in order to use the mtx.pcf font."; \
3737
else \
3838
if test -d /usr/X11R6/lib/X11/fonts/misc; then \
3939
echo " Installing X window matrix fonts in /usr/X11R6/lib/X11/fonts/misc..."; \
4040
echo " Running mkfontdir /usr/X11R6/lib/X11/fonts/misc..."; \
4141
$(MKFONTDIR) $(DESTDIR)/usr/X11R6/lib/X11/fonts/misc; \
42-
$(INSTALL_DATA) $(srcdir)/mtx.pcf $(DESTDIR)/usr/X11R6/lib/X11/fonts/misc; \
43-
$(INSTALL_DATA) $(srcdir)/mtx.pcf $(DESTDIR)/usr/X11R6/lib/X11/fonts/misc; \
42+
$(INSTALL_DATA) $(srcdir)/mtx.pcf $(DESTDIR)/usr/X11R6/lib/X11/fonts/misc; \
43+
$(INSTALL_DATA) $(srcdir)/mtx.pcf $(DESTDIR)/usr/X11R6/lib/X11/fonts/misc; \
4444
echo " Done. If this is the first time you have installed CMatrix you will"; \
4545
echo " probably have to restart X window in order to use the mtx.pcf font."; \
4646
fi \
4747
fi; \
4848
else \
4949
echo "Not installing matrix fonts"; \
5050
fi
51-

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ _Note: cmatrix is probably not particularly portable or efficient, but it wont h
6666
- Abishek V Ashok (@abishekvashok) <[email protected]> [Core]
6767

6868
### Thanks to:
69-
- Chris Allegretta <[email protected]> for writing cmatrix up in a fornight and giving us
69+
- Chris Allegretta <[email protected]> for writing cmatrix up in a fortnight and giving us
7070
the responsibility to further improve it.
71-
- Krisjon Hanson and Bjoern Ganslandt for helping with bold support and
71+
- Krisjon Hanson and Bjoern Ganslandt for helping with bold support and
7272
Bjoern again for the cursor removal code, helping with the `-u` and `-l`
7373
modes/flags, and Makefile improvements.
7474
- Adam Gurno for multi-color support.
@@ -90,4 +90,3 @@ This software is provided under the GNU GPL v3.
9090
### Disclaimer
9191
We are in no way affiliated in any way with the movie "The Matrix", "Warner Bros" nor
9292
any of its affiliates in any way, just fans.
93-

cmatrix.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Print version information and exit
4848
Screen update delay 0 - 9, default 4
4949
.TP
5050
.I "\-C color"
51-
Use this color for matrix (default green).
51+
Use this color for matrix (default green).
5252
Valid colors are green, red, blue, white, yellow, cyan, magenta and black.
5353
.I "\-t tty"
5454
Set tty to use

cmatrix.c

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ void resize_screen(void) {
249249
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
250250

251251
hStdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
252-
if(hStdHandle == INVALID_HANDLE_VALUE)
252+
if (hStdHandle == INVALID_HANDLE_VALUE)
253253
return;
254254
#else
255255
char *tty;
@@ -263,7 +263,7 @@ void resize_screen(void) {
263263
#endif
264264
#ifdef _WIN32
265265
result = GetConsoleScreenBufferInfo(hStdHandle, &csbiInfo);
266-
if(!result)
266+
if (!result)
267267
return;
268268
LINES = csbiInfo.dwSize.Y;
269269
COLS = csbiInfo.dwSize.X;
@@ -282,10 +282,10 @@ void resize_screen(void) {
282282
LINES = win.ws_row;
283283
#endif
284284

285-
if(LINES <10){
285+
if (LINES < 10) {
286286
LINES = 10;
287287
}
288-
if(COLS <10){
288+
if (COLS < 10) {
289289
COLS = 10;
290290
}
291291

@@ -502,7 +502,7 @@ if (console) {
502502
init_pair(COLOR_YELLOW, COLOR_YELLOW, -1);
503503
} else {
504504
#else
505-
{ /* Hack to deal the after effects of else in HAVE_USE_DEFAULT_COLOURS*/
505+
{ /* Hack to deal the after effects of else in HAVE_USE_DEFAULT_COLOURS */
506506
#endif
507507
init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_BLACK);
508508
init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK);
@@ -516,7 +516,7 @@ if (console) {
516516
}
517517

518518
/* Set up values for random number generation */
519-
if(classic) {
519+
if (classic) {
520520
/* Japanese character unicode range [they are seen in the original cmatrix] */
521521
randmin = 12288;
522522
highnum = 12351;
@@ -535,7 +535,7 @@ if (console) {
535535
#ifndef _WIN32
536536
/* Check for signals */
537537
if (signal_status == SIGINT || signal_status == SIGQUIT) {
538-
if(lock != 1)
538+
if (lock != 1)
539539
finish();
540540
/* exits */
541541
}
@@ -544,8 +544,8 @@ if (console) {
544544
signal_status = 0;
545545
}
546546

547-
if(signal_status == SIGTSTP){
548-
if(lock != 1)
547+
if (signal_status == SIGTSTP) {
548+
if (lock != 1)
549549
finish();
550550
}
551551
#endif
@@ -576,7 +576,7 @@ if (console) {
576576
case 3: /* Ctrl-C. Fall through */
577577
#endif
578578
case 'q':
579-
if(lock != 1)
579+
if (lock != 1)
580580
finish();
581581
break;
582582
case 'a':
@@ -651,7 +651,7 @@ if (console) {
651651
for (j = 0; j <= COLS - 1; j += 2) {
652652
if ((count > updates[j] || asynch == 0) && pause == 0) {
653653

654-
/* I dont like old-style scrolling, yuck */
654+
/* I don't like old-style scrolling, yuck */
655655
if (oldstyle) {
656656
for (i = LINES - 1; i >= 1; i--) {
657657
matrix[i][j].val = matrix[i - 1][j].val;
@@ -715,8 +715,8 @@ if (console) {
715715
while (i <= LINES && (matrix[i][j].val != ' ' &&
716716
matrix[i][j].val != -1)) {
717717
matrix[i][j].is_head = false;
718-
if(changes) {
719-
if(rand() % 8 == 0)
718+
if (changes) {
719+
if (rand() % 8 == 0)
720720
matrix[i][j].val = (int) rand() % randnum + randmin;
721721
}
722722
i++;
@@ -784,10 +784,10 @@ if (console) {
784784
attroff(A_ALTCHARSET);
785785
}
786786
} else {
787-
if(rainbow) {
787+
if (rainbow) {
788788
int randomColor = rand() % 6;
789789

790-
switch(randomColor){
790+
switch (randomColor) {
791791
case 0:
792792
mcolor = COLOR_GREEN;
793793
break;
@@ -846,15 +846,15 @@ if (console) {
846846
}
847847

848848
//check if -M and/or -L was used
849-
if (msg[0] != '\0'){
849+
if (msg[0] != '\0') {
850850
//Add our message to the screen
851851
int msg_x = LINES/2;
852852
int msg_y = COLS/2 - strlen(msg)/2;
853853
int i = 0;
854854

855855
//Add space before message
856856
move(msg_x-1, msg_y-2);
857-
for(i = 0; i < strlen(msg)+4; i++)
857+
for (i = 0; i < strlen(msg)+4; i++)
858858
addch(' ');
859859

860860
//Write message
@@ -867,12 +867,11 @@ if (console) {
867867

868868
//Add space after message
869869
move(msg_x+1, msg_y-2);
870-
for(i = 0; i < strlen(msg)+4; i++)
870+
for (i = 0; i < strlen(msg)+4; i++)
871871
addch(' ');
872872
}
873873

874874
napms(update * 10);
875875
}
876876
finish();
877877
}
878-

configure.ac

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ AC_CHECK_LIB($CURSES_LIB_NAME, resizeterm, [AC_DEFINE(HAVE_RESIZETERM)])
7373
AC_CHECK_LIB([$CURSES_LIB_NAME], wresize, [AC_DEFINE(HAVE_WRESIZE)])
7474

7575

76-
dnl Only change gcc options if we are using gcc.
76+
dnl Only change gcc options if we are using gcc.
7777
if test "$ac_cv_prog_CC" = gcc -o "$ac_cv_prog_CC" = g++; then
7878
CFLAGS="$CFLAGS -Wall -Wno-comment"
7979
fi
@@ -103,7 +103,7 @@ if test "x$enable_fonts" != xfalse; then
103103
*** console without this program (it may still work in xterms). If you are
104104
*** using Linux, the package containing this program is usually called
105105
*** kbd, kbd-utils, or console-utils
106-
])
106+
])
107107
else
108108
AC_DEFINE_UNQUOTED(HAVE_SETFONT, $SETFONT)
109109
fi
@@ -119,7 +119,7 @@ if test "x$enable_fonts" != xfalse; then
119119

120120
if test "x$ac_cv_file__usr_lib_kbd_consolefonts" = "xno"; then
121121
if test "x$ac_cv_file__usr_share_consolefonts" = "xno"; then
122-
AC_MSG_WARN([
122+
AC_MSG_WARN([
123123
124124
*** You do not appear to have a consolefonts directory in a standard location
125125
*** (/usr/lib/kbd or /usr/share), even though you appear to have the
@@ -138,7 +138,7 @@ if test "x$enable_fonts" != xfalse; then
138138

139139
if test "x$ac_cv_file__usr_lib_X11_fonts_misc" = "xno"; then
140140
if test "x$ac_cv_file__usr_X11R6_lib_X11_fonts_misc" = "xno"; then
141-
AC_MSG_WARN([
141+
AC_MSG_WARN([
142142
143143
*** You do not appear to have an X window fonts directory in the standard
144144
*** locations (/usr/share/fonts/misc or /usr/X11R6/lib/X11/fonts/misc). The

takeScreenshots

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
# Produces a bunch of `cmatrix` screenshots and screencasts.
33
# This script requires X and the following:
44
#apt-get install rxvt byzanz
@@ -11,18 +11,17 @@ TERM_EMULATOR_BASE="rxvt +sb"
1111
CAPTURES_DIR="data/img"
1212

1313
# Function to take a single cmatrix screenshot (takes about 3.5s to execute)
14-
# or optionally, a screncast of choosable length.
15-
function captureCMatrix()
16-
{
14+
# or optionally, a screencast of choosable length.
15+
captureCMatrix() {
1716
CAPTURE_FILE="$1"
1817
CMATRIX_OPTIONS="$2"
1918
# If 0 (default if no 3rd param is given),
2019
# we make a screenshot instead of a screencast.
2120
SCREENCAST_DURATION="${3:-0}"
2221

23-
if [ ${SCREENCAST_DURATION} -gt 0 ]
22+
if [ "${SCREENCAST_DURATION}" -gt 0 ]
2423
then
25-
let KILL_DELAY="${SCREENCAST_DURATION} + 1"
24+
KILL_DELAY="$((SCREENCAST_DURATION + 1))"
2625
CAPTURE_FILE="${CAPTURE_FILE}.gif"
2726
else
2827
KILL_DELAY=3
@@ -31,7 +30,7 @@ function captureCMatrix()
3130
WINDOW_TITLE="CMatrix capture ${CAPTURE_FILE}"
3231

3332
# NOTE the "-PIPE" prevents output of the "Terminated: ..." message
34-
( cmdpid=$BASHPID; ( sleep ${KILL_DELAY}; kill -PIPE $cmdpid ) & exec ${TERM_EMULATOR_BASE} -name "${WINDOW_TITLE}" -title "${WINDOW_TITLE}" -e bash -c "
33+
( cmdpid=$BASHPID; ( sleep "${KILL_DELAY}"; kill -PIPE "$cmdpid" ) & exec ${TERM_EMULATOR_BASE} -name "${WINDOW_TITLE}" -title "${WINDOW_TITLE}" -e bash -c "
3534
if [ ${SCREENCAST_DURATION} -gt 0 ]
3635
then
3736
# Take screencast (animated GIF)
@@ -74,4 +73,3 @@ do
7473
${CMD_CS} "${CAPTURE_FILE_BASE}bold_C_${color}" "-b -C ${color}"
7574
done
7675
${CMD_CS} "${CAPTURE_FILE_BASE}bold_rainbow" "-b -r"
77-

0 commit comments

Comments
 (0)