Exemple #1
0
pwr_tStatus
ini_PlcStart (
    pwr_tUInt32	    plcversion,
    char		    *plcfile,
    pwr_tUInt32	    busid
)
{
    pwr_tUInt32	    sts;
    unsigned int	    flags;
    char		    command[128];
    char		    procname[20];
    $DESCRIPTOR(commanddsc, "");
    $DESCRIPTOR(procnamedsc, "");

    commanddsc.dsc$a_pointer  = command;
    commanddsc.dsc$w_length   = sprintf(command, "run %s", plcfile);
    procnamedsc.dsc$a_pointer = procname;
    procnamedsc.dsc$w_length  = sprintf(procname, "PWR_PLC_%d", busid);

    flags = 1; /* Nowait and Notify */
    sts = lib$spawn(&commanddsc, NULL, NULL, &flags, &procnamedsc);
    if (EVEN(sts)) errh_Error("lib$spawn %s\n%m", command, sts);

    return sts;
}
Exemple #2
0
int DoMessage(int id) {
  int status=0;
  static Message *(*processMessage)(Connection *,Message *) = 0;
  Connection *c=FindConnection(id,0);
  if (processMessage == 0) {
    DESCRIPTOR(MdsIpSrvShr,"MdsIpSrvShr");
    DESCRIPTOR(procmsg,"ProcessMessage");
    status = LibFindImageSymbol(&MdsIpSrvShr,&procmsg,&processMessage);
  }
  if (c && processMessage) {
    Message *msgptr = GetMdsMsg(id,&status);
    Message *ans=0;
    if (status & 1) {
      ans = (*processMessage)(c, msgptr);
      if (ans) {
	status = SendMdsMsg(id, ans, 0);
	free(ans);
      }
    }
    else
      CloseConnection(id);
    if (msgptr)
      free(msgptr);
  }
  return status;
}
void cce_out_open(void)
{
	uint4 status;
	static readonly unsigned char sys_output_name[] = "SYS$OUTPUT";
	$DESCRIPTOR(output_qualifier, "OUTPUT");
	char output_name[255];
	$DESCRIPTOR(output_name_desc, output_name);
	short unsigned outnamlen;

	status = cli$get_value(&output_qualifier, &output_name_desc, &outnamlen);
	if (status != 1)
	{
		outnamlen = SIZEOF(sys_output_name) - 1;
		output_name_desc.dsc$a_pointer = sys_output_name;
	}
	cce_output_fab = malloc(SIZEOF(*cce_output_fab));
	cce_output_rab = malloc(SIZEOF(*cce_output_rab));
	*cce_output_fab  = cc$rms_fab;
	*cce_output_rab  = cc$rms_rab;
	cce_output_rab->rab$l_fab = cce_output_fab;
	cce_output_rab->rab$w_usz = 255;
	cce_output_fab->fab$w_mrs = 255;
	cce_output_fab->fab$b_fac = FAB$M_GET | FAB$M_PUT;
	cce_output_fab->fab$b_rat = FAB$M_CR;
	cce_output_fab->fab$l_fna = output_name_desc.dsc$a_pointer;
	cce_output_fab->fab$b_fns = outnamlen;
	status = sys$create(cce_output_fab, 0, 0);
	if ((status & 1) == 0)
		lib$signal(status);
	status = sys$connect(cce_output_rab, 0, 0);
	if ((status & 1) == 0)
		lib$signal(status);
}
Exemple #4
0
pwr_tStatus
proc_Start (
  proc_sProcess *p
)
{
  pwr_tStatus sts;
  char *fmt;
  char nameb[40];
  char buf[512];
  int flags;
  $DESCRIPTOR(com,"");
  $DESCRIPTOR(name,"");

  cdh_ToUpper(nameb, p->name);
  name.dsc$w_length = strlen(nameb);
  name.dsc$a_pointer = nameb;

  if (p->flags.b.user)
    fmt = "@pwr_exe:pwrp_run %s \"%s\" %d %d \"%s\"";
  else
    fmt = "@pwr_exe:pwr_run %s \"%s\" %d %d \"%s\"";

  com.dsc$w_length = sprintf(buf, fmt, p->file, p->name, p->flags.b.debug, p->p_prio, p->arg);
  com.dsc$a_pointer = buf;
  flags = 1; /* Nowait */
  sts = lib$spawn(&com, NULL, NULL, &flags, &name, &p->pid);

  return sts;
}
Exemple #5
0
main()
{
    int i,fd;
    $DESCRIPTOR(gsdnam1,"gsd3");
    $DESCRIPTOR(gsdnam2,"gsd4");
    struct _va_range range1, range2;
    struct _secid id1, id2;
    range1.va_range$ps_start_va=0x10000000;
    range1.va_range$ps_end_va=0x10008000;
    range2.va_range$ps_start_va=0x20020000;
    range2.va_range$ps_end_va=0x20030000;
    id1.secid$l_version=0;
    id2.secid$l_version=0;
    fd=open("/file",O_RDONLY);

    sys$create_region_32(0x8000,0,0,0,0,0,range1.va_range$ps_start_va);
    sys$create_region_32(0x10000,0,0,0,0,0,range2.va_range$ps_start_va);

    sys$crmpsc(&range1,0,0,SEC$M_GBL,&gsdnam1,&id1,0,fd,2,0,0,0);
    sys$crmpsc(&range2,0,0,SEC$M_GBL,&gsdnam2,&id2,0,fd,2,1,0,0);

    for(i=0; i<4; i++)
    {
        volatile unsigned long * l1=range1.va_range$ps_start_va+0x2000;
        volatile unsigned long * l2=range2.va_range$ps_start_va+0x1000;
        (*l1)++;
        printf("%x %x\n",getpid(),*l1);
        sleep(2);
        (*l2)++;
        printf("%x %x\n",getpid(),*l2);
        sleep(2);
    }
    close(fd);
}
void	la_getdat(uint4 kid, int4 code, date *date_ptr, uint4 lo, uint4 hi)
/* kid - virt. keyb. ID		*/
/* code - promt msg code	*/
/* date_ptr - date/time returned	*/
/* lo - min value of date	*/
/* hi - max value of date	*/
{
	int		status;
	bool		valid;
	char		pro[64], res[64];
	unsigned short	length;			/* res. string length	*/
	int4		mlen = 32;		/* max length of result */
	int		smg$read_string(), sys$getmsg();
	int		sys$asctim();
	$DESCRIPTOR(dini, res);			/* initial string	*/
	$DESCRIPTOR(dres, res);			/* resuting string	*/
	$DESCRIPTOR(dprm, pro);			/* prompt string	*/
	error_def(LA_INVAL);

	dprm.dsc$w_length = 64;
	status = sys$getmsg(code, &length, &dprm, 1, 0);
	if (SS$_NORMAL != status)
		lib$signal(status);
	dprm.dsc$w_length = length;
	dres.dsc$w_length = 12;
	if (0 == (*date_ptr)[1])
	{	/* no initial date */
		res[0] = 0;
		length = 0;
	} else
	{
		status = sys$asctim(&length, &dres, date_ptr, 0);
		if (SS$_NORMAL != status)
			lib$signal(status);
	}
	dres.dsc$w_length = 64;
	valid = FALSE;
	while ((SS$_NORMAL != status) || !valid)
	{
		res[length] = ' ';
		dini.dsc$w_length = length;
		status = smg$read_string(&kid, &dres, &dprm, &mlen, 0, 0, 0, &length, 0, 0, &dini);
		if (SS$_NORMAL != status)
			lib$signal(status);
		else  if (0 == length)
		{	/* no datstatus/time */
			(*date_ptr)[0] = (*date_ptr)[1] = lo = 0;
			hi = 1;
		} else  if (0 != length)
		{	/* date/time entered */
			status = lib$convert_date_string(&dres, date_ptr);
			if (SS$_NORMAL != status)
				la_putmsgs(status);
		}
		valid = ((*date_ptr)[1] >= lo || (*date_ptr)[1] < hi);
		if (!valid)
			la_putmsgu(LA_INVAL, 0, 0);
	}
}
Exemple #7
0
static int varg_set_symbol(char *symbol, char *value)
{
        $DESCRIPTOR(symbol_desc, "");
        $DESCRIPTOR(value_desc, "");
        int status;

        symbol_desc.dsc$w_length = strlen(symbol);
        symbol_desc.dsc$a_pointer = symbol;
        value_desc.dsc$w_length = strlen(value);
        value_desc.dsc$a_pointer = value;
        status = lib$set_symbol(&symbol_desc, &value_desc);
        return status;
}
Exemple #8
0
	/*****************************************************************
	 * MdsGetMsg:
	 *****************************************************************/
