v02i017: 3270tool enhancements
Charles Mcgrew
mcgrew at aramis.rutgers.edu
Sat Aug 25 06:16:39 AEST 1990
Submitted-by: zjat02 at trc.amoco.com (Jon A. Tankersley)
Posting-number: Volume 2, Issue 17
Archive-name: 3270tool/enhance01
Enhancements to 3270tool to support model 3-5 3278 terminals.
Robert Viduya isn't supporting this package anymore (he uses X now). I don't
know if I can support it either (we're moving to X), but I can answer some
questions on it. Here is Robert's 'disclaimer':
>Perhaps you might want to post your changes to sun-spots and/or comp.sys.sun?
>That way those two archives can get updated. I mentioned in the notes I
>included when I distributed the program that I'd written the program a
>year or two ago (it took me that long to get permission to release it)
>and that I'd since stopped using SunView and had switched to X. At this
>point, I really don't feel comfortable at all acting as a clearinghouse
>for 3270tool because I no longer run in an environment that allows me
>to fully test out any changes people send me.
*** 3270.h Thu Jul 26 13:30:53 1990
--- ../3270.h Wed Aug 1 13:15:47 1990
***************
*** 36,43 ****
#define ORDER_YALE 0x2B /* Yale sub command */
/* screen dimensions */
! #define COLS 80
! #define ROWS 24
#define CHAR_WIDTH (ibmfont->pf_char[0x10].pc_pr->pr_size.x)
#define CHAR_HEIGHT (ibmfont->pf_char[0x10].pc_pr->pr_size.y)
--- 36,44 ----
#define ORDER_YALE 0x2B /* Yale sub command */
/* screen dimensions */
! /* #define COLS 80 */
! /* #define ROWS 24 */
! extern int COLS, ROWS, ROWSCOLS;
#define CHAR_WIDTH (ibmfont->pf_char[0x10].pc_pr->pr_size.x)
#define CHAR_HEIGHT (ibmfont->pf_char[0x10].pc_pr->pr_size.y)
***************
*** 53,59 ****
#define ROWCOL_TO_BA(r,c) (((r) * COLS) + c)
#define INC_BA(ba) \
{ \
! if (++ba >= (COLS * ROWS)) \
ba = 0; \
}
--- 54,60 ----
#define ROWCOL_TO_BA(r,c) (((r) * COLS) + c)
#define INC_BA(ba) \
{ \
! if (++ba >= (ROWSCOLS)) \
ba = 0; \
}
***************
*** 60,66 ****
#define DEC_BA(ba) \
{ \
if (--ba < 0) \
! ba = (COLS * ROWS) - 1; \
}
--- 61,67 ----
#define DEC_BA(ba) \
{ \
if (--ba < 0) \
! ba = (ROWSCOLS) - 1; \
}
*** 3270tool.1 Thu Jul 26 14:24:49 1990
--- ../3270tool.1 Wed Aug 1 17:28:40 1990
***************
*** 1,15 ****
'\" t
! .TH 3270TOOL 1 "March 28, 1989"
.SH NAME
3270tool \- IBM remote host access tool
.SH SYNOPSIS
! .B 3270tool
host
.SH DESCRIPTION
.I 3270tool
opens a telnet connection to the given IBM host in a SunView window.
! The created window provides a fairly complete IBM 3278 Model 2 terminal
! emulation.
.I 3270tool
is similar to
.I tn3270 (1)
--- 1,19 ----
'\" t
! .TH 3270TOOL 1 "July 26, 1990"
.SH NAME
3270tool \- IBM remote host access tool
.SH SYNOPSIS
! .B 3270tool [ \-m 2|3|4|5 ]
host
.SH DESCRIPTION
.I 3270tool
opens a telnet connection to the given IBM host in a SunView window.
! The created window provides a fairly complete IBM 3278 terminal emulation.
! By specifying the
! .b \-m
! flag you can chose other IBM 3278 model layouts. Model 2 has 24x80 screen,
! Model 3 has 32x80, Model 4 has 43x80, and Model 5 has 27x132 screen.
! The default is a Model 4.
.I 3270tool
is similar to
.I tn3270 (1)
*** 3270tool.c Thu Jul 26 13:30:39 1990
--- ../3270tool.c Wed Aug 1 17:21:59 1990
***************
*** 25,31 ****
--- 25,48 ----
int net_sock;
extern Notify_value net_input ();
+ /*
+ * Modifications for variable sized screens.....
+ * 07/27/90 jat
+ */
+ int COLS, ROWS, ROWSCOLS;
+ u_char *screen_buf;
+ u_char *prim_seln; /* enough for screen + eols */
+ u_char *shelf_seln;
+ u_char ttype_model;
+ extern int errno;
+ extern char *optarg;
+ extern int optind, opterr;
+ int c = 0,
+ model,
+ errflg = 0;
+ static char usage[] = { "3270tool: Usage 3270tool [ -m 2|3|4|5 ] ibm-host" };
+
main (argc, argv)
int argc;
***************
*** 41,51 ****
FRAME_ARGC_PTR_ARGV, &argc, argv,
0
);
if (argc <= 1) {
! (void) fprintf (stderr, "usage: 3270tool ibm-host\n");
exit (1);
}
! net_sock = connect_net (argv[1]);
screen_init ();
key_panel_init ();
menu_init ();
--- 58,115 ----
FRAME_ARGC_PTR_ARGV, &argc, argv,
0
);
+
+ /*
+ * check for model type
+ */
+ COLS=80; ROWS=43; /* default to type 4 */
+ ttype_model='4'; /* and model type to 4 */
+ ROWSCOLS=ROWS*COLS; /* save some time here */
+ while((c = getopt(argc, argv, "m:")) != EOF) {
+ switch(c) {
+ case 'm':
+ model=atoi(optarg);
+ switch(model) {
+ case 2: COLS=80; ROWS=24; /* type 2 */
+ ROWSCOLS=ROWS*COLS;
+ ttype_model = *optarg;
+ break;
+ case 3: COLS=80; ROWS=32; /* type 3 */
+ ROWSCOLS=ROWS*COLS;
+ ttype_model = *optarg;
+ break;
+ case 4: COLS=80; ROWS=43; /* type 4 */
+ ROWSCOLS=ROWS*COLS;
+ ttype_model = *optarg;
+ break;
+ case 5: COLS=132; ROWS=27; /* type 5 */
+ ROWSCOLS=ROWS*COLS;
+ ttype_model = *optarg;
+ break;
+ default: errflg++; /* unknown */
+ break;
+ }
+ break;
+ default:
+ errflg++; /* unknown */
+ break;
+ }
+ }
+ if (errflg) {
+ (void) fprintf(stderr,"%s\n",usage);
+ exit(2);
+ }
if (argc <= 1) {
! (void) fprintf (stderr, "%s\n", usage);
exit (1);
}
! screen_buf = (u_char *) malloc(ROWSCOLS);
! prim_seln = (u_char *) malloc(ROWSCOLS + ROWS + 1);
! shelf_seln = (u_char *) malloc(ROWSCOLS + ROWS + 1);
! net_sock = connect_net (argv[optind]);
! /*
! * end of changes
! */
screen_init ();
key_panel_init ();
menu_init ();
*** Makefile Thu Aug 2 12:51:33 1990
--- ../Makefile Thu Aug 2 12:53:49 1990
***************
*** 11,17 ****
# BINDIR destination of the binary
# MANDIR destination of the manual page
# MANEXT the . extension of the installed manual page
! # CFLAGS add -DTYPE4KBD if you have a Type 4 kybd
#
FONTDIR = /usr/local/lib/fonts
BINDIR = /usr/local/bin
--- 11,19 ----
# BINDIR destination of the binary
# MANDIR destination of the manual page
# MANEXT the . extension of the installed manual page
! # CFLAGS C flags
! # KBDFLGS change to -DTYPE4KBD
! # FNTFLGS Font directory define
#
FONTDIR = /usr/local/lib/fonts
BINDIR = /usr/local/bin
***************
*** 18,27 ****
MANDIR = /usr/man/manl
MANEXT = l
CC = cc
! CFLAGS = -O2 -DFONT3270=\"$(FONTDIR)/3270.font\"
3270tool: 3270tool.o screen.o telnet.o kybd.o keypanel.o selection.o
! $(CC) $(CFLAGS) -o 3270tool 3270tool.o screen.o telnet.o kybd.o keypanel.o selection.o -lsunwindow -lsuntool -lpixrect
install: $(BINDIR)/3270tool $(MANDIR)/3270tool.$(MANEXT) $(FONTDIR)/3270.font
--- 20,34 ----
MANDIR = /usr/man/manl
MANEXT = l
CC = cc
! CFLAGS = -O2
! LIBS = -lsunwindow -lsuntool -lpixrect
! FNTFLGS = -DFONT3270=\"$(FONTDIR)/3270.font\"
! KBDFLGS = -DTYPE3KBD
! #KBDFLGS = -DDEBUG
! ####KBDFLGS = -DTYPE4KBD -DTYPE3KBD
3270tool: 3270tool.o screen.o telnet.o kybd.o keypanel.o selection.o
! $(CC) $(CFLAGS) -o 3270tool 3270tool.o screen.o telnet.o kybd.o keypanel.o selection.o $(LIBS)
install: $(BINDIR)/3270tool $(MANDIR)/3270tool.$(MANEXT) $(FONTDIR)/3270.font
***************
*** 56,58 ****
--- 63,76 ----
selection.o: selection.c 3270.h 3270_enc.h
$(CC) $(CFLAGS) -c selection.c
+
+ SRC=3270tool.c telnet.c keypanel.c selection.c
+ OBJ=3270tool.o telnet.o keypanel.o selection.o screen.o kybd.o
+
+ saber_src:
+ #load -g $(CFLAGS) $(SRC) $(LIBS)
+ #load -g -DFONT3270=\\"$(FONTDIR)/3270.font\\" screen.c
+ #load -g -DTYPE3KBD -DDEBUG kybd.c
+
+ saber_obj:
+ #load -g $(OBJ) $(LIBS)
*** kybd.c Thu Jul 26 13:30:39 1990
--- ../kybd.c Wed Aug 1 12:09:06 1990
***************
*** 102,108 ****
u_char aid = AID_NO; /* current attention ID */
Menu Key_menu;
! extern u_char screen_buf[ROWS * COLS];
extern int cursor_addr, buffer_addr;
extern Pixwin *pixwin;
extern Canvas canvas;
--- 102,109 ----
u_char aid = AID_NO; /* current attention ID */
Menu Key_menu;
! /*extern u_char screen_buf[ROWS * COLS];*/
! extern u_char *screen_buf;
extern int cursor_addr, buffer_addr;
extern Pixwin *pixwin;
extern Canvas canvas;
***************
*** 242,249 ****
bcopy ((char *) &screen_buf[baddr], (char *) &screen_buf[baddr+1], end_baddr - baddr);
else {
bcopy ((char *) &screen_buf[0], (char *) &screen_buf[1], end_baddr);
! screen_buf[0] = screen_buf[(ROWS * COLS) - 1];
! bcopy ((char *) &screen_buf[baddr], (char *) &screen_buf[baddr+1], ((ROWS * COLS) - 1) - baddr);
}
screen_buf[baddr] = cgcode;
cursor_off ();
--- 243,250 ----
bcopy ((char *) &screen_buf[baddr], (char *) &screen_buf[baddr+1], end_baddr - baddr);
else {
bcopy ((char *) &screen_buf[0], (char *) &screen_buf[1], end_baddr);
! screen_buf[0] = screen_buf[(ROWSCOLS) - 1];
! bcopy ((char *) &screen_buf[baddr], (char *) &screen_buf[baddr+1], ((ROWSCOLS) - 1) - baddr);
}
screen_buf[baddr] = cgcode;
cursor_off ();
***************
*** 496,502 ****
return;
baddr = cursor_addr - COLS;
if (baddr < 0)
! baddr = (cursor_addr + (ROWS * COLS)) - COLS;
cursor_move (baddr);
}
--- 497,503 ----
return;
baddr = cursor_addr - COLS;
if (baddr < 0)
! baddr = (cursor_addr + (ROWSCOLS)) - COLS;
cursor_move (baddr);
}
***************
*** 510,516 ****
if (kybdlock)
return;
! baddr = (cursor_addr + COLS) % (COLS * ROWS);
cursor_move (baddr);
}
--- 511,517 ----
if (kybdlock)
return;
! baddr = (cursor_addr + COLS) % (ROWSCOLS);
cursor_move (baddr);
}
***************
*** 525,531 ****
if (kybdlock)
return;
! baddr = (cursor_addr + COLS) % (COLS * ROWS); /* down */
baddr = (baddr / COLS) * COLS; /* 1st col */
fa = get_field_attribute (baddr);
if (fa != (&screen_buf[baddr]) && !FA_IS_PROTECTED (*fa))
--- 526,532 ----
if (kybdlock)
return;
! baddr = (cursor_addr + COLS) % (ROWSCOLS); /* down */
baddr = (baddr / COLS) * COLS; /* 1st col */
fa = get_field_attribute (baddr);
if (fa != (&screen_buf[baddr]) && !FA_IS_PROTECTED (*fa))
***************
*** 1112,1119 ****
if (end_baddr > baddr)
bcopy ((char *) &screen_buf[baddr+1], (char *) &screen_buf[baddr], end_baddr - baddr);
else {
! bcopy ((char *) &screen_buf[baddr+1], (char *) &screen_buf[baddr], ((ROWS * COLS) - 1) - baddr);
! screen_buf[(ROWS * COLS) - 1] = screen_buf[0];
bcopy ((char *) &screen_buf[1], (char *) &screen_buf[0], end_baddr);
}
screen_buf[end_baddr] = CG_NULLBLANK;
--- 1113,1120 ----
if (end_baddr > baddr)
bcopy ((char *) &screen_buf[baddr+1], (char *) &screen_buf[baddr], end_baddr - baddr);
else {
! bcopy ((char *) &screen_buf[baddr+1], (char *) &screen_buf[baddr], ((ROWSCOLS) - 1) - baddr);
! screen_buf[(ROWSCOLS) - 1] = screen_buf[0];
bcopy ((char *) &screen_buf[1], (char *) &screen_buf[0], end_baddr);
}
screen_buf[end_baddr] = CG_NULLBLANK;
***************
*** 1329,1335 ****
return (NOTIFY_IGNORED);
baddr = ROWCOL_TO_BA(Y_TO_ROW (event_y (event)),
X_TO_COL (event_x (event)));
! while (baddr >= (COLS * ROWS))
baddr -= COLS;
cursor_move (baddr);
break;
--- 1330,1336 ----
return (NOTIFY_IGNORED);
baddr = ROWCOL_TO_BA(Y_TO_ROW (event_y (event)),
X_TO_COL (event_x (event)));
! while (baddr >= (ROWSCOLS))
baddr -= COLS;
cursor_move (baddr);
break;
***************
*** 1336,1342 ****
case MS_MIDDLE: /* middle mouse sets selections */
baddr = ROWCOL_TO_BA(Y_TO_ROW (event_y (event)),
X_TO_COL (event_x (event)));
! while (baddr >= (COLS * ROWS))
baddr -= COLS;
set_seln (cursor_addr, baddr);
break;
--- 1337,1343 ----
case MS_MIDDLE: /* middle mouse sets selections */
baddr = ROWCOL_TO_BA(Y_TO_ROW (event_y (event)),
X_TO_COL (event_x (event)));
! while (baddr >= (ROWSCOLS))
baddr -= COLS;
set_seln (cursor_addr, baddr);
break;
*** screen.c Thu Jul 26 13:30:39 1990
--- ../screen.c Wed Aug 1 14:27:07 1990
***************
*** 158,164 ****
/* the following are set from values in the 3270 font */
int char_width, char_height, char_base;
! u_char screen_buf[ROWS * COLS];
bool formatted = FALSE; /* set in screen_disp */
struct itimerval blink_timer;
--- 158,165 ----
/* the following are set from values in the 3270 font */
int char_width, char_height, char_base;
! /* u_char screen_buf[ROWS * COLS]; */
! extern u_char *screen_buf;
bool formatted = FALSE; /* set in screen_disp */
struct itimerval blink_timer;
***************
*** 220,226 ****
COL_TO_X (COLS), ROW_TO_Y (ROWS) + 2,
PIX_SET, 1
);
! bzero ((char *) screen_buf, sizeof (screen_buf));
cursor_addr = 0;
buffer_addr = 0;
pw_batch_on (pixwin);
--- 221,227 ----
COL_TO_X (COLS), ROW_TO_Y (ROWS) + 2,
PIX_SET, 1
);
! bzero ((char *) screen_buf, ROWSCOLS);
cursor_addr = 0;
buffer_addr = 0;
pw_batch_on (pixwin);
***************
*** 643,649 ****
case CMD_EWA: /* erase/write alternate */
/* on 3278-2, same as erase/write. fallthrough */
case CMD_EW: /* erase/write */
! bzero ((char *) screen_buf, sizeof (screen_buf));
buffer_addr = 0;
cursor_off ();
pw_writebackground (pixwin, 0, 0, COL_TO_X (COLS), ROW_TO_Y (ROWS), PIX_CLR);
--- 644,650 ----
case CMD_EWA: /* erase/write alternate */
/* on 3278-2, same as erase/write. fallthrough */
case CMD_EW: /* erase/write */
! bzero ((char *) screen_buf, ROWSCOLS);
buffer_addr = 0;
cursor_off ();
pw_writebackground (pixwin, 0, 0, COL_TO_X (COLS), ROW_TO_Y (ROWS), PIX_CLR);
***************
*** 812,818 ****
cursor_move (0);
}
else {
! bzero ((char *) screen_buf, sizeof (screen_buf));
pw_writebackground (pixwin, 0, 0, COL_TO_X (COLS), ROW_TO_Y (ROWS), PIX_CLR);
buffer_addr = 0;
cursor_move (0);
--- 813,819 ----
cursor_move (0);
}
else {
! bzero ((char *) screen_buf, ROWSCOLS);
pw_writebackground (pixwin, 0, 0, COL_TO_X (COLS), ROW_TO_Y (ROWS), PIX_CLR);
buffer_addr = 0;
cursor_move (0);
***************
*** 885,891 ****
buffer_addr = ((*(cp-1) & 0x3F) << 8) | *cp;
else /* 12-bit coded */
buffer_addr = ((*(cp-1) & 0x3F) << 6) | (*cp & 0x3F);
! buffer_addr %= (COLS * ROWS);
current_fa = get_field_attribute (buffer_addr);
last_cmd = TRUE;
break;
--- 886,892 ----
buffer_addr = ((*(cp-1) & 0x3F) << 8) | *cp;
else /* 12-bit coded */
buffer_addr = ((*(cp-1) & 0x3F) << 6) | (*cp & 0x3F);
! buffer_addr %= (ROWSCOLS);
current_fa = get_field_attribute (buffer_addr);
last_cmd = TRUE;
break;
***************
*** 927,933 ****
baddr = ((*(cp-1) & 0x3F) << 8) | *cp;
else /* 12-bit coded */
baddr = ((*(cp-1) & 0x3F) << 6) | (*cp & 0x3F);
! baddr %= (COLS * ROWS);
cp++; /* skip char to repeat */
if (*cp == ORDER_GE)
cp++;
--- 928,934 ----
baddr = ((*(cp-1) & 0x3F) << 8) | *cp;
else /* 12-bit coded */
baddr = ((*(cp-1) & 0x3F) << 6) | (*cp & 0x3F);
! baddr %= (ROWSCOLS);
cp++; /* skip char to repeat */
if (*cp == ORDER_GE)
cp++;
***************
*** 950,956 ****
baddr = ((*(cp-1) & 0x3F) << 8) | *cp;
else /* 12-bit coded */
baddr = ((*(cp-1) & 0x3F) << 6) | (*cp & 0x3F);
! baddr %= (COLS * ROWS);
do {
if (IS_FA (screen_buf[buffer_addr]))
current_fa = &(screen_buf[buffer_addr]);
--- 951,957 ----
baddr = ((*(cp-1) & 0x3F) << 8) | *cp;
else /* 12-bit coded */
baddr = ((*(cp-1) & 0x3F) << 6) | (*cp & 0x3F);
! baddr %= (ROWSCOLS);
do {
if (IS_FA (screen_buf[buffer_addr]))
current_fa = &(screen_buf[buffer_addr]);
*** selection.c Thu Jul 26 13:30:39 1990
--- ../selection.c Wed Aug 1 12:09:07 1990
***************
*** 23,34 ****
bool seln_isset;
int row_start, row_end, col_start, col_end; /* selection area */
Seln_client s_client;
! u_char prim_seln[ROWS * COLS + ROWS + 1];/* enough for screen + eols */
int prim_size = 0;
! u_char shelf_seln[ROWS * COLS + ROWS + 1];
int shelf_size = 0;
extern u_char asc2cg[128], cg2asc[256];
! extern u_char screen_buf[ROWS * COLS];
extern Pixwin *pixwin;
extern Pixfont *ibmfont;
extern int char_width, char_height, char_base;
--- 23,35 ----
bool seln_isset;
int row_start, row_end, col_start, col_end; /* selection area */
Seln_client s_client;
! /* u_char prim_seln[ROWS * COLS + ROWS + 1];/* enough for screen + eols */
int prim_size = 0;
! /* u_char shelf_seln[ROWS * COLS + ROWS + 1]; */
int shelf_size = 0;
extern u_char asc2cg[128], cg2asc[256];
! /* extern u_char screen_buf[ROWS * COLS]; */
! extern u_char *screen_buf, *prim_seln, *shelf_seln;
extern Pixwin *pixwin;
extern Pixfont *ibmfont;
extern int char_width, char_height, char_base;
*** telnet.c Thu Jul 26 13:30:39 1990
--- ../telnet.c Wed Aug 1 13:58:29 1990
***************
*** 49,54 ****
--- 49,55 ----
static u_char ttype_opt[] = { IAC, SB, TELOPT_TTYPE, TELQUAL_IS,
'I', 'B', 'M', '-', '3', '2', '7', '8', '-', '2',
IAC, SE };
+ extern u_char ttype_model;
extern Frame frame;
extern u_long inet_addr ();
***************
*** 259,264 ****
--- 260,266 ----
if (*cp == SE) {
telnet_state = TNS_DATA;
if (sbbuf[0] == TELOPT_TTYPE && sbbuf[1] == TELQUAL_SEND) {
+ ttype_opt[13] = ttype_model;
(void) write (fd, (char *) ttype_opt, sizeof (ttype_opt));
}
}
More information about the Comp.sources.sun
mailing list