Exemplo n.º 1
0
/**
*
* _help(debug);
*
* Display help file.
*
**/
PUBLIC void _help(DEBUG *debug, char *topic)
{
    DISPLAY *display = debug->display;
#ifndef BUG
    int  proc_id;
#endif

    dstart(display);
    if (topic == NULL)
    {
        if ((proc_id = vfork()) == 0)
        {
            dup2(fileno(display->filein), 0);
            dup2(fileno(display->fileout), 1);
            dup2(fileno(display->fileout), 2);
            execlp("more", "more", "/helios/etc/debug.hlp", NULL);
            perror("more");
            _exit(1);
        }
#ifndef BUG
        {
            int t_state,terror;
            do
            {
                terror = wait(&t_state);
            }
            until((terror == proc_id) || (terror == -1));

        }
#endif
    }
    else
    {
Exemplo n.º 2
0
//_________________________________________________________________________________________________
void GetTimeRange(Int_t runNumber, time_t& start, time_t& end)
{
  AliCDBManager::Instance()->SetRun(runNumber);

  AliCDBEntry* e = AliCDBManager::Instance()->Get("GRP/GRP/Data");

  AliGRPObject* grp = static_cast<AliGRPObject*>(e->GetObject());

  start = grp->GetTimeStart();
  end = grp->GetTimeEnd();

  TDatime dstart(start);
  TDatime dend(end);

  dstart.Set(dstart.GetYear(),dstart.GetMonth(),dstart.GetDay(),dstart.GetHour(),0,0);
  dend.Set(dend.GetYear(),dend.GetMonth(),dend.GetDay(),dend.GetHour()+1,0,0);
  
  std::cout << TDatime(start).AsString() << std::endl;
  std::cout << TDatime(end).AsString() << std::endl;

  std::cout << dstart.AsString() << std::endl;
  std::cout << dend.AsString() << std::endl;

  start = dstart.Convert(kFALSE);
  end = dend.Convert(kFALSE);
}
Exemplo n.º 3
0
int main ( int argc, char** argv )
{
  int has_continue = 1;

  if( argc < 2 || dstart( argv[1] ) != 0 )
    {
      printf("failed to start.\n");
      return -1;
    }
  
  do
    {
      switch(getchar())
	{
	case 'q':
	  {
	    if( dstop() != 0 )
	      {
		// trap here.
	      }
	    has_continue = 0;
	    break;
	  }
	case 'r':
	  {
	    if( dstop() != 0 )
	      {
		printf("failed to stop.\n");
		return -2;
	      }
	    if( dstart( argv[1] ) != 0 )
	      {
		printf("failed to restart.\n");
		return -3;
	      }
	    break;
	  }
	} 
    } while( has_continue );

}
Exemplo n.º 4
0
/**
*
* _edit(debug, loc):
*
* Invoke an editor.
*
**/
PUBLIC void _edit(DEBUG *debug, LOCATION loc)
{
    DISPLAY *display = debug->display;
    char *editor;
    char lineopt[20];
#ifndef BUG
    int  proc_id;
#endif
    (void)sprintf(lineopt, "-g%d", loc.line);
    if ((editor = getvar(debug->env.Envv, "EDITOR")) == NULL) editor = "emacs";
    /* ACE: The name stored with the source should be the full name, thus
            eliminating the need to fiddle the current directory.
    */

#ifdef OLDCODE
    chdir(debug->env.Objv[0]->Name);
#endif
    /*
    -- crf : 12/08/91 - clean up use of Environment Objv
    */
    chdir(debug->env.Objv[OV_Cdir]->Name);

    dstart(display);
    if ((proc_id = vfork()) == 0)
    {
        dup2(fileno(display->filein), 0);
        dup2(fileno(display->fileout), 1);
        dup2(fileno(display->fileout), 2);
        execlp(editor, editor, lineopt, getsource(loc.module)->name, NULL);
        perror(editor);
        _exit(1);
    }
#ifndef BUG
    {
        int t_state,terror;
        do
        {
            terror = wait(&t_state);
        }
        until((terror == proc_id) || (terror == -1));

    }
#endif
    dend(display, FALSE);

}
Exemplo n.º 5
0
/**
*
* _shell(debug, cmdline);
*
* Execute a shell.
*
**/
PUBLIC void _shell(DEBUG *debug, char *cmdline)
{
    DISPLAY *display = debug->display;
    char *shell;
#ifndef BUG
    int  proc_id;
#endif
    if ((shell = getvar(debug->env.Envv, "SHELL")) == NULL) shell = "shell";

#ifdef OLDCODE
    chdir(debug->env.Objv[0]->Name);
#endif
    /*
    -- crf : 12/08/91 - clean up use of Environment Objv
    */
    chdir(debug->env.Objv[OV_Cdir]->Name);

    dstart(display);
    if ((proc_id = vfork()) == 0)
    {
        dup2(fileno(display->filein), 0);
        dup2(fileno(display->fileout), 1);
        dup2(fileno(display->fileout), 2);
        if (cmdline == NULL) execlp(shell, shell, NULL);
        else execlp(shell, shell, "-fc", cmdline, NULL);
        perror(shell);
        _exit(1);
    }

#ifndef BUG
    {
        int t_state,terror;
        do
        {
            terror = wait(&t_state);
        }
        until((terror == proc_id) || (terror == -1));

    }
#endif
    dend(display, cmdline != NULL);
}
Exemplo n.º 6
0
/**
*
* _make(debug);
*
* Make the program.
*
**/
PUBLIC void _make(DEBUG *debug)
{
    DISPLAY *display = debug->display;
    char cmd[100];

    /* -- crf : 07/08/91 - not used 0
      int  make_status;
    */

#ifndef BUG
    int  proc_id;
#endif

#ifdef OLDCODE
    chdir(debug->env.Objv[0]->Name);
#endif
    /*
    -- crf : 12/08/91 - clean up use of Environment Objv
    */
    chdir(debug->env.Objv[OV_Cdir]->Name);

    dstart(display);
    if ((proc_id = vfork()) == 0)
    {

        dup2(fileno(display->filein), 0);
        dup2(fileno(display->fileout), 1);
        dup2(fileno(display->fileout), 2);
        close(fileno(display->filein));
        close(fileno(display->fileout));
        errno = 0;
        execlp("shell", "shell", "-fc","make", NULL);
        perror("make");
        _exit(errno);
    }

#ifndef BUG
    {
        int t_state,terror;
        do
        {
            terror = wait(&t_state);
        }
        until((terror == proc_id) || (terror == -1));

    }
#endif


    sprintf(cmd, "%s", debug->env.Argv[0]);

#ifdef OLDCODE
    chdir(debug->env.Objv[0]->Name);
#endif
    /*
    -- crf : 12/08/91 - clean up use of Environment Objv
    */
    chdir(debug->env.Objv[OV_Cdir]->Name);

    if ((proc_id = vfork()) == 0)
    {

        close(0);
        close(1);
        close(2);

        sopen(debug->env.Strv[0]);
        sopen(debug->env.Strv[1]);
        sopen(debug->env.Strv[2]);
        close(fileno(display->filein));
        close(fileno(display->fileout));

        execvp(debug->env.Argv[0],debug->env.Argv);
        perror(cmd);
        _exit(1);
    }


    syskillall(debug);
    cmdjmp(debug, TopLevel);
}
Exemplo n.º 7
0
Arquivo: sh.dir.c Projeto: lukem/tcsh
/*
 * dinit - initialize current working directory
 */
void
dinit(Char *hp)
{
    Char *cp, *tcp;
    struct directory *dp;

    /* Don't believe the login shell home, because it may be a symlink */
    tcp = agetcwd();
    if (tcp == NULL) {
	xprintf("%s: %s\n", progname, strerror(errno));
	if (hp && *hp) {
	    char *xcp = short2str(hp);
	    dstart(xcp);
	    if (chdir(xcp) == -1)
		cp = NULL;
	    else
		cp = Strsave(hp);
	}
	else
	    cp = NULL;
	if (cp == NULL) {
	    dstart("/");
	    if (chdir("/") == -1)
		/* I am not even try to print an error message! */
		xexit(1);
	    cp = SAVE("/");
	}
    }
    else {
#ifdef S_IFLNK
	struct stat swd, shp;
	int swd_ok;

	swd_ok = stat(short2str(tcp), &swd) == 0;
	/*
	 * See if $HOME is the working directory we got and use that
	 */
	if (swd_ok && hp && *hp && stat(short2str(hp), &shp) != -1 &&
	    DEV_DEV_COMPARE(swd.st_dev, shp.st_dev)  &&
		swd.st_ino == shp.st_ino)
	    cp = Strsave(hp);
	else {
	    char   *cwd;

	    /*
	     * use PWD if we have it (for subshells)
	     */
	    if (swd_ok && (cwd = getenv("PWD")) != NULL) {
		if (stat(cwd, &shp) != -1 &&
			DEV_DEV_COMPARE(swd.st_dev, shp.st_dev) &&
		        swd.st_ino == shp.st_ino) {
		    tcp = SAVE(cwd);
		    cleanup_push(tcp, xfree);
		}
	    }
	    cleanup_push(tcp, xfree);
	    cp = dcanon(tcp, STRNULL);
	    cleanup_ignore(tcp);
	    cleanup_until(tcp);
	}
#else /* S_IFLNK */
	cleanup_push(tcp, xfree);
	cp = dcanon(tcp, STRNULL);
	cleanup_ignore(tcp);
	cleanup_until(tcp);
#endif /* S_IFLNK */
    }

    dp = xcalloc(sizeof(struct directory), 1);
    dp->di_name = cp;
    dp->di_count = 0;
    dhead.di_next = dhead.di_prev = dp;
    dp->di_next = dp->di_prev = &dhead;
    printd = 0;
    dnewcwd(dp, 0);
    setcopy(STRdirstack, dp->di_name, VAR_READWRITE|VAR_NOGLOB);
}