Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : VMS_ACL.ZIP
Filename : BTN_SET.C

 
Output of file : BTN_SET.C contained in archive : VMS_ACL.ZIP
/*************************************************************************
**
** Module Name : button_set.c
**
** Purpose : To create symbols to all applications for which the
** user has been granted identifiers.
**
** Parameters : SYS$INPUT read cards in triplets of ..
** identifier display_value symbol_value
**
** Return value: SS$_NORMAL
**
** Side affects: Assigns values to the global symbol table.
**
** *** Revision History ***
**
** Date Description
** -------- --------------------------------------------------------
** 05/29/90 Steve Coleman R. S. Carson & Assoc Initial Revision
** 05/30/90 Steve Coleman Added default (MAXKEYS) number of keys to setup.
*************************************************************************/
#include
#include
#include "libi:dsc.h"

#define MAXUAF 50 /* maximun number of identifiers held by a user */
#define MAXCNFG 50 /* maximum allowable SYS$INPUT records to be read */
#define TABLE 1 /* 1 = local symbol table ; 2 = global symbol table */
#define MAXKEYS 9 /* the number of keys to define as symbols */

struct ID_TYPE {
int id;
int unused;
};

struct CONFIG_TYPE {
int id;
char display[81];
char command[81];
};


main(argc,argv)
int argc;
char ** argv;
{
int retcode; /* general return status */
dsc$s user_name; /* user name descriptor */
char user_name_buf[32]; /* user name buffer */
dsc$s id_name; /* identifier descriptor */
char id_name_buf[32]; /* identifier name buffer */
struct ID_TYPE uaf_ident = {0,0}; /* uaf id structure */
struct ID_TYPE user_ident = {0,0}; /* user identifier structure */
struct CONFIG_TYPE config[MAXCNFG]; /* array of id codes,commands */
int attrib;
int contxt = 0;
int namlen;
int resid;
int done;
int uafcnt;
int uaf[MAXUAF];
int idx1,idx2;
int cmdcnt=0;
int keynum;
char keyname[81];

/* get user name and UID number */
strcpy(user_name_buf,getenv("USER") );
SET_DSC$(user_name,strlen(user_name_buf),user_name_buf);
retcode = sys$asctoid (&user_name,&user_ident,NULL);

/* load all user UAF codes held by this user */
uafcnt = attrib = done = contxt = 0;
while (!done) {

retcode = sys$find_held(&user_ident, &uaf_ident, NULL, &contxt);

if (retcode != SS$_NORMAL) {
sys$finish_rdb( &contxt );
done = 1;
}
else {
uaf[uafcnt++] = uaf_ident.id;
}
}

/* read input cards from DCL SYS$INPUT and find their ident no. */
while( scanf("%s%s%s",
id_name_buf,&config[cmdcnt].display,&config[cmdcnt].command) != EOF) {

SET_DSC$(id_name,strlen(id_name_buf),id_name_buf);
retcode = sys$asctoid (&id_name,&uaf_ident,NULL);

if (retcode != SS$_NORMAL)
printf("Error %d, invalid identifier :%s\n\n",retcode,id_name_buf);
else {
config[cmdcnt].id = uaf_ident.id;
cmdcnt++;
}
}
keynum = 1;
for(idx1 = 0 ; idx1 < cmdcnt ; idx1++ ){
for(idx2 = 0 ; idx2 < uafcnt ; idx2++ ){
if( config[idx1].id == uaf[idx2]) {

/* assign the command string into a DCL variable */
sprintf(keyname,"keyval%d",keynum); /* keyval# :== command str */
set_symbol(keyname,&config[idx1].command,TABLE);

/* assign the key 'display value' into a DCL variable */
sprintf(keyname,"keydsp%d",keynum); /* keydsp# :== display value */
set_symbol(keyname,&config[idx1].display,TABLE);

keynum++;
}
}
}

/* set a default value for remaining keys so they will not be undefined */
while(keynum <= MAXKEYS) {

sprintf(keyname,"keyval%d",keynum); /* keyval# :== "" */
set_symbol(keyname,"",TABLE);

sprintf(keyname,"keydsp%d",keynum); /* keydsp# :== "" */
set_symbol(keyname,"Not Installed.",TABLE);

keynum++;
}
}

/* set VAX global symbol values for all menu buttons */
int set_symbol( symbol , value , table )
char * symbol;
char * value;
int table;
{
dsc$s symnam;
dsc$s symval;
int retcode;

SET_DSC$(symnam,strlen(symbol),symbol);
SET_DSC$(symval,strlen(value),value);

retcode = lib$set_symbol( &symnam, &symval, &table );
return(retcode);
}


  3 Responses to “Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : VMS_ACL.ZIP
Filename : BTN_SET.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/