kumquat-buildroot/package/minicom/0001-fix-static-linking-with-ncurses.patch
Fabrice Fontaine acbae76d69 package/minicom: fix static linking with ncurses
Fixes:
 - http://autobuild.buildroot.org/results/d3edbab1f2cd0f7b790e2559dc8d489497ae02f3

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2020-02-26 15:54:15 +01:00

746 lines
27 KiB
Diff

From c13180cb2bead49addb00f33f4999200cbbd801f Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Wed, 26 Feb 2020 10:16:14 +0100
Subject: [PATCH] fix static linking with ncurses
Prefix LINES and COLS with MINICOM_ to avoid the following build failure
when building statically with ncurses:
/home/giuliobenetti/autobuild/run/instance-1/output-1/per-package/minicom/host/bin/arm-linux-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -static -W -Wall -Wextra -std=gnu99 -fno-common -Wno-format-truncation -static -o minicom minicom.o vt100.o config.o help.o updown.o util.o dial.o window.o wkeys.o ipc.o windiv.o sysdep1.o sysdep1_s.o sysdep2.o rwconf.o main.o file.o getsdir.o wildmat.o common.o ../lib/libport.a -lncurses
/home/giuliobenetti/autobuild/run/instance-1/output-1/per-package/minicom/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/giuliobenetti/autobuild/run/instance-1/output-1/per-package/minicom/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libncurses.a(lib_setup.o):(.bss+0x100): multiple definition of `COLS'; window.o:(.bss+0x38): first defined here
/home/giuliobenetti/autobuild/run/instance-1/output-1/per-package/minicom/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/giuliobenetti/autobuild/run/instance-1/output-1/per-package/minicom/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libncurses.a(lib_setup.o):(.bss+0x104): multiple definition of `LINES'; window.o:(.bss+0x3c): first defined here
collect2: error: ld returned 1 exit status
Makefile:448: recipe for target 'minicom' failed
Fixes:
- http://autobuild.buildroot.org/results/d3edbab1f2cd0f7b790e2559dc8d489497ae02f3
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Upstream status: sent to minicom-devel@lists.alioth.debian.org]
---
src/config.c | 8 ++--
src/dial.c | 10 ++---
src/file.c | 8 ++--
src/help.c | 4 +-
src/main.c | 68 ++++++++++++++++-----------------
src/minicom.c | 2 +-
src/vt100.c | 2 +-
src/windiv.c | 8 ++--
src/window.c | 102 +++++++++++++++++++++++++-------------------------
src/window.h | 2 +-
10 files changed, 107 insertions(+), 107 deletions(-)
diff --git a/src/config.c b/src/config.c
index 87901f0..3c26f9f 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1078,7 +1078,7 @@ static void doscrkeyb(void)
} else {
psets(P_STATLINE, N_("enabled"));
/* See if it fits on screen */
- if (LINES > 24)
+ if (MINICOM_LINES > 24)
tempst = 0;
}
mc_wlocate(w, mbswidth(status_line) + 1, 2);
@@ -1140,7 +1140,7 @@ static void doscrkeyb(void)
if (st) {
mc_wclose(st,0);
- st = mc_wopen(0, LINES - 1, COLS - 1, LINES - 1, BNONE,
+ st = mc_wopen(0, MINICOM_LINES - 1, MINICOM_COLS - 1, MINICOM_LINES - 1, BNONE,
XA_NORMAL, sfcolor, sbcolor, 1, 0, 1);
show_status();
}
@@ -1159,7 +1159,7 @@ static void doscrkeyb(void)
if (st) {
mc_wclose(st,0);
- st = mc_wopen(0, LINES - 1, COLS - 1, LINES - 1, BNONE,
+ st = mc_wopen(0, MINICOM_LINES - 1, MINICOM_COLS - 1, MINICOM_LINES - 1, BNONE,
XA_NORMAL, sfcolor, sbcolor, 1, 0, 0);
show_status();
}
@@ -1326,7 +1326,7 @@ int dotermmenu(void)
} else {
psets(P_STATLINE, N_("enabled"));
/* See if it fits on screen */
- if (LINES > 24 || use_status)
+ if (MINICOM_LINES > 24 || use_status)
tempst = 0;
}
mc_wlocate(w, mbswidth(status_line) + 1, 3);
diff --git a/src/dial.c b/src/dial.c
index 5076b32..5ef7ac3 100644
--- a/src/dial.c
+++ b/src/dial.c
@@ -1575,7 +1575,7 @@ void dialdir(void)
*move_exit = N_(" Move entry up/down, Escape to exit");
unsigned int tagmvlen = 0;
size_t i;
- int position_dialing_directory = ((COLS / 2) + 32 - DIALOPTS * DIAL_WIDTH) / 2;
+ int position_dialing_directory = ((MINICOM_COLS / 2) + 32 - DIALOPTS * DIAL_WIDTH) / 2;
dprev = -1;
dname[0] = 0;
@@ -1586,11 +1586,11 @@ void dialdir(void)
/* Alright, draw the dialing directory! */
dirflush = 0;
- x1 = (COLS / 2) - 37;
- x2 = (COLS / 2) + 37;
- dsub = mc_wopen(x1 - 1, LINES - 3, x2 + 1, LINES - 3, BNONE,
+ x1 = (MINICOM_COLS / 2) - 37;
+ x2 = (MINICOM_COLS / 2) + 37;
+ dsub = mc_wopen(x1 - 1, MINICOM_LINES - 3, x2 + 1, MINICOM_LINES - 3, BNONE,
XA_REVERSE | stdattr, mfcolor, mbcolor, 0, 0, 1);
- w = mc_wopen(x1, 2, x2, LINES - 6, BSINGLE, stdattr, mfcolor, mbcolor, 0, 0, 1);
+ w = mc_wopen(x1, 2, x2, MINICOM_LINES - 6, BSINGLE, stdattr, mfcolor, mbcolor, 0, 0, 1);
mc_wcursor(w, CNONE);
mc_wtitle(w, TMID, _("Dialing Directory"));
mc_wputs(w,
diff --git a/src/file.c b/src/file.c
index be26afd..7c208a7 100644
--- a/src/file.c
+++ b/src/file.c
@@ -491,11 +491,11 @@ static void init_filedir(void)
int x1, x2;
dirflush = 0;
- x1 = (COLS / 2) - 37;
- x2 = (COLS / 2) + 37;
- dsub = mc_wopen(x1 - 1, LINES - 3, x2 + 1, LINES - 3, BNONE,
+ x1 = (MINICOM_COLS / 2) - 37;
+ x2 = (MINICOM_COLS / 2) + 37;
+ dsub = mc_wopen(x1 - 1, MINICOM_LINES - 3, x2 + 1, MINICOM_LINES - 3, BNONE,
stdattr, mfcolor, mbcolor, 0, 0, 1);
- main_w = mc_wopen(x1, 2, x2, LINES - 6, BSINGLE, stdattr, mfcolor,
+ main_w = mc_wopen(x1, 2, x2, MINICOM_LINES - 6, BSINGLE, stdattr, mfcolor,
mbcolor, 0, 0, 1);
if (ret_buf == NULL) {
diff --git a/src/help.c b/src/help.c
index 70cf8c6..3036d0a 100644
--- a/src/help.c
+++ b/src/help.c
@@ -34,8 +34,8 @@ int help(void)
const char *s;
char buf[40];
- x1 = (COLS / 2) - 34;
- x2 = (COLS / 2) + 32;
+ x1 = (MINICOM_COLS / 2) - 34;
+ x2 = (MINICOM_COLS / 2) + 32;
w = mc_wopen(x1, 2, x2, 18, BDOUBLE, stdattr, mfcolor, mbcolor, 0, 0, 1);
s = _("Minicom Command Summary");
diff --git a/src/main.c b/src/main.c
index 85bd4a5..8f8e8f7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -485,17 +485,17 @@ void init_emul(int type, int do_init)
}
/* See if we have space for a fixed status line */
- maxy = LINES - 1;
- if ((use_status || LINES > 24) &&
+ maxy = MINICOM_LINES - 1;
+ if ((use_status || MINICOM_LINES > 24) &&
P_STATLINE[0] == 'e') {
if (use_status) {
- ypos = LINES;
- maxy = LINES - 1;
+ ypos = MINICOM_LINES;
+ maxy = MINICOM_LINES - 1;
} else {
- ypos = LINES - 1;
- maxy = LINES - 2;
+ ypos = MINICOM_LINES - 1;
+ maxy = MINICOM_LINES - 2;
}
- st = mc_wopen(0, ypos, COLS - 1, ypos, BNONE,
+ st = mc_wopen(0, ypos, MINICOM_COLS - 1, ypos, BNONE,
st_attr, sfcolor, sbcolor, 1, 0, 1);
mc_wredraw(st, 1);
}
@@ -508,7 +508,7 @@ void init_emul(int type, int do_init)
num_hist_lines = 5000;
/* Open a new main window, and define the configured history buffer size. */
- us = mc_wopen(0, 0, COLS - 1, maxy,
+ us = mc_wopen(0, 0, MINICOM_COLS - 1, maxy,
BNONE, XA_NORMAL, tfcolor, tbcolor, 1, num_hist_lines, 0);
if (x >= 0) {
@@ -520,8 +520,8 @@ void init_emul(int type, int do_init)
us->wrap = wrapln;
terminal = type;
- lines = LINES - (st != NULL);
- cols = COLS;
+ lines = MINICOM_LINES - (st != NULL);
+ cols = MINICOM_COLS;
/* Install and reset the terminal emulator. */
if (do_init) {
@@ -583,10 +583,10 @@ static void show_status_fmt(const char *fmt)
if (!st)
return;
- char buf[COLS];
+ char buf[MINICOM_COLS];
int bufi = 0;
int l = strlen(fmt);
- for (int i = 0; i < l && bufi < COLS; ++i)
+ for (int i = 0; i < l && bufi < MINICOM_COLS; ++i)
{
if (fmt[i] == '%' && i + 1 < l)
{
@@ -596,70 +596,70 @@ static void show_status_fmt(const char *fmt)
switch (func)
{
case '%':
- bufi += snprintf(buf + bufi, COLS - bufi, "%%");
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, "%%");
break;
case 'H':
- bufi += snprintf(buf + bufi, COLS - bufi, "%sZ", esc_key());
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, "%sZ", esc_key());
break;
case 'V':
- bufi += snprintf(buf + bufi, COLS - bufi, "%s", VERSION);
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, "%s", VERSION);
break;
case 'b':
#ifdef USE_SOCKET
if (portfd_is_socket == Socket_type_unix)
- bufi += snprintf(buf + bufi, COLS - bufi, "unix-socket");
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, "unix-socket");
else if (portfd_is_socket == Socket_type_tcp)
- bufi += snprintf(buf + bufi, COLS - bufi, "TCP");
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, "TCP");
else
#endif /* USE_SOCKET */
{
if (P_SHOWSPD[0] == 'l')
- bufi += snprintf(buf + bufi, COLS - bufi, "%6ld", linespd);
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, "%6ld", linespd);
else
- bufi += snprintf(buf + bufi, COLS - bufi, "%s", P_BAUDRATE);
- bufi += snprintf(buf + bufi, COLS - bufi, " %s%s%s", P_BITS, P_PARITY, P_STOPB);
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, "%s", P_BAUDRATE);
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, " %s%s%s", P_BITS, P_PARITY, P_STOPB);
}
break;
case 'T':
switch (terminal)
{
case VT100:
- bufi += snprintf(buf + bufi, COLS - bufi, "VT102");
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, "VT102");
break;
case ANSI:
- bufi += snprintf(buf + bufi, COLS - bufi, "ANSI");
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, "ANSI");
break;
}
break;
case 'C':
- bufi += snprintf(buf + bufi, COLS - bufi, cursormode == NORMAL ? "NOR" : "APP");
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, cursormode == NORMAL ? "NOR" : "APP");
break;
case 't':
if (online < 0)
- bufi += snprintf(buf + bufi, COLS - bufi, "%s",
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, "%s",
P_HASDCD[0] == 'Y' ? _("Offline") : _("OFFLINE"));
else
- bufi += snprintf(buf + bufi, COLS - bufi, "%s %ld:%ld",
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, "%s %ld:%ld",
P_HASDCD[0] == 'Y' ? _("Online") : _("ONLINE"),
online / 3600, (online / 60) % 60);
break;
case 'D':
{
- char b[COLS - bufi];
- bufi += snprintf(buf + bufi, COLS - bufi, "%s",
+ char b[MINICOM_COLS - bufi];
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, "%s",
shortened_devpath(b, sizeof(b), dial_tty));
}
break;
case '$':
- bufi += snprintf(buf + bufi, COLS - bufi, "%s", status_message);
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, "%s", status_message);
break;
default:
- bufi += snprintf(buf + bufi, COLS - bufi, "?%c", func);
+ bufi += snprintf(buf + bufi, MINICOM_COLS - bufi, "?%c", func);
break;
}
}
@@ -670,9 +670,9 @@ static void show_status_fmt(const char *fmt)
}
}
- if (bufi < COLS - 1)
- memset(buf + bufi, ' ', COLS - bufi);
- buf[COLS - 1] = 0;
+ if (bufi < MINICOM_COLS - 1)
+ memset(buf + bufi, ' ', MINICOM_COLS - bufi);
+ buf[MINICOM_COLS - 1] = 0;
if (size_changed || !current_status_line || strcmp(buf, current_status_line))
{
@@ -681,7 +681,7 @@ static void show_status_fmt(const char *fmt)
mc_wprintf(st, "%s", buf);
mc_wredraw(st, 1);
ret_csr();
- current_status_line = realloc(current_status_line, COLS);
+ current_status_line = realloc(current_status_line, MINICOM_COLS);
assert(current_status_line);
strcpy(current_status_line, buf);
}
@@ -814,7 +814,7 @@ static void showtemp(void)
if (st)
return;
- st = mc_wopen(0, LINES - 1, COLS - 1, LINES - 1,
+ st = mc_wopen(0, MINICOM_LINES - 1, MINICOM_COLS - 1, MINICOM_LINES - 1,
BNONE, st_attr, sfcolor, sbcolor, 1, 0, 1);
show_status();
tempst = 1;
diff --git a/src/minicom.c b/src/minicom.c
index cfdb763..d876cb2 100644
--- a/src/minicom.c
+++ b/src/minicom.c
@@ -1502,7 +1502,7 @@ int main(int argc, char **argv)
if (win_init(tfcolor, tbcolor, XA_NORMAL) < 0)
leave("");
- if (COLS < 40 || LINES < 10)
+ if (MINICOM_COLS < 40 || MINICOM_LINES < 10)
leave(_("Sorry. Your screen is too small.\n"));
if (dosetup) {
diff --git a/src/vt100.c b/src/vt100.c
index 82e395e..2f03549 100644
--- a/src/vt100.c
+++ b/src/vt100.c
@@ -739,7 +739,7 @@ static void dec_mode(int on_off)
if (on_off)
{
- us_alternate = mc_wopen(0, 0, COLS - 1, us->y2, BNONE, XA_NORMAL,
+ us_alternate = mc_wopen(0, 0, MINICOM_COLS - 1, us->y2, BNONE, XA_NORMAL,
tfcolor, tbcolor, 1, 0, 0);
vt_win = us_alternate;
}
diff --git a/src/windiv.c b/src/windiv.c
index 2644dff..fb4d73c 100644
--- a/src/windiv.c
+++ b/src/windiv.c
@@ -48,8 +48,8 @@ static WIN *vmc_tell(const char *fmt, va_list va)
vsnprintf(buf, sizeof(buf), fmt, va);
- w = mc_wopen((COLS / 2) - 2 - mbswidth(buf) / 2, 8,
- (COLS / 2) + 2 + mbswidth(buf) / 2, 10,
+ w = mc_wopen((MINICOM_COLS / 2) - 2 - mbswidth(buf) / 2, 8,
+ (MINICOM_COLS / 2) + 2 + mbswidth(buf) / 2, 10,
BDOUBLE, stdattr, mfcolor, mbcolor, 0, 0, 1);
mc_wcursor(w, CNONE);
mc_wlocate(w, 2, 1);
@@ -104,7 +104,7 @@ int ask(const char *what, const char **s)
size = mbswidth(what) / 2 + 2;
offs = size - 5*num;
}
- w = mc_wopen((COLS / 2) - size , 8, (COLS / 2) + 1 + size, 9,
+ w = mc_wopen((MINICOM_COLS / 2) - size , 8, (MINICOM_COLS / 2) + 1 + size, 9,
BSINGLE, stdattr, mfcolor, mbcolor, 0, 0, 1);
dirflush = 0;
@@ -167,7 +167,7 @@ char *input(char *s, char *buf, size_t bufsize)
{
WIN *w;
- w = mc_wopen((COLS / 2) - 20, 11, (COLS / 2) + 20, 12,
+ w = mc_wopen((MINICOM_COLS / 2) - 20, 11, (MINICOM_COLS / 2) + 20, 12,
BDOUBLE, stdattr, mfcolor, mbcolor, 1, 0, 1);
mc_wputs(w, s);
mc_wlocate(w, 0, 1);
diff --git a/src/window.c b/src/window.c
index c6cf0f1..66f2978 100644
--- a/src/window.c
+++ b/src/window.c
@@ -104,7 +104,7 @@ static int sflag = 0;
int useattr = 1;
int dirflush = 1;
-int LINES, COLS;
+int MINICOM_LINES, MINICOM_COLS;
int usecolor = 0;
WIN *stdwin;
/*
@@ -266,12 +266,12 @@ static void _gotoxy(int x, int y)
int tmp;
/* Sanity check. */
- if (x >= COLS || y > LINES || (x == curx && y == cury))
+ if (x >= MINICOM_COLS || y > MINICOM_LINES || (x == curx && y == cury))
return;
if (use_status) {
/* Leaving status line? */
- if (cury == LINES && y < cury) {
+ if (cury == MINICOM_LINES && y < cury) {
outstr(FS);
/* Re-set attributes. */
tmp = curattr;
@@ -282,7 +282,7 @@ static void _gotoxy(int x, int y)
return;
}
/* Writing on status line? */
- else if (y == LINES) {
+ else if (y == MINICOM_LINES) {
/* From normal screen? */
if (cury < y) {
outstr(tgoto(TS, x, x));
@@ -298,11 +298,11 @@ static void _gotoxy(int x, int y)
}
#else
/* Sanity check. */
- if (x >= COLS || y >= LINES || (x == curx && y == cury)) {
+ if (x >= MINICOM_COLS || y >= MINICOM_LINES || (x == curx && y == cury)) {
# if 0
- if (x >= COLS || y >= LINES)
+ if (x >= MINICOM_COLS || y >= MINICOM_LINES)
fprintf(stderr, "OOPS: (x, y) == (%d, %d)\n",
- COLS, LINES);
+ MINICOM_COLS, MINICOM_LINES);
# endif
return;
}
@@ -345,7 +345,7 @@ static void _write(wchar_t c, int doit, int x, int y, char attr, char color)
* last line, last character. After scrolling, this "invisible"
* character is automatically restored.
*/
- if (_has_am && y >= LINES - 1 && x >= COLS - 1) {
+ if (_has_am && y >= MINICOM_LINES - 1 && x >= MINICOM_COLS - 1) {
doit = 0;
sflag = 1;
oldc.value = c;
@@ -353,9 +353,9 @@ static void _write(wchar_t c, int doit, int x, int y, char attr, char color)
oldc.color = color;
}
#ifdef ST_LINE
- if (x < COLS && y <= LINES)
+ if (x < MINICOM_COLS && y <= MINICOM_LINES)
#else
- if (x < COLS && y < LINES)
+ if (x < MINICOM_COLS && y < MINICOM_LINES)
#endif
{
if (doit != 0) {
@@ -380,7 +380,7 @@ static void _write(wchar_t c, int doit, int x, int y, char attr, char color)
curx++;
}
if (doit >= 0) {
- e = &gmap[x + y * COLS];
+ e = &gmap[x + y * MINICOM_COLS];
e->value = c;
e->attr = attr;
e->color = color;
@@ -428,7 +428,7 @@ void mc_wresize(WIN *win, int lines, int cols)
for (x = 0; x < cols; x++) {
n = &newmap[y + x * cols];
if (x < win->xs && y < win->ys) {
- e = &oldmap[y + x * COLS];
+ e = &oldmap[y + x * MINICOM_COLS];
n->value = e->value;
n->color = e->color;
n->attr = e->attr;
@@ -446,8 +446,8 @@ void mc_wresize(WIN *win, int lines, int cols)
free(oldmap);
if (win == stdwin) {
gmap = newmap;
- LINES = lines;
- COLS = cols;
+ MINICOM_LINES = lines;
+ MINICOM_COLS = cols;
} else
win->map = newmap;
}
@@ -485,10 +485,10 @@ WIN *mc_wopen(int x1, int y1, int x2, int y2, int border, int attr,
if (y1 < offs)
y1 = offs;
#if 0
- if (x2 >= COLS - offs)
- x2 = COLS - offs - 1;
- if (y2 >= LINES - offs)
- y2 = LINES - offs - 1;
+ if (x2 >= MINICOM_COLS - offs)
+ x2 = MINICOM_COLS - offs - 1;
+ if (y2 >= MINICOM_LINES - offs)
+ y2 = MINICOM_LINES - offs - 1;
#endif
w->xs = x2 - x1 + 1;
@@ -531,7 +531,7 @@ WIN *mc_wopen(int x1, int y1, int x2, int y2, int border, int attr,
bytes = (x2 - x1 + 1) * sizeof(ELM);
/* Loop */
for (y = y1; y <= y2; y++) {
- memcpy(e, gmap + COLS * y + x1, bytes);
+ memcpy(e, gmap + MINICOM_COLS * y + x1, bytes);
e += (x2 - x1 + 1);
}
@@ -649,7 +649,7 @@ void mc_wleave(void)
ocursor = _curstype;
setcbreak(0); /* Normal */
- _gotoxy(0, LINES - 1);
+ _gotoxy(0, MINICOM_LINES - 1);
_setattr(XA_NORMAL, COLATTR(WHITE, BLACK));
_cursor(CNORMAL);
if (CL != NULL)
@@ -688,8 +688,8 @@ void mc_wreturn(void)
_cursor(ocursor);
e = gmap;
- for (y = 0; y <LINES; y++) {
- for(x = 0; x < COLS; x++) {
+ for (y = 0; y <MINICOM_LINES; y++) {
+ for(x = 0; x < MINICOM_COLS; x++) {
_write(e->value, -1, x, y, e->attr, e->color);
e++;
}
@@ -750,7 +750,7 @@ static int _wclreol(WIN *w)
y = w->cury + w->y1;
- if (w->direct && (w->x2 == COLS - 1) && CE) {
+ if (w->direct && (w->x2 == MINICOM_COLS - 1) && CE) {
_gotoxy(w->curx + w->x1, y);
_setattr(w->attr, w->color);
outstr(CE);
@@ -779,12 +779,12 @@ void mc_wscroll(WIN *win, int dir)
* This improves performance on slow screens (eg ATARI ST) dramatically.
*/
if (win->direct && SF != NULL &&
- (dir == S_UP || SR != NULL) && (LINES == win->sy2 - win->sy1 + 1)) {
+ (dir == S_UP || SR != NULL) && (MINICOM_LINES == win->sy2 - win->sy1 + 1)) {
doit = 0;
phys_scr = 1;
_setattr(win->attr, win->color);
if (dir == S_UP) {
- _gotoxy(0, LINES - 1);
+ _gotoxy(0, MINICOM_LINES - 1);
outstr(SF);
} else {
_gotoxy(0, 0);
@@ -795,7 +795,7 @@ void mc_wscroll(WIN *win, int dir)
* If the window is as wide as the physical screen, we can
* scroll it with insert/delete line (or set scroll region - vt100!)
*/
- else if (win->direct && win->xs == COLS &&
+ else if (win->direct && win->xs == MINICOM_COLS &&
((CS != NULL && SF != NULL && SR != NULL)
|| (Dl != NULL && Al != NULL))) {
doit = 0;
@@ -806,7 +806,7 @@ void mc_wscroll(WIN *win, int dir)
* big as the physical screen, we don't _have_ to
* initialize it.
*/
- if (win->sy2 == LINES - 1 && win->sy1 == 0)
+ if (win->sy2 == MINICOM_LINES - 1 && win->sy1 == 0)
fs = 1;
if (!fs) {
outstr(tgoto(CS, win->sy2, win->sy1));
@@ -820,7 +820,7 @@ void mc_wscroll(WIN *win, int dir)
outstr(SR);
}
if (!fs) {
- outstr(tgoto(CS, LINES - 1, 0));
+ outstr(tgoto(CS, MINICOM_LINES - 1, 0));
cury = 0;
}
_gotoxy(0, win->sy2);
@@ -843,9 +843,9 @@ void mc_wscroll(WIN *win, int dir)
* to the lower right. After scrolling we have to restore
* the non-visible character that is now visible.
*/
- if (sflag && win->sy2 == (LINES - 1) && win->sy1 != win->sy2) {
+ if (sflag && win->sy2 == (MINICOM_LINES - 1) && win->sy1 != win->sy2) {
if (dir == S_UP) {
- _write(oldc.value, 1, COLS - 1, LINES - 2,
+ _write(oldc.value, 1, MINICOM_COLS - 1, MINICOM_LINES - 2,
oldc.attr, oldc.color);
}
sflag = 0;
@@ -858,7 +858,7 @@ void mc_wscroll(WIN *win, int dir)
win->sy2 == win->y2 && win->sy1 == win->y1) {
/* Calculate screen buffer */
- e = gmap + win->y1 * COLS + win->x1;
+ e = gmap + win->y1 * MINICOM_COLS + win->x1;
/* Calculate history buffer */
f = win->histbuf + (win->xs * win->histline);
@@ -903,7 +903,7 @@ void mc_wscroll(WIN *win, int dir)
/* Now scroll the memory image. */
if (dir == S_UP) {
for (y = win->sy1 + 1; y <= win->sy2; y++) {
- e = gmap + y * COLS + win->x1;
+ e = gmap + y * MINICOM_COLS + win->x1;
for (x = win->x1; x <= win->x2; x++) {
_write(e->value, win->direct && doit, x, y - 1, e->attr, e->color);
e++;
@@ -915,7 +915,7 @@ void mc_wscroll(WIN *win, int dir)
_wclreol(win);
} else {
for (y = win->sy2 - 1; y >= win->sy1; y--) {
- e = gmap + y * COLS + win->x1;
+ e = gmap + y * MINICOM_COLS + win->x1;
for (x = win->x1; x <= win->x2; x++) {
_write(e->value, win->direct && doit, x, y + 1, e->attr, e->color);
e++;
@@ -1195,7 +1195,7 @@ void mc_wcurbar(WIN *w, int y, int attr)
y += w->y1;
- e = gmap + y * COLS + w->x1;
+ e = gmap + y * MINICOM_COLS + w->x1;
/* If we can't do reverse, just put a '>' in front of
* the line. We only support XA_NORMAL & XA_REVERSE.
@@ -1447,7 +1447,7 @@ void mc_winclr(WIN *w)
/* contains them for cosmetic purposes or as separators. */
for (m = w->y2; m >= w->y1; m--) {
/* Start of this line in the global map. */
- e = gmap + m * COLS + w->x1;
+ e = gmap + m * MINICOM_COLS + w->x1;
/* Quick check to see if line is empty. */
for (i = 0; i < w->xs; i++)
@@ -1461,7 +1461,7 @@ void mc_winclr(WIN *w)
/* Copy window into history buffer line-by-line. */
for (y = w->y1; y <= m; y++) {
/* Start of this line in the global map. */
- e = gmap + y * COLS + w->x1;
+ e = gmap + y * MINICOM_COLS + w->x1;
/* Now copy this line. */
f = w->histbuf + (w->xs * w->histline); /* History buffer */
@@ -1475,7 +1475,7 @@ void mc_winclr(WIN *w)
_setattr(w->attr, w->color);
w->curx = 0;
- if (CL && w->y1 == 0 && w->y2 == LINES-1 && w->x1 == 0 && w->x2 == COLS-1) {
+ if (CL && w->y1 == 0 && w->y2 == MINICOM_LINES-1 && w->x1 == 0 && w->x2 == MINICOM_COLS-1) {
w->direct = 0;
curx = 0;
cury = 0;
@@ -1567,7 +1567,7 @@ void mc_winschar2(WIN *w, wchar_t c, int move)
}
odir = w->direct;
- if (w->xs == COLS && IC != NULL) {
+ if (w->xs == MINICOM_COLS && IC != NULL) {
/* We can use the insert character capability. */
if (w->direct)
outstr(IC);
@@ -1589,7 +1589,7 @@ void mc_winschar2(WIN *w, wchar_t c, int move)
buf = malloc(sizeof(ELM) * len);
if (!buf)
return; /* Umm... */
- memcpy(buf, gmap + COLS * y + x, sizeof(ELM) * len);
+ memcpy(buf, gmap + MINICOM_COLS * y + x, sizeof(ELM) * len);
/* Now, put the new character on screen. */
mc_wputc(w, c);
@@ -1625,14 +1625,14 @@ void mc_wdelchar(WIN *w)
x = w->x1 + w->curx;
y = w->y1 + w->cury;
- if (w->direct && w->xs == COLS && DC != NULL) {
+ if (w->direct && w->xs == MINICOM_COLS && DC != NULL) {
/*_gotoxy(x - 1, y);*/
_gotoxy(x, y);
outstr(DC);
doit = 0;
}
- e = gmap + y * COLS + x + 1;
+ e = gmap + y * MINICOM_COLS + x + 1;
for (; x < w->x2; x++) {
_write(e->value, doit && w->direct, x, y, e->attr, e->color);
@@ -1906,16 +1906,16 @@ int win_init(int fg, int bg, int attr)
fprintf(stderr, _("No cursor motion capability (cm)\n"));
return -1;
}
- LINES = COLS = 0;
- getrowcols(&LINES, &COLS);
+ MINICOM_LINES = MINICOM_COLS = 0;
+ getrowcols(&MINICOM_LINES, &MINICOM_COLS);
#ifdef BBS
- LINES = lines;
+ MINICOM_LINES = lines;
#endif
- if (LINES == 0 && (LINES = tgetnum("li")) <= 0) {
+ if (MINICOM_LINES == 0 && (MINICOM_LINES = tgetnum("li")) <= 0) {
fprintf(stderr, _("Number of terminal lines unknown\n"));
return -1;
}
- if (COLS == 0 && (COLS = tgetnum("co")) <= 0) {
+ if (MINICOM_COLS == 0 && (MINICOM_COLS = tgetnum("co")) <= 0) {
fprintf(stderr, _("Number of terminal columns unknown\n"));
return -1;
}
@@ -2053,7 +2053,7 @@ int win_init(int fg, int bg, int attr)
/* Memory for global map */
- if ((gmap = malloc(sizeof(ELM) * (LINES + 1) * COLS)) == NULL) {
+ if ((gmap = malloc(sizeof(ELM) * (MINICOM_LINES + 1) * MINICOM_COLS)) == NULL) {
fprintf(stderr, _("Not enough memory\n"));
return -1;
};
@@ -2068,10 +2068,10 @@ int win_init(int fg, int bg, int attr)
stdwin->doscroll = 1;
stdwin->x1 = 0;
stdwin->sy1 = stdwin->y1 = 0;
- stdwin->x2 = COLS - 1;
- stdwin->sy2 = stdwin->y2 = LINES - 1;
- stdwin->xs = COLS;
- stdwin->ys = LINES;
+ stdwin->x2 = MINICOM_COLS - 1;
+ stdwin->sy2 = stdwin->y2 = MINICOM_LINES - 1;
+ stdwin->xs = MINICOM_COLS;
+ stdwin->ys = MINICOM_LINES;
stdwin->attr = attr;
stdwin->color = COLATTR(fg, bg);
stdwin->direct = 1;
diff --git a/src/window.h b/src/window.h
index 1b8eb12..97f3bdd 100644
--- a/src/window.h
+++ b/src/window.h
@@ -62,7 +62,7 @@ typedef struct _win {
* Stdwin is the whole screen
*/
extern WIN *stdwin; /* Whole screen */
-extern int LINES, COLS; /* Size of screen */
+extern int MINICOM_LINES, MINICOM_COLS; /* Size of screen */
extern int usecolor; /* Use ansi color escape sequences */
extern int useattr; /* Use attributes (reverse, bold etc. ) */
extern int dirflush; /* Direct flush after write */
--
2.25.0