home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.os.vms:17853 comp.lang.c:16399
- Newsgroups: comp.os.vms,comp.lang.c
- Path: sparky!uunet!stanford.edu!rock!concert!rti!jbs
- From: jbs@rti.rti.org
- Subject: Re: Getting terminal width from VAX-C ?
- Message-ID: <1992Nov12.152852.3935@rti.rti.org>
- Keywords: terminal_width
- Organization: Research Triangle Institute, RTP, NC
- References: <1992Nov11.101009.87@front.se>
- Date: Thu, 12 Nov 92 15:28:52 GMT
- Lines: 53
-
- In article <1992Nov11.101009.87@front.se> samuel@front.se writes:
- >
- >Does anybody out there know how to get the TERMINAL WIDTH from VAX-C ?
- >
- >How do I implement the function "terminal_width()" ?
-
-
- #include <stdio.h>
- #include <ttdef.h>
- #include <descrip.h>
- #include <iodef.h>
- #include <ssdef.h>
-
- /* I/O status block information. */
- struct {
- short iosb_cond, iosb_count;
- int iosb_dev;
- } iosb;
-
- short chan;
-
- int status, i;
-
- /* characteristics buffer */
- struct {
- unsigned char class, type;
- short page_width;
- int rest;
- } termchars;
-
- $DESCRIPTOR(terminal,"TT:");
-
-
- int terminal_width()
- {
- if(((status = SYS$QIOW(0,chan,IO$_SENSEMODE,&iosb,0,0,&termchars,
- 8,0,0,0,0))&1)!=1)
- LIB$STOP(status);
- if ((iosb.iosb_cond &1)!=1)
- LIB$STOP(status);
- return(termchars.page_width);
- }
-
-
- main()
- {
- /* Assign a channel to the terminal */
- if (((status = SYS$ASSIGN(&terminal,&chan,0,0))&1)!=1)
- LIB$STOP(status);
-
- printf("Current terminal page width = %d\n",terminal_width());
- }
-
-