char  *MdsGetMsg(	/* Return: addr of "status" string	*/
    int   sts			/* <r> sts value			*/
   )
   {
     STATIC_CONSTANT DESCRIPTOR(msg_files,"MDSMSG_PATH:*Msg.*");
     STATIC_CONSTANT DESCRIPTOR(getmsg_nam,"getmsg");
     struct descriptor_d filnam = {0, DTYPE_T, CLASS_D, 0};
     int   i;
     char  *facnam, *msgnam, *msgtext;
     int status = 0;
     void *ctx = 0;
     const STATIC_CONSTANT char *severity[] = {"W","S","E","I","F","?","?","?"};
     int (*getmsg)(int,char **,char **,char **);
     int   max;
     struct stsText  *stsText;

     if (sts == 1)
     {
       strcpy((MdsShrGetThreadStatic())->MdsGetMsg_text,"%SS-S-SUCCESS, Success");
       return (MdsShrGetThreadStatic())->MdsGetMsg_text;
     }
     max = getFacility(sts,&facnam,&stsText);
     if (max > 0)
     {
       for (i=0 ; i<max ; i++)
       {
         if ((sts & 0xfffffff8) == (stsText[i].stsL_num & 0xfffffff8))
         {
           sprintf((MdsShrGetThreadStatic())->MdsGetMsg_text,"%%%s-%s-%s, %s",facnam,severity[sts&0x7],stsText[i].stsA_name,stsText[i].stsA_text);
           break;
         }
       }
       if (i == max)
         sprintf((MdsShrGetThreadStatic())->MdsGetMsg_text,"%%%s-%s-NOMSG, Message number 0x%08x",facnam,severity[sts&0x7],sts);
       status = 1;
     }
     while (!(status & 1) && (LibFindFile(&msg_files,&filnam,&ctx)&1))
     {
       status = LibFindImageSymbol(&filnam,&getmsg_nam,&getmsg);
       if (status & 1)
       {
         status = (*getmsg)(sts,&facnam,&msgnam,&msgtext);
         if (status & 1)
           sprintf((MdsShrGetThreadStatic())->MdsGetMsg_text,"%%%s-%s-%s, %s",facnam,severity[sts&0x7],msgnam,msgtext);
       }
     }
     LibFindFileEnd(&ctx);
     if (!(status & 1))
       sprintf((MdsShrGetThreadStatic())->MdsGetMsg_text,"%%NONAME-%s-NOMSG, Message number 0x%08X",severity[sts&0x7],sts);
     return (MdsShrGetThreadStatic())->MdsGetMsg_text;
   }
