--- freem/src/service.c 2025/03/09 19:50:47 1.7
+++ freem/src/service.c 2025/04/09 19:52:02 1.13
@@ -1,5 +1,5 @@
/*
- * $Id: service.c,v 1.7 2025/03/09 19:50:47 snw Exp $
+ * $Id: service.c,v 1.13 2025/04/09 19:52:02 snw Exp $
* terminal and sequential I/O handling,
* file and global locking
*
@@ -25,6 +25,24 @@
* along with FreeM. If not, see .
*
* $Log: service.c,v $
+ * Revision 1.13 2025/04/09 19:52:02 snw
+ * Eliminate as many warnings as possible while building with -Wall
+ *
+ * Revision 1.12 2025/03/24 04:05:36 snw
+ * Replace crlf with frm_crlf to avoid symbol conflict with readline on OS/2
+ *
+ * Revision 1.11 2025/03/24 02:00:30 snw
+ * Work around some OS/2 incompatibilities in service.c
+ *
+ * Revision 1.10 2025/03/24 01:55:46 snw
+ * Work around some OS/2 incompatibilities in service.c
+ *
+ * Revision 1.9 2025/03/24 01:54:09 snw
+ * Work around some OS/2 incompatibilities in set_break and set_zbreak
+ *
+ * Revision 1.8 2025/03/24 01:52:30 snw
+ * Work around some OS/2 incompatibilities in set_break and set_zbreak
+ *
* Revision 1.7 2025/03/09 19:50:47 snw
* Second phase of REUSE compliance and header reformat
*
@@ -79,6 +97,10 @@ int scosgr (short att, short bwflag);
# if !defined(MSDOS)
# include
# endif
+# if defined(__OS2__)
+# include
+# define termio termios
+# endif
# endif
#else
# include
@@ -981,7 +1003,9 @@ end:
void writeHOME (char *text)
{
+#if !defined(__OS2__)
struct winsize terminal_window;
+#endif
static char initflag = TRUE; /* initialisation flag */
static char esc = 0; /* esc processing flag */
static char dcs = 0; /* device control processing flag */
@@ -1042,13 +1066,18 @@ void writeHOME (char *text)
* and the 'hardcopy function'
*/
if (initflag) {
-
+
+#if !defined(__OS2__)
/* TODO: why are we casting to void here? */
(void) ioctl(STDOUT_FILENO, TIOCGWINSZ, &terminal_window);
n_lines = terminal_window.ws_row;
n_columns = terminal_window.ws_col;
-
+#else
+ n_lines = 25;
+ n_columns = 80;
+#endif
+
screen = (struct vtstyp *) calloc (1, sizeof (struct vtstyp));
ris (screen);
@@ -2735,13 +2764,15 @@ void part_ref (struct vtstyp *scr, short
short l;
short max;
unsigned char exa;
+#if !defined(LINUX) && defined(COLOR)
unsigned char exc;
+#endif
short i;
unsigned char *linea;
unsigned char *linex;
unsigned char *linec;
unsigned char ch;
- unsigned char tmp[1300];
+ char tmp[1300]; /* was unsigned char tmp... (snw 4-9-2025) */
/* build up alternate screen */
/* reset SGR,TBM;white on black,go HOME; 25 Lines */
@@ -2811,7 +2842,10 @@ void part_ref (struct vtstyp *scr, short
}
exa = ~linea[0]; /* dummy value to trigger argument codes on 1st char */
+
+#if !defined(LINUX) && defined(COLOR)
exc = ~linec[0]; /* dummy value to trigger argument codes on 1st char */
+#endif
for (l = 0; l <= max; l++) {
@@ -3296,7 +3330,7 @@ void write_m (char *text)
ypos[io]++;
- if (crlf[io]) xpos[io] = 0;
+ if (frm_crlf[io]) xpos[io] = 0;
continue;
@@ -3389,9 +3423,7 @@ void read_m (char *stuff, long read_time
static char term_key[256] = {EOL, EOL};
static short int escptr;
static short int single;
- static short int timoflag; /* timeout flag */
- static long int timex;
- static short int timexms;
+ static short int timoflag; /* timeout flag */
static short int i;
static int ch;
@@ -3413,10 +3445,7 @@ void read_m (char *stuff, long read_time
stuff[0] = EOL;
if (length < 1) single = length = 1;
-
- timex = 0L;
- timexms = 0;
-
+
if (io == HOME) opnfile[HOME] = stdin;
if (io == HOME && !frm_filter) {
@@ -4127,7 +4156,7 @@ void read_m (char *stuff, long read_time
if (single) break;
- if (ch == LF && crlf[io]) {
+ if (ch == LF && frm_crlf[io]) {
i--;
continue;
}
@@ -4431,6 +4460,7 @@ void set_io (short action)
/* DEL = UNIX quit */
void set_break (short break_char)
{
+#if !defined(__OS2__)
struct termio arg;
ioctl (0, TCGETA, &arg);
@@ -4438,7 +4468,7 @@ void set_break (short break_char)
arg.c_cc[VINTR] = break_char; /* interrupt = CTRL/C */
ioctl (0, TCSETA, &arg);
-
+#endif
return;
} /* end of set_break() */
@@ -4449,6 +4479,7 @@ void set_break (short break_char)
/* DEL = UNIX quit */
void set_zbreak (short quit_char)
{
+#if !defined(__OS2__)
struct termio arg;
ioctl (0, TCGETA, &arg);
@@ -4456,7 +4487,7 @@ void set_zbreak (short quit_char)
arg.c_cc[VQUIT] = quit_char;
ioctl (0, TCSETA, &arg);
-
+#endif
return;
} /* end of set_zbreak() */
@@ -4501,6 +4532,8 @@ void set_io (short action) /* set io_
void set_break (short break_char)
{
+
+#if !defined(__OS2__)
struct termios termios_p;
tcgetattr (0, &termios_p);
@@ -4508,14 +4541,14 @@ void set_break (short break_char)
termios_p.c_cc[VINTR] = break_char; /* interrupt = CTRL/C */
tcsetattr (0, TCSADRAIN, &termios_p); /* set paramters */
-
+#endif
return;
} /* end of set_break() */
void set_zbreak (short quit_char)
{
-
+#if !defined(__OS2__)
struct termios termios_p;
tcgetattr (0, &termios_p);
@@ -4523,7 +4556,7 @@ void set_zbreak (short quit_char)
termios_p.c_cc[VQUIT] = quit_char;
tcsetattr (0, TCSADRAIN, &termios_p); /* set paramters */
-
+#endif
return;
} /* end of set_zbreak() */