Esempio n. 1
0
int main(int argc,char *argv[])
{
    if(argc>=2) {    
        iocsh(argv[1]);
        epicsThreadSleep(.2);
    }
    iocsh(NULL);
    return(0);
}
Esempio n. 2
0
int main(int argc, char*argv[]) {
	if (argc >= 2) {
		iocsh(argv[1]);
		epicsThreadSleep(.2);
	}
	iocsh(NULL);
	gROOT->CloseFiles();
	epicsExit(0);
	return 0;
}
Esempio n. 3
0
int main(int argc, char *argv[]) {
  init_legacy();

  if (argc >= 2) {
    iocsh(argv[1]);
    epicsThreadSleep(.2);
  }
  iocsh(NULL);
  epicsExit(0);
  return (0);
}
Esempio n. 4
0
int main(int argc,char *argv[])
{
    iocshRegister(&asinittestFuncDef,asinittestCallFunc);
    if(argc>=2) {
        if (iocsh(argv[1]) < 0)
            return(1);
        epicsThreadSleep(.2);
    }
    iocsh(NULL);
    epicsExit(0);
    return(0);
}
Esempio n. 5
0
int main(int argc,char *argv[])
{
    if(argc!=2) {
        printf("must provide command file\n");
        return(1);
    }
    iocsh(argv[1]);
    epicsThreadSleep(.2);
    iocsh(NULL);
    epicsExit(0);
    return(0);
}
Esempio n. 6
0
int main(int argc,char *argv[])
{
	int i, j;
	extern short DEBUG;
	short daemon;
	char stcmd[256];

	/* Need to catch hang up signal to make sure semaphores are
	   cleaned up properly */
	SetSigShutdownHandler();

	daemon = 0;
	if(argc>=2) {    
		snprintf( stcmd, 255, "%s", argv[1]);
		/* parse command line args for crate and IP */
		j = 0;
		for( i = 2; i < argc; i++) {
		  if( strcmp( argv[i], "-D") == 0) {
		    i++;
		    DEBUG = atoi( argv[i]);
		  } else if( strcmp( argv[i], "-d") == 0) {
		    daemon = 1;
		  }
		}
	}
	else
	{
		printf( "Syntax: hvcontrol <st.cmd> [-c <name>@<hostname>[:<slotlist>]] [-d] [-D <debuglevel>]\n");
		printf( "        where <slotlist> = comma and dash separated list of slots.\n");
		printf( "              -d = run in daemon mode\n");
		printf( "              <debuglevel> = 0 no messages\n");
		printf( "              <debuglevel> = 10 all available messages\n");
	}

	if (strlen(stcmd)>0)	iocsh(stcmd);

	if (daemon)	{
		for(;;)
			epicsThreadSleep(1.0);
	} else {
		iocsh(NULL);
	}
	Shutdown();

	return(0);
}
int main(int argc,char *argv[])
{
	int i, j;
	short daemon;
	char stcmd[256];

	/* Need to catch hang up signal to make sure semaphores are
	   cleaned up properly */
	SetSigShutdownHandler();

	daemon = 0;
	if(argc>=2) {    
		snprintf( stcmd, 255, "%s", argv[1]);
		j = 0;
		for( i = 2; i < argc; i++) {
		  if( strcmp( argv[i], "-D") == 0) {
		    i++;
		    DEBUG = atoi( argv[i]);
		  } else if( strcmp( argv[i], "-d") == 0) {
		    daemon = 1;
		  }
		}
	}
	else
	{
		printf( "Syntax: hvcontrol <st.cmd> [-d] [-D <debuglevel>]\n");
		printf( "              -d = run in daemon mode\n");
		printf( "              <debuglevel> = 0 no messages\n");
		printf( "              <debuglevel> = 10 all available messages\n");
	}

	if (strlen(stcmd)>0)	iocsh(stcmd);

	if (daemon)	{
		for(;;)
			epicsThreadSleep(1.0);
	} else {
		iocsh(NULL);
	}
	Shutdown();
    epicsExit(0);
	return(0);
}
int main(int argc,char *argv[])
{
	int i, j;
	short daemon;
	char stcmd[256];
	short naddr;    
	char straddr[32][255];	/* MAX_BOARDS = 32 */    
	/* Need to catch hangup signal to make sure semaphores are    
	   cleaned up properly */ 

	SetSigShutdownHandler();

	daemon = 0;
	if(argc>=1) {    
		epicsSnprintf( stcmd, 255, "%s", argv[1]);
		/* parse command line args for crate and IP */
		j = 0;
		for( i = 2; i < argc; i++)
		{
			if( strcmp( argv[i], "-c") == 0)
			{
				i++;
				epicsSnprintf( straddr[j], 255, "%s", argv[i]);
				j++;
			}
			else if( strcmp( argv[i], "-D") == 0)
			{
				i++;
				DEBUG = atoi( argv[i]);
			}
			else if( strcmp( argv[i], "-d") == 0)
			{
				daemon = 1;
			}
		}
		naddr = j;
		if( naddr > 0)
			ParseCrateAddr( straddr, naddr);
	}
	else
	{
		printf( "Syntax: hvcontrol <st.cmd> [-d] [-D <debuglevel>]\n");
		printf( "              -d = run in daemon mode\n");
		printf( "              <debuglevel> = 0 no messages\n");
		printf( "              <debuglevel> = 10 all available messages\n");
		printf( "\nor, the old Syntax, which will eventually be deprecated:\n");
		printf( "        hvcontrol <st.cmd> [-c <name>@<hostname>] [-d] [-D <debuglevel>]\n");
	}

	if (strlen(stcmd)>0)	iocsh(stcmd);

	if (daemon)	{
		for(;;)
			epicsThreadSleep(1.0);
	} else {
		iocsh(NULL);
	}
	Shutdown();

	return(0);
}
Esempio n. 9
0
int main(int argc, char *argv[])
{
    char *dbd_file = const_cast<char*>(base_dbd);
    char *macros = NULL;
    char xmacro[PVNAME_STRINGSZ + 4];
    int startIocsh = 1;	/* default = start shell */
    int loadedDb = 0;
    
    arg0 = strrchr(*argv, '/');
    if (!arg0) {
	arg0 = *argv;
    } else {
	++arg0;	/* skip the '/' */
    }
    
    --argc, ++argv;
    
    /* Do this here in case the dbd file not available */
    if (argc>0 && **argv=='-' && (*argv)[1]=='h') {
	usage(EXIT_SUCCESS);
    }
    
    if (argc>1 && **argv=='-' && (*argv)[1]=='D') {
	dbd_file = *++argv;
	argc -= 2;
	++argv;
    }
    
    if (dbLoadDatabase(dbd_file, NULL, NULL)) {
	epicsExit(EXIT_FAILURE);
    }
    
    softIocPVA_registerRecordDeviceDriver(pdbbase);
    registryFunctionAdd("exit", (REGISTRYFUNCTION) exitSubroutine);

    while (argc>1 && **argv == '-') {
	switch ((*argv)[1]) {
	case 'a':
	    if (macros) asSetSubstitutions(macros);
	    asSetFilename(*++argv);
	    --argc;
	    break;
	
	case 'd':
	    if (dbLoadRecords(*++argv, macros)) {
		epicsExit(EXIT_FAILURE);
	    }
	    loadedDb = 1;
	    --argc;
	    break;
	
	case 'h':
	    usage(EXIT_SUCCESS);
	
	case 'm':
	    macros = *++argv;
	    --argc;
	    break;
	
	case 'S':
	    startIocsh = 0;
	    break;
	
	case 's':
	    break;
	
	case 'x':
	    epicsSnprintf(xmacro, sizeof xmacro, "IOC=%s", *++argv);
	    if (dbLoadRecords(exit_db, xmacro)) {
		epicsExit(EXIT_FAILURE);
	    }
	    loadedDb = 1;
	    --argc;
	    break;
	
	default:
	    printf("%s: option '%s' not recognized\n", arg0, *argv);
	    usage(EXIT_FAILURE);
	}
	--argc;
	++argv;
    }
    
    if (argc>0 && **argv=='-') {
	switch((*argv)[1]) {
	case 'a':
	case 'd':
	case 'm':
	case 'x':
	    printf("%s: missing argument to option '%s'\n", arg0, *argv);
	    usage(EXIT_FAILURE);
	
	case 'h':
	    usage(EXIT_SUCCESS);
	
	case 'S':
	    startIocsh = 0;
	    break;
	
	case 's':
	    break;
	
	default:
	    printf("%s: option '%s' not recognized\n", arg0, *argv);
	    usage(EXIT_FAILURE);
	}
	--argc;
	++argv;
    }
    
    if (loadedDb) {
	iocInit();
	epicsThreadSleep(0.2);
    }
    
    /* run user's startup script */
    if (argc>0) {
	if (iocsh(*argv)) epicsExit(EXIT_FAILURE);
	epicsThreadSleep(0.2);
	loadedDb = 1;	/* Give it the benefit of the doubt... */
    }
    
    /* start an interactive shell if it was requested */
    if (startIocsh) {
	iocsh(NULL);
    } else {
	if (loadedDb) {
	    epicsThreadExitMain();
	} else {
	    printf("%s: Nothing to do!\n", arg0);
	    usage(EXIT_FAILURE);
	}
    }
    epicsExit(EXIT_SUCCESS);
    /*Note that the following statement will never be executed*/
    return 0;
}