Exemple #9
0
struct direct  *
readdir(int context)
{
	int		i;
	char		cresult[100];
	char		*pnt;
	int		status;

	$DESCRIPTOR(dpath, searchpath[context]);
	$DESCRIPTOR(result, cresult);

	if (dircontext[context] == -1) {
		dircontext[context] = -2;
		strcpy(d_entry[context].d_name, ".");
		return (&d_entry[context]);
	};

	if (dircontext[context] == -2) {
		dircontext[context] = -3;
		strcpy(d_entry[context].d_name, "..");
		return (&d_entry[context]);
	};

	if (dircontext[context] == -3)
		dircontext[context] = 0;

	dpath.dsc$w_length = strlen(searchpath[context]);
	lib$find_file(&dpath, &result, &dircontext[context],
		0, 0, &status, 0);

	if (status == SS$_NOMOREFILES)
		return (0);

	/* Now trim trailing spaces from the name */
	i = result.dsc$w_length - 1;
	while (i && cresult[i] == ' ')
		i--;
	cresult[i + 1] = 0;

	/* Now locate the actual portion of the file we want */

	pnt = (char *) strrchr(cresult, ']');
	if (pnt)
		pnt++;
	else
		pnt = cresult;

	strcpy(d_entry[context].d_name, pnt);
	return (&d_entry[context]);
}
Exemple #10
0
        /* Get next line */
        cip = 0;
#if 1
        if (smg$enable)
        {
            SMG$ERASE_LINE(&disp2_id, &i1, &i1);
            SMG$SET_CURSOR_ABS(&disp2_id,&i1,&i1);
            status = SMG$READ_COMPOSED_LINE(&keyb_id,&key_tab,&input_line,
                                            &prompt,&out_len,&disp2_id,0,0,0,0,0); /*Get next command */
            cip = 1;
        }
        else
            status = SMG$READ_COMPOSED_LINE(&keyb_id,0,&input_line,
                                            &prompt,&out_len,0,0,0,0,0,0); /*Get next command */
#else
        printf("%s",prompt.dsc$a_pointer);
        out_len = read(0,command_line,254);
        out_len--;
        command_line[out_len]=0;
        if (strncmp(command_line,"exit",4)==0)
            return 0;
