File fix_compilation_errors.patch of Package cmatrix
diff -Naur cmatrix-2.0+git20190327-orig/cmatrix.c cmatrix-2.0+git20190327/cmatrix.c
--- cmatrix-2.0+git20190327-orig/cmatrix.c 2019-03-27 11:36:28.000000000 -0300
+++ cmatrix-2.0+git20190327/cmatrix.c 2021-06-07 22:56:31.852930702 -0300
@@ -71,6 +71,7 @@
int *length = NULL; /* Length of cols in each line */
int *spaces = NULL; /* Spaces left to fill */
int *updates = NULL; /* What does this do again? */
+int lines, cols;
volatile sig_atomic_t signal_status = 0; /* Indicates a caught signal */
int va_system(char *str, ...) {
@@ -168,6 +169,8 @@
/* Initialize the global variables */
void var_init() {
+ lines = LINES;
+ cols = COLS;
int i, j;
if (matrix != NULL) {
@@ -175,40 +178,40 @@
free(matrix);
}
- matrix = nmalloc(sizeof(cmatrix *) * (LINES + 1));
- matrix[0] = nmalloc(sizeof(cmatrix) * (LINES + 1) * COLS);
- for (i = 1; i <= LINES; i++) {
- matrix[i] = matrix[i - 1] + COLS;
+ matrix = nmalloc(sizeof(cmatrix *) * (lines + 1));
+ matrix[0] = nmalloc(sizeof(cmatrix) * (lines + 1) * cols);
+ for (i = 1; i <= lines; i++) {
+ matrix[i] = matrix[i - 1] + cols;
}
if (length != NULL) {
free(length);
}
- length = nmalloc(COLS * sizeof(int));
+ length = nmalloc(cols * sizeof(int));
if (spaces != NULL) {
free(spaces);
}
- spaces = nmalloc(COLS* sizeof(int));
+ spaces = nmalloc(cols* sizeof(int));
if (updates != NULL) {
free(updates);
}
- updates = nmalloc(COLS * sizeof(int));
+ updates = nmalloc(cols * sizeof(int));
/* Make the matrix */
- for (i = 0; i <= LINES; i++) {
- for (j = 0; j <= COLS - 1; j += 2) {
+ for (i = 0; i <= lines; i++) {
+ for (j = 0; j <= cols - 1; j += 2) {
matrix[i][j].val = -1;
}
}
- for (j = 0; j <= COLS - 1; j += 2) {
+ for (j = 0; j <= cols - 1; j += 2) {
/* Set up spaces[] array of how many spaces to skip */
- spaces[j] = (int) rand() % LINES + 1;
+ spaces[j] = (int) rand() % lines + 1;
/* And length of the stream */
- length[j] = (int) rand() % (LINES - 3) + 3;
+ length[j] = (int) rand() % (lines - 3) + 3;
/* Sentinel value for creation of new objects */
matrix[1][j].val = ' ';
@@ -242,20 +245,20 @@
return;
}
- COLS = win.ws_col;
- LINES = win.ws_row;
+ cols = win.ws_col;
+ lines = win.ws_row;
- if(LINES <10){
- LINES = 10;
+ if(lines <10){
+ lines = 10;
}
- if(COLS <10){
- COLS = 10;
+ if(cols <10){
+ cols = 10;
}
#ifdef HAVE_RESIZETERM
- resizeterm(LINES, COLS);
+ resizeterm(lines, cols);
#ifdef HAVE_WRESIZE
- if (wresize(stdscr, LINES, COLS) == ERR) {
+ if (wresize(stdscr, lines, cols) == ERR) {
c_die("Cannot resize window!");
}
#endif /* HAVE_WRESIZE */
@@ -562,12 +565,12 @@
}
}
}
- for (j = 0; j <= COLS - 1; j += 2) {
+ for (j = 0; j <= cols - 1; j += 2) {
if ((count > updates[j] || asynch == 0) && pause == 0) {
/* I dont like old-style scrolling, yuck */
if (oldstyle) {
- for (i = LINES - 1; i >= 1; i--) {
+ for (i = lines - 1; i >= 1; i--) {
matrix[i][j].val = matrix[i - 1][j].val;
}
random = (int) rand() % (randnum + 8) + randmin;
@@ -589,7 +592,7 @@
} else {
matrix[0][j].val = (int) rand() % randnum + randmin;
}
- spaces[j] = (int) rand() % LINES + 1;
+ spaces[j] = (int) rand() % lines + 1;
}
} else if (random > highnum && matrix[1][j].val != 1) {
matrix[0][j].val = ' ';
@@ -604,37 +607,37 @@
spaces[j]--;
} else if (matrix[0][j].val == -1
&& matrix[1][j].val == ' ') {
- length[j] = (int) rand() % (LINES - 3) + 3;
+ length[j] = (int) rand() % (lines - 3) + 3;
matrix[0][j].val = (int) rand() % randnum + randmin;
- spaces[j] = (int) rand() % LINES + 1;
+ spaces[j] = (int) rand() % lines + 1;
}
i = 0;
y = 0;
firstcoldone = 0;
- while (i <= LINES) {
+ while (i <= lines) {
/* Skip over spaces */
- while (i <= LINES && (matrix[i][j].val == ' ' ||
+ while (i <= lines && (matrix[i][j].val == ' ' ||
matrix[i][j].val == -1)) {
i++;
}
- if (i > LINES) {
+ if (i > lines) {
break;
}
/* Go to the head of this collumn */
z = i;
y = 0;
- while (i <= LINES && (matrix[i][j].val != ' ' &&
+ while (i <= lines && (matrix[i][j].val != ' ' &&
matrix[i][j].val != -1)) {
matrix[i][j].is_head = false;
i++;
y++;
}
- if (i > LINES) {
+ if (i > lines) {
matrix[z][j].val = ' ';
continue;
}
@@ -659,10 +662,10 @@
/* A simple hack */
if (!oldstyle) {
y = 1;
- z = LINES;
+ z = lines;
} else {
y = 0;
- z = LINES - 1;
+ z = lines - 1;
}
for (i = y; i <= z; i++) {
move(i - y, j);
@@ -759,8 +762,8 @@
//Add our message to the screen
char *msg = "Computer locked.";
- int msg_x = LINES/2;
- int msg_y = COLS/2 - strlen(msg)/2;
+ int msg_x = lines/2;
+ int msg_y = cols/2 - strlen(msg)/2;
int i = 0;
//Add space before message
diff -Naur cmatrix-2.0+git20190327-orig/Makefile.am cmatrix-2.0+git20190327/Makefile.am
--- cmatrix-2.0+git20190327-orig/Makefile.am 2019-03-27 11:36:28.000000000 -0300
+++ cmatrix-2.0+git20190327/Makefile.am 2021-06-07 23:37:14.662388108 -0300
@@ -15,31 +15,31 @@
install-data-local:
@if test $(BUILD_FONTS) = 1; then \
- if test -d /usr/share/consolefonts; then \
+ if test -d $(DESTDIR)/usr/share/kbd/consolefonts; then \
echo " Installing matrix fonts in /usr/share/consolefonts..."; \
- $(INSTALL_DATA) $(srcdir)/matrix.fnt /usr/share/consolefonts; \
- $(INSTALL_DATA) $(srcdir)/matrix.psf.gz /usr/share/consolefonts; \
+ $(INSTALL_DATA) $(srcdir)/matrix.fnt $(DESTDIR)/usr/share/kbd/consolefonts; \
+ $(INSTALL_DATA) $(srcdir)/matrix.psf.gz $(DESTDIR)/usr/share/kbd/consolefonts; \
fi; \
if test -d /usr/lib/kbd/consolefonts; then \
- echo " Installing matrix fonts in /usr/lib/kbd/consolefonts..."; \
- $(INSTALL_DATA) $(srcdir)/matrix.fnt /usr/lib/kbd/consolefonts; \
- $(INSTALL_DATA) $(srcdir)/matrix.psf.gz /usr/lib/kbd/consolefonts; \
+ echo " Installing matrix fonts in $(DESTDIR)/usr/lib/kbd/consolefonts..."; \
+ $(INSTALL_DATA) $(srcdir)/matrix.fnt $(DESTDIR)/usr/lib/kbd/consolefonts; \
+ $(INSTALL_DATA) $(srcdir)/matrix.psf.gz $(DESTDIR)/usr/lib/kbd/consolefonts; \
fi; \
- if test -d /usr/lib/X11/fonts/misc; then \
- echo " Installing X window matrix fonts in /usr/lib/X11/fonts/misc..."; \
- $(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/lib/X11/fonts/misc; \
- $(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/lib/X11/fonts/misc; \
- echo " Running mkfontdir /usr/lib/X11/fonts/misc..."; \
+ if test -d $(DESTDIR)/usr/share/fonts/misc; then \
+ echo " Installing X window matrix fonts in $(DESTDIR)/usr/share/fonts/misc..."; \
+ $(INSTALL_DATA) $(srcdir)/mtx.pcf $(DESTDIR)/usr/share/fonts/misc; \
+ $(INSTALL_DATA) $(srcdir)/mtx.pcf $(DESTDIR)/usr/share/fonts/misc; \
+ echo " Running mkfontdir $(DESTDIR)/usr/lib/X11/fonts/misc..."; \
$(MKFONTDIR) /usr/lib/X11/fonts/misc; \
echo " Done. If this is the first time you have installed CMatrix you will"; \
echo " probably have to restart X window in order to use the mtx.pcf font."; \
else \
- if test -d /usr/X11R6/lib/X11/fonts/misc; then \
- echo " Installing X window matrix fonts in /usr/X11R6/lib/X11/fonts/misc..."; \
- $(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/X11R6/lib/X11/fonts/misc; \
- $(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/X11R6/lib/X11/fonts/misc; \
- echo " Running mkfontdir /usr/X11R6/lib/X11/fonts/misc..."; \
- $(MKFONTDIR) /usr/X11R6/lib/X11/fonts/misc; \
+ if test -d $(DESTDIR)/usr/X11R6/lib/X11/fonts/misc; then \
+ echo " Installing X window matrix fonts in $(DESTDIR)/usr/X11R6/lib/X11/fonts/misc..."; \
+ $(INSTALL_DATA) $(srcdir)/mtx.pcf $(DESTDIR)/usr/X11R6/lib/X11/fonts/misc; \
+ $(INSTALL_DATA) $(srcdir)/mtx.pcf $(DESTDIR)/usr/X11R6/lib/X11/fonts/misc; \
+ echo " Running mkfontdir $(DESTDIR)/usr/X11R6/lib/X11/fonts/misc..."; \
+ $(MKFONTDIR) $(DESTDIR)/usr/X11R6/lib/X11/fonts/misc; \
echo " Done. If this is the first time you have installed CMatrix you will"; \
echo " probably have to restart X window in order to use the mtx.pcf font."; \
fi \