home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ukma!usenet.ins.cwru.edu!agate!ucbvax!SPOCK.FHCRC.ORG!JOE
- From: JOE@SPOCK.FHCRC.ORG (Joe Meadows)
- Newsgroups: comp.os.vms
- Subject: Re: Running LOGINOUT [SYS$CLI]
- Message-ID: <01GU0K146IMO9ULQBR@SPOCK.FHCRC.ORG>
- Date: 27 Jan 93 21:33:00 GMT
- Sender: daemon@ucbvax.BERKELEY.EDU
- Distribution: world
- Organization: The Internet
- Lines: 57
-
- At least one interesting thing that can be done with SYS$CLI and can't be
- done with LIB$ routines is the setting of strange symbols. For instance,
- you can't do the equivalent of:
-
- $ 80 == "SET TERMINAL/WIDTH=80"
-
- Using DCL or the LIB$SET_SYMBOL routine, however you _can_ do it using SYS$CLI.
- Oh, and lest anyone get their hopes up, you can't create integer symbols using
- it (so far as I can tell, to be honest I haven't checked the sources). I.E. you
- can't do the equivalent of "$ number == 6".
-
- In fact, here's a bit of C code to do the former:
-
- #include <clidef>
- #include <cliservdef>
- #include <descrip>
-
- typedef struct dsc$descriptor string;
-
- #define SLEN(a) (a).dsc$w_length
- #define STYPE(a) (a).dsc$b_dtype
- #define SCLASS(a) (a).dsc$b_class
- #define SADDR(a) (a).dsc$a_pointer
-
- #define STRING(a,b) {(a).dsc$w_length = strlen(b); (a).dsc$a_pointer = (b);}
-
- int set_symbol(char *symbol_name, char *symbol_value)
- {
- static struct
- {
- unsigned char cli$b_rqtype; /* request type */
- unsigned short cli$w_servcod; /* service code */
- unsigned char cli$b_rqstat; /* probably not correct, oh well.. */
- string cli$q_namdesc; /* symbol name */
- string cli$q_valdesc; /* symbol value */
- } blk = {CLI$K_CLISERV, CLI$K_DEFGLOBAL, 0};
-
- STRING(blk.cli$q_namdesc, symbol_name);
- STRING(blk.cli$q_valdesc, symbol_value);
-
- return sys$cli(&blk);
- }
-
- main(int argc, char *argv[])
- {
- int status;
-
- status = set_symbol("24", "set term/page=24");
- if (!(status & 1)) lib$signal(status);
-
- /* etc. */
- }
-
-
- Cheers,
- Joe Meadows joe@kirk.fhcrc.org meadowsj@boeing.com etc...
-
-