#endif
    }
}  /* END of MAIN */
int help_command(int mask)
/*	HELP

	Purpose : call on-line help
	Output  : contents of DFUHLP helplib.
*/
{
    unsigned int x,flag=1,tmp=0;
#if 0
    static char help[80];
    $DESCRIPTOR(help_key ,help);
    $DESCRIPTOR(help_item, "helpkey");
    $DESCRIPTOR(help_lib,"dfuhlp");
    $DESCRIPTOR(item,"DFU ");
    $DESCRIPTOR(hlp_txt,"< DFU Help Screen >");

    /* Check if a help item was entered */
    if (cli$present(&help_item) == CLI$_PRESENT)
        cli$get_value(&help_item,&help_key,&help_key);
    else
        help_key.dsc$w_length=0;

    /* Add 'DFU ' to the help key */
    help_key.dsc$w_length +=4;
    str$concat(&help_key,&item,&help_key);
    x = rows - 4;
    /* Reenable line editing... */
    status = SYS$QIOW(0,tchan, IO$_SETMODE,0,0,0,&orgttchar,12,0,0,0,0);
    if (smg$enable)
    {
        SMG$CREATE_VIRTUAL_DISPLAY(&x, &colls, &help_id, 0 , 0, 0);
        SMG$LABEL_BORDER(&help_id, &hlp_txt, 0, 0,&SMG$M_BOLD);
        SMG$PASTE_VIRTUAL_DISPLAY(&help_id, &paste_id, &i2,&i2,0);
        status = SMG$PUT_HELP_TEXT(&help_id, &keyb_id, &help_key, &help_lib,0,0);
        SMG$UNPASTE_VIRTUAL_DISPLAY(&help_id, &paste_id);
        SMG$DELETE_VIRTUAL_DISPLAY(&help_id);
    }
    else
        status = lbr$output_help(lib$put_output,0,&help_key,
                                 &help_lib,&flag,lib$get_input);
    if (status != SS$_NORMAL)
    {
        sprintf(outbuf,"%%DFU-E-HELPERR, Error opening help library,");
        put_disp();
        singlemsg(0,status);
    }
#endif
    return(1);
} /*END help_command */
Exemple #11
0
static int varg_do_help(char *help_library, char *help_command)
{
        $DESCRIPTOR(lib_desc, "");
        $DESCRIPTOR(command_desc, "");
        int status;

        lib_desc.dsc$w_length = strlen(help_library);
        lib_desc.dsc$a_pointer = help_library;
        command_desc.dsc$w_length = strlen(help_command);
        command_desc.dsc$a_pointer = help_command;

        status = lbr$output_help(&lib$put_output, 0, &command_desc, &lib_desc, 0,
                                 &lib$get_input);
        return status;
}
Exemple #12
0
int spawn_command(int mask)
{
#if 0
    /* Saves the screen and spawns a subprocess */

    int save_id;
    $DESCRIPTOR(prompt,"DFU_sub$ ");

    if (smg$enable)
    {
        SMG$SAVE_PHYSICAL_SCREEN(&paste_id, &save_id);
        SMG$DISABLE_BROADCAST_TRAPPING(&paste_id);
    }
    printf("%%DFU-I-SPAWN, Creating subprocess...\n");
    status = lib$spawn(0,0,0,0,0,0,0,0,0,0,&prompt,0,0);
    /* Next call is a workaround for a bug in TTdriver which may inadvertently
       reset the terminal width */
    if (colls > 80) printf("\x1b[?3h");
    else printf("\x1b[?3l");
    if (smg$enable)
    {
        SMG$RESTORE_PHYSICAL_SCREEN(&paste_id, &save_id);
        SMG$SET_BROADCAST_TRAPPING(&paste_id,brdcst_ast,0);
    }
    if ((status & 1) !=1) singlemsg(0,status);
#endif
    return (1);
}
Exemple #13
0
bool	lke_showlock(
		     struct CLB		*lnk,
		     mlk_shrblk_ptr_t	tree,
		     mstr		*name,
		     bool		all,
		     bool		wait,
		     bool		interactive,
		     int4 		pid,
		     mstr		one_lock)
{
	mlk_prcblk	pblk;
	mlk_prcblk_ptr_t r;
	mlk_shrsub_ptr_t value;
	short		len1;
	int4		len2;
	bool		lock = FALSE, owned;
	int4		f[7], gtcmbufidx, item, ret;
	uint4		status;
	char		*msg, format[64], gtcmbuf[64];	/* gtcmbuf[] is to hold ": CLNTNODE = %s : CLNTPID = %s" */
	VMS_ONLY(
		char		sysinfo[NDIM];
		$DESCRIPTOR	(sysinfo_dsc, sysinfo);
	)

	/* ~~~ the following is to exclude any quotes if present ~~~~~	*/
	if ((NULL != one_lock.addr) && ('"' == *(unsigned char *)(one_lock.addr)))
Exemple #14
0
static char *
trnlog (const char *name)
{
  int stat;
  static char reslt[1024];
  $DESCRIPTOR (reslt_dsc, reslt);
  short resltlen;
  struct dsc$descriptor_s name_dsc;
  char *s;

  /*
   * the string isn't changed, but there is no string descriptor with
   * "const char *dsc$a_pointer"
   */
  INIT_DSC_CSTRING (name_dsc, (char *)name);

  stat = lib$sys_trnlog (&name_dsc, &resltlen, &reslt_dsc);

  if ((stat&1) == 0)
    {
      return "";
    }
  if (stat == SS$_NOTRAN)
    {
      return "";
    }
  reslt[resltlen] = '\0';

  s = xmalloc (resltlen+1);
  strcpy (s, reslt);
  return s;
}
Exemple #15
0
int er_vmsinit(long dev)
{
    //struct _ucb * u=makeucbetc(&ddb,&ddt,&dpt,&fdt,"hda","hddriver");

    unsigned short chan0, chan1, chan2;
    $DESCRIPTOR(u0,"era0");
    mydevice="era0";
    unsigned long idb=0,orb=0;
    struct _ccb * ccb;
    struct _ucb * newucb0,*newucb1,*newucb2;
    struct _ddb * ddb;

    printk(KERN_INFO "dev here pre\n");

    ddb=er_iodb_vmsinit(dev);

    /* for the fdt init part */
    /* a lot of these? */

    er_iodbunit_vmsinit(ddb,0,&u0);

    printk(KERN_INFO "dev here\n");

    // return chan0;

}
Exemple #16
0
int ft_vmsinit(void)
{
    //struct _ucb * u=makeucbetc(&ddb,&ddt,&dpt,&fdt,"hda","hddriver");

    unsigned short chan0, chan1, chan2;
    $DESCRIPTOR(dsc,"opa0");
    unsigned long idb=0,orb=0;
    struct _ccb * ccb;
    struct _ucb * newucb0,*newucb1,*newucb2;
    struct _ddb * ddb;

    printk(KERN_INFO "dev con here pre\n");

    ddb=ft_iodb_vmsinit();

    /* for the fdt init part */
    /* a lot of these? */

    ft_iodbunit_vmsinit(ddb,1,&dsc);

    printk(KERN_INFO "dev con here\n");

    // return chan0;

}
void mu_signal_process(char *command, int signal)
{
	boolean_t	pid_present, name_present;
	int4		pid, length, status, item, outv;
	char		prc_nam[20];
	unsigned short	name_len;
	$DESCRIPTOR(d_prc_nam,"");

	memset(prc_nam, 0, SIZEOF(prc_nam));
	pid_present = name_present = FALSE;
	if (cli_present("id") == CLI_PRESENT)
	{
		if(!cli_get_hex("id", &pid))
			return;
		pid_present = TRUE;
	}
	if (cli_present("name") == CLI_PRESENT)
	{
		name_len = 20;
		if (!cli_get_str("name", prc_nam, &name_len))
			return;
		if (prc_nam[name_len-1] == '"')
			name_len--;
		if (prc_nam[0] == '"')
		{
			d_prc_nam.dsc$a_pointer = &prc_nam[1];
			name_len--;
		} else
			d_prc_nam.dsc$a_pointer = &prc_nam;
		d_prc_nam.dsc$w_length = name_len;
		name_present = TRUE;
	}
	if (!name_present)
	{
		if (SS$_NORMAL == send_signal(pid, signal))
			SENDMSG_OUTPUT("", pid);
		return;
	}
	item = JPI$_PID;
	status = lib$getjpi(&item, 0, &d_prc_nam, &outv, 0, 0);
	if (SS$_NORMAL != status)
	{
		rts_error(VARLSTCNT(1) status);
		return;
	}
	if (!pid_present)
	{
		if (SS$_NORMAL == send_signal(outv, signal))
			SENDMSG_OUTPUT(&prc_nam, outv);
		return;
	}
	if (outv != pid)
	{
		util_out_print("ID !XL and NAME !AD are not the same process", FLUSH, pid, LEN_AND_STR(&prc_nam));
		return;
	}
	if (SS$_NORMAL == send_signal(pid, signal))
		SENDMSG_OUTPUT(&prc_nam, pid);
	return;
}
Exemple #18
0
main(){
struct _iosb myiosb;
int status;
unsigned short int chan;
char mybuf[512];
int efn=0;
$DESCRIPTOR(null,"NLA0");

status=sys$assign(&null,&chan,0,0,0);

printf("status %x chan %x \n", status,chan);

printf("before qio %x\n",time(0));
status=sys$qio(0,chan,IO$_READVBLK,0,myast,0,mybuf,512,0,0,0,0);
printf("after qio %x\n",time(0));

sleep(2);
sleep(2);
sleep(2);
sleep(2);

printf("status %x done %x \n", status,done);

printf("before qiow %x\n",time(0));
status=sys$qiow(efn,chan,IO$_READVBLK,0,myast,0,mybuf,512,0,0,0,0);
printf("after qiow %x\n",time(0));

printf("status %x done %x \n", status,done);

}
Exemple #19
0
static char *
trnlog (const char *name)
{
  int stat;
  static char reslt[1024];
  $DESCRIPTOR (reslt_dsc, reslt);
  short resltlen;
  struct dsc$descriptor_s name_dsc;
  char *s;

  INIT_DSC_CSTRING (name_dsc, name);

  stat = lib$sys_trnlog (&name_dsc, &resltlen, &reslt_dsc);

  if ((stat&1) == 0)
    {
      return "";
    }
  if (stat == SS$_NOTRAN)
    {
      return "";
    }
  reslt[resltlen] = '\0';

  s = malloc (resltlen+1);
  if (s == 0)
    return "";
  strcpy (s, reslt);
  return s;
}
Exemple #20
0
int show_device()
{
    printf("\n");
    printf("I/O data structures\n");
    printf("-------------------\n");
    printf("                                DDB list\n");
    printf("                                --------\n");
    printf("\n");
    printf("  Address     Controller     ACP                Driver                DPT\n");
    printf("  --------    ----------    ------    --------------------------    --------\n");
    printf("\n");

    int retlen;
    $DESCRIPTOR(p, "p1");
    char c[80];
    struct dsc$descriptor o;
    o.dsc$a_pointer=c;
    o.dsc$w_length=80;
    memset (c, 0, 80);
    int sts = cli$present(&p);
    if (sts&1)
    {
        sts = cli$get_value(&p, &o, &retlen);
        o.dsc$w_length=retlen;
    }
    extern void * ioc$gl_devlist;
    struct _ddb ddb, * kddb;
    sts = sda$getmem(&ioc$gl_devlist, &kddb, 0);
    for (; kddb; kddb=ddb.ddb$ps_link)
    {
        sts = sda$getmem(kddb, &ddb, sizeof (struct _ddb));
        printf("  %8x    %10s        %26s       %8x\n",kddb,&ddb.ddb$t_name[1],"",ddb.ddb$ps_dpt);
    }
    return sts;
}
Exemple #21
0
/* #include iosbdef */
char *getpass_r(const char *prompt, char *buffer, size_t buflen)
{
  long sts;
  short chan;

  /* MSK, 23-JAN-2004, iosbdef.h wasn't in VAX V7.2 or CC 6.4  */
  /* distribution so I created this.  May revert back later to */
  /* struct _iosb iosb;                                        */
  struct _iosb
     {
     short int iosb$w_status; /* status     */
     short int iosb$w_bcnt;   /* byte count */
     int       unused;        /* unused     */
     } iosb;

  $DESCRIPTOR(ttdesc, "TT");

  buffer[0]='\0';
  sts = sys$assign(&ttdesc, &chan,0,0);
  if (sts & 1) {
    sts = sys$qiow(0, chan,
                   IO$_READPROMPT | IO$M_NOECHO,
                   &iosb, 0, 0, buffer, buflen, 0, 0,
                   prompt, strlen(prompt));

    if((sts & 1) && (iosb.iosb$w_status&1))
      buffer[iosb.iosb$w_bcnt] = '\0';

    sts = sys$dassgn(chan);
  }
  return buffer; /* we always return success */
}
short	la_getstr(uint4 kid, int4 code, char *res, int lo, int hi)
/* kid - virt. keyb. ID		*/
/* code - prompt message code	*/
/* res - result returned	*/
/* lo - min length of result	*/
/* hi - max length of result	*/
{
	boolean_t	valid;
	char		buf[4 * ADDR], pro[80];
	char		*ini = NULL;
	unsigned short  w_short;		/* res. string length   */
	int 		cnt;
	int4		status;
	int4		smg$read_string(), sys$getmsg();
	$DESCRIPTOR	(dini, ini);		/* initial string 	*/
	$DESCRIPTOR	(dbuf, buf);		/* resuting string 	*/
	$DESCRIPTOR	(dpro, pro);		/* prompt string	*/
	error_def	(LA_INVAL);

	dpro.dsc$w_length = 80;
	status = sys$getmsg(code, &w_short, &dpro, 1, 0);
	if (SS$_NORMAL != status)
		lib$signal(status);
	dpro.dsc$w_length = w_short;
	for (w_short = 0;  !w_short || ((0 != res[w_short]) && (hi > w_short));  w_short++)
		buf[w_short] = res[w_short];
	dini.dsc$a_pointer = buf;
	dbuf.dsc$w_length = hi;
	valid = FALSE;
	while ((SS$_NORMAL != status) || !valid)
	{
		buf[w_short] = ' ';
		dini.dsc$w_length = w_short;
		status = smg$read_string(&kid, &dbuf, &dpro, &hi, 0, 0, 0, &w_short, 0, 0, &dini);
		if (SS$_NORMAL != status)
			lib$stop(status);
		valid = ((w_short >= lo) && (w_short < hi)) || ((1 == w_short) && (1 == hi));
		if (!valid)
		{
			w_short = MIN(w_short, hi - 1);
 			la_putmsgu(LA_INVAL, 0, 0);
		}
	}
	for (cnt = 0;  cnt < hi;  cnt++)
		res[cnt] = (cnt < w_short) ? buf[cnt] : 0;
	return w_short;
}
Exemple #23
0
int CloseConnection(int id) {
  int status=0;
  static int (*removeConnection)(int) = 0;
  Connection *c=FindConnection(id,0);
  if (c) {
    if (removeConnection == 0) {
      DESCRIPTOR(MdsIpSrvShr,"MdsIpSrvShr");
      DESCRIPTOR(rmcon,"RemoveConnection");
      status = LibFindImageSymbol(&MdsIpSrvShr,&rmcon,&removeConnection);
    } else
      status=1;
    if (status & 1) {
      status = (*removeConnection)(id);
    }
  }
  return status;
}
Exemple #24
0
init_interrupts()
{
  $DESCRIPTOR(tt_desc, "TT");
  int i;
  i = sys$assign (&tt_desc, &tt_chan, 0, 0);
  if (i != SS$_NORMAL) stop (i);
  set_ctrl_c_ast();
  interrupt = FALSE;
}
int PARAGON_FTP_COPY(char *report_in, struct descriptor *report_out, int *isftp)
{
  struct descriptor report = {0, DTYPE_T, CLASS_S, 0};
  DESCRIPTOR(ftp_it,"PARAGON_FTP_COPY($)");
  report.length = strlen(report_in);
  report.pointer = report_in;
  *isftp = 1;
  return TdiExecute(&ftp_it,&report,report_out MDS_END_ARG);
}
Exemple #26
0
static void DoSrvAction(SrvJob *job_in)
{
  int status;
  SrvActionJob *job = (SrvActionJob *)job_in;
  status = TreeOpen(job->tree,job->shot,0);
  if (status & 1)
  {
    int retstatus;
    char *job_text;
    DESCRIPTOR_NID(nid_dsc,0);
    DESCRIPTOR_LONG(ans_dsc,0);
    struct descriptor fullpath = {0, DTYPE_T, CLASS_D, 0};
    DESCRIPTOR(fullpath_d,"FULLPATH");
    DESCRIPTOR(nullstr,"\0");
    DESCRIPTOR_NID(niddsc,0);
    struct descriptor ans_d = {0, DTYPE_T, CLASS_S, 0};
    niddsc.pointer = (char *)&job->nid;
	doingNid = job->nid;
    status = TdiGetNci(&niddsc,&fullpath_d,&fullpath MDS_END_ARG);
    StrAppend(&fullpath,&nullstr);
    job_text = malloc(fullpath.length + 1024);
    sprintf(job_text,"Doing %s in %s shot %d",fullpath.pointer,job->tree,job->shot);
    current_job_text = job_text;
    StrFree1Dx(&fullpath);
    nid_dsc.pointer = (char *)&job->nid;
    ans_dsc.pointer = (char *)&retstatus; 
    TreeSetDefaultNid(0);
    if (Logging)
      {
	  printf("%s, %s\n",Now(),current_job_text);
	  fflush(stdout);
      }
    status = TdiDoTask(&nid_dsc,&ans_dsc MDS_END_ARG);
    if (Logging)
      {
	memcpy(current_job_text,"Done ",5);
	printf("%s, %s\n",Now(),current_job_text);
	fflush(stdout);
      }
    if (status & 1)
      status = retstatus;
  }
  SendReply(job_in,SrvJobFINISHED,status,0,0);
}
Exemple #27
0
/*
**++
**  ROUTINE:	main
**
**  FUNCTIONAL DESCRIPTION:
**
**  	Main program.  Fetches the command from the command line,
**  uses CLI$ routines to parse it, then starts the build process.
**
**  RETURNS:	cond_value, longword (unsigned), write only, by value
**
**  PROTOTYPE:
**
**  	main
**
**  IMPLICIT INPUTS:	See global definitions at module head.
**
**  IMPLICIT OUTPUTS:	See global definitions at module head.
**
**  COMPLETION CODES:
**
**  	SS$_NORMAL, MMK__ALLOK : normal successful completion.
**
**  SIDE EFFECTS:   	None.
**
**--
*/
unsigned int main (void) {

    DESCRIP cmdstr;
    char Output_File[256], tmp[256];
    $DESCRIPTOR(cmdname, "MMKC ");
    unsigned int status;
    int i;

/*
** Initialize the globals
*/
    temporary_symbols = 0;
    for (i = 0; i < MMK_K_SYMTABLE_SIZE; i++) {
    	INIT_QUEUE(global_symbols.symlist[i]);
    	INIT_QUEUE(local_symbols.symlist[i]);
    	INIT_QUEUE(cmdline_symbols.symlist[i]);
    	INIT_QUEUE(builtin_symbols.symlist[i]);
    }
    INIT_QUEUE(rules);
    INIT_QUEUE(dependencies);
    INIT_QUEUE(dep_internal);
    INIT_QUEUE(dep_deferred);
    INIT_QUEUE(suffixes);
    INIT_QUEUE(do_first);
    INIT_QUEUE(do_last);
    exit_status = SS$_NORMAL;
    ignore = override_silent = override_ignore = symbol_override = 0;
    skip_intermediates = 0;

/*
** Fetch and parse command string
*/
    INIT_DYNDESC(cmdstr);
    status = lib$get_foreign(&cmdstr);
    str$prefix(&cmdstr, &cmdname);
    status = cli$dcl_parse(&cmdstr, MMK_COMPILE_RULES_CLD,
    	    	lib$get_input, lib$get_input);
    if (!OK(status)) return (status | STS$M_INHIB_MSG);

/*
** Get the command parameters and qualifiers
*/
    Output_File[0] = '\0';
    if (cli_present("OUTPUT") == CLI$_PRESENT) {
    	cli_get_value("OUTPUT", Output_File, sizeof(Output_File));
    }

    status = cli_get_value("RULES_FILE", tmp, sizeof(tmp));
    if (!OK(status)) return status | STS$M_INHIB_MSG;

    Read_Description(tmp, "SYS$DISK:[].MMS", 1);
    if (OK(exit_status)) Generate_Structures(tmp, Output_File);

    return exit_status | STS$M_INHIB_MSG;

}
Exemple #28
0
static int varg_do_command(char *command)
{
        $DESCRIPTOR(command_desc, "");
        int status;

        command_desc.dsc$w_length = strlen(command);
        command_desc.dsc$a_pointer = command;
        status = lib$do_command(&command_desc);
        return status;
}
Exemple #29
0
int4 cvttime(mval *src, int4 tim[2])
{
	$DESCRIPTOR	(dsrc,src->str.addr) ;
	int4            cnx= 0, fl= 127;
	int4		status;

	dsrc.dsc$w_length= src->str.len ;
	status= lib$convert_date_string(&dsrc,tim,&cnx,&fl,0,0) ;
	return status;
}
Exemple #30
0
void put_disp(void)
{
    $DESCRIPTOR(to_disp, outbuf);

    if (smg$enable)
    {
        to_disp.dsc$w_length = strlen(outbuf);
        SMG$PUT_LINE(&disp1_id, &to_disp,0,0,0,&SMG$M_WRAP_CHAR,0);
    }
    else printf("%s\n",outbuf);
}