Пример #1
0
static int tool_exec( tool_type utl, char *p1, char *p2 )
/*******************************************************/
{
    int     rc;

    FindToolPath( utl );
    if( !Flags.be_quiet ) {
        if( p2 == NULL ) {
            PrintMsg( "\t%s %s\n", tools[utl].name, p1 );
        } else {
            PrintMsg( "\t%s %s %s\n", tools[utl].name, p1, p2 );
        }
    }
    fflush( NULL );
    if( p2 == NULL ) {
        rc = spawnlp( P_WAIT, tools[utl].path, tools[utl].name, p1, NULL );
    } else {
        rc = spawnlp( P_WAIT, tools[utl].path, tools[utl].name, p1, p2, NULL );
    }
    if( rc != 0 ) {
        if( (rc == -1) || (rc == 255) ) {
            PrintMsg( WclMsgs[UNABLE_TO_INVOKE_EXE], tools[utl].path );
        } else {
            if( utl == TYPE_LINK ) {
                PrintMsg( WclMsgs[LINKER_RETURNED_A_BAD_STATUS] );
            } else if( utl == TYPE_PACK ) {
                PrintMsg( WclMsgs[CVPACK_RETURNED_A_BAD_STATUS] );
            } else {
                PrintMsg( WclMsgs[COMPILER_RETURNED_A_BAD_STATUS], p1 );
            }
        }
    }
    return( rc );
}
Пример #2
0
/** Main function. */
int main( ) {
	char ch;
	int run = 1;

	clrscr( );

	dispmenu( );

	/* Loop for keyboard input. */
	do {
		/* Get keyboard input character. */
		ch = getch( );

		gotoxy( 24, 17 );

		switch ( ch ) {
		case '1':
			if ( spawnlp( P_WAIT, "RWMAIN.COM", "RWMAIN.COM", NULL ) == -1 ) {
				puts( "Cannot find file : RWMAIN.COM" );
				getch( );
			}
			clrscr( );
			dispmenu( );
			break;
		case '2':
			if ( spawnlp( P_WAIT, "NLQ.EXE", "NLQ.EXE", NULL ) == -1 ) {
				puts( "  Cannot find file : NLQ.EXE " );
				getch( );
			}
			clrscr( );
			dispmenu( );
			break;
		case '3':
			puts( "        Not implemented.     " );
			getch( );
			clrscr( );
			dispmenu( );
			break;
		case '4':
		case 27:								/* escape key */
			run = 0;
			break;
		default:
			puts( "  Please select number 1-4   " );
		}

		gotoxy( 20, 19 );

	} while ( run );

	exit( 0 );
}
Пример #3
0
int EDITAPI EDITFile( char *fn, char *hlib )
/***************************************************/
{
    CurrSession = FindSession( fn );
    if( CurrSession == NULL ) {
        if( StartingSessionInProgress ) {
            return( FALSE );
        }
        StartingSessionInProgress = TRUE;
        // new session must be created before we start the editor so
        // that we can process the WM_DDE_INITIATE message properly
        CurrSession = NewSession( fn, hlib );
        if( CurrSession == NULL ) {
            return( FALSE );
        }
        LinkSession( CurrSession );
        if( spawnlp( P_NOWAIT, _Editor, _Editor, "/W", fn, NULL ) == -1 ) {
            DeleteSession( NULLHANDLE );
            CurrSession = NULL;
            return( FALSE );
        }
    }
    WinSetFocus( HWND_DESKTOP, CurrSession->hwnd );
    return( TRUE );
}
int KHelpNdxFile::Invoke() const
{
    return spawnlp( P_NOWAIT, _khneFound.strViewer.c_str(),
                              _khneFound.strViewer.c_str(),
                              _khneFound.strBook.c_str(),
                              _khneFound.strTopic.c_str(), 0 );
}
Пример #5
0
main(int argc,char *argv[])
  {
  if (argc<2)
     {
     puts("Tento program vyzaduje jmeno souboru, ve kterem se naleza\n"
          "script pro popis dialogu pro hru BRANY SKELDALU v 1.0");
     exit(0);
     }
  puts("");
  puts("Prob�h� kompilace:");
  puts("   Spou�t�m program LEX_LIB.EXE\n");
  putenv("DOS4G=QUIET");
  create_include_list(argv[1]);
  if (spawnlp(P_WAIT,GetLexLibPath(),"lex_lib.exe",TEMP_NAME1,"temp.$$$",NULL))
     exit(1);
  if (errno || init("temp.$$$"))
     {
     puts("Nemohu spustit program lex_lib.exe");
     exit(1);
     }
  mlist=fopen(SCRIPT,"w");
  if (mlist==NULL)
     {
     printf("Nemohu otevrit soubor %s pro zapis.\n",SCRIPT);
     exit(0);
     }
  decode_program(f);
  fclose(f);
  remove("temp.$$$");
  remove(TEMP_NAME1);
  puts("Kompilace �sp��n�...");
  printf("Vytvoreno odstavcu: %d\nCelkem knihoven: %d\nCelkem Sentenci: %d\nD�lka k�du: %d\n",pgf_count,libs,sentencs,prog_pos);
  save_program();
  fclose(mlist);
  }
Пример #6
0
/****************************************************************************
*
*						Subroutine start_logger
*
*	Purpose: 	This function will start up the tracelogger, and
*				clear any filters that may be in place.
*
*	Returns: 	Pid of the tracelogger
*
*****************************************************************************/
int start_logger(void) 
{
	int tlpid,rc;
	char buf[100];
	snprintf(buf, sizeof(buf), "-n%d", NUM_ITER);

	tlpid=spawnlp(P_NOWAIT, "tracelogger", "tracelogger",buf, "-d", NULL);
	if (tlpid==-1) {
		snprintf(buf,sizeof(buf), "Unable to start tracelogger (%s)", strerror(errno));
		testerror(buf);
		teststop("Bad");
		exit(0);
	}
	rc=TraceEvent(_NTO_TRACE_DELALLCLASSES);
	assert(rc!=-1);
	rc=TraceEvent(_NTO_TRACE_CLRCLASSPID, _NTO_TRACE_KERCALL);
	assert(rc!=-1);
	rc=TraceEvent(_NTO_TRACE_CLRCLASSTID, _NTO_TRACE_KERCALL);
	assert(rc!=-1);
	rc=TraceEvent(_NTO_TRACE_CLRCLASSPID, _NTO_TRACE_THREAD);
	assert(rc!=-1);
	rc=TraceEvent(_NTO_TRACE_CLRCLASSTID, _NTO_TRACE_THREAD);
	assert(rc!=-1);
	rc=TraceEvent(_NTO_TRACE_CLRCLASSPID, _NTO_TRACE_VTHREAD);
	assert(rc!=-1);
	rc=TraceEvent(_NTO_TRACE_CLRCLASSTID, _NTO_TRACE_VTHREAD);
	assert(rc!=-1);
	return(tlpid);
}
Пример #7
0
int _RTL_FUNC system(const char *string)
{
    FILE *f;
    char buf[1024],*a;
    a = getenv("COMSPEC");
    if (!a)
        a = searchpath("cmd.exe");
    if (!string) {
        if (!a)
            return 0;
        else
            if (f = fopen(a,"r")) {
                fclose(f);
                return 1;
            }
            else
                return 0;
    }
    if (!a) {
        errno = ENOENT;
        return -1;
    }
    buf[0] = ' ';
    buf[1] = '/';
    buf[2] = 'C';
    buf[3] = ' ';
    strcpy(buf+4,string);
    return spawnlp(P_WAIT,a,a,buf,0);
}
static int 
os_startp (const char *shell, const char *command, const char *parm) 
{  
   if (parm) { 
         char *argv[256],*par=strdup(parm),*p,i=0;
         argv[i++]=strdup(shell); 
         argv[i++]=strdup("/c"); 
         argv[i++]=strdup(command); 
         p=strtok(par," ");
         while(p) {
             argv[i++]=strdup(p);
             p=strtok(0," ");
         }
         argv[i]=0; 
         spawnvp (P_WAIT,shell,argv);
         i=0;
         while(argv[i])free(argv[i++]);
         free(par);
    } else {
         spawnlp (P_WAIT, 
              (char *) shell, 
              (char *) shell, 
              "/c", 
              (char *) command, 
              (char *) 0);
    }
    return 0;
}
Пример #9
0
void consolidate()
{
         TCHAR mixer_folder[MAX_PATH]; mixer_folder[0]=0;
         get_mixer_folder(mixer_folder);
         _tcscat(mixer_folder,_T("kxctrl.exe"));

         char tmp_str[MAX_PATH];
         sprintf(tmp_str,"$%d --gui",manager->get_current_device()>=0?manager->get_current_device():0);
         spawnlp(_P_NOWAIT,mixer_folder,"kxctrl.exe",tmp_str,NULL);

         // debug("===%s=== ===%s===\n",mixer_folder,tmp_str);
         
/*         if(AllocConsole())
         {
            FILE *fin,*fout;

            fin=fopen("CONIN$","rb");
            fout=fopen("CONOUT$","wb");

            fprintf(fout,"Hello!\n");
            fflush(fout);

            int i;
            fscanf(fin,"%d",&i);

            FreeConsole();
         }
*/
}
Пример #10
0
int executecmd(const char *cmd, const char *args)
{
    int status;
    size_t len;

    if (!global.params.quiet || global.params.verbose)
        fprintf(global.stdmsg, "%s %s\n", cmd, args);

    if (!global.params.is64bit)
    {
        if ((len = strlen(args)) > 255)
        {
            char *q = (char *) alloca(8 + len + 1);
            sprintf(q,"_CMDLINE=%s", args);
            status = putenv(q);
            if (status == 0)
            {
                args = "@_CMDLINE";
            }
            else
            {
                error(Loc(), "command line length of %d is too long",len);
            }
        }
    }

    // Normalize executable path separators, see Bugzilla 9330
    char *p = mem.strdup(cmd);
    toWinPath(p);
    cmd = p;

#ifdef _MSC_VER
    if(strchr(cmd, ' '))
    {
        // MSVCRT: spawn does not work with spaces in the executable
        size_t cmdlen = strlen(cmd);
        char* shortName = new char[cmdlen + 1]; // enough space
        DWORD len = GetShortPathName(cmd, shortName, cmdlen + 1);
        if(len > 0 && len <= cmdlen)
            cmd = shortName;
    }
#endif

    status = executearg0(cmd,args);
    if (status == -1)
        // spawnlp returns intptr_t in some systems, not int
        status = spawnlp(0,cmd,cmd,args,NULL);

//    if (global.params.verbose)
//      fprintf(global.stdmsg, "\n");
    if (status)
    {
        if (status == -1)
            printf("Can't run '%s', check PATH\n", cmd);
        else
            printf("--- errorlevel %d\n", status);
    }
    return status;
}
Пример #11
0
void main() {
  char * input = NULL;
  int size = 0;
  DIR * dir;
  struct dirent *entry;
  struct stat buf;
  char * tempstr;

  printf("\nForce all files in this directory to\nend with the extension: (3 characters) ");
  con_update();
  getline(&input,&size,stdin);

  if(input[0] == '.')
    input++;

  if(strlen(input) > 3)
    input[3] = 0;

  dir = opendir("./");
  if(!dir) {
    printf("\nError: directory could not be opened.\n");
    exit(1);
  }

  tempstr = malloc(17);

  while(entry = readdir(dir)) {
    if(entry->d_type != 6) {
      if(strlen(entry->d_name) >= strlen(input)) {
        if(strcasecmp(&entry->d_name[strlen(entry->d_name)-strlen(input)],input)) {
          if(strlen(entry->d_name) + strlen(input) > 15) {
            sprintf(tempstr,"%s",entry->d_name);
            tempstr[strlen(tempstr) + (15-(strlen(tempstr)+strlen(input)))] = 0;
            sprintf(tempstr,"%s.%s",tempstr,input);
          } else {
            sprintf(tempstr,"%s.%s",entry->d_name,input);
          }
          spawnlp(S_WAIT,"mv",entry->d_name,tempstr,NULL);
        }
      } else {
        sprintf(tempstr,"%s.%s",entry->d_name,input);
        spawnlp(S_WAIT,"mv",entry->d_name,tempstr,NULL);
      }
    }
  }
}
Пример #12
0
void cmenulaunch(void * self,MenuData *item) {

  switch(item->command) {
    case LAUNCHIT:
      spawnlp(0,item->data,NULL);
    break;
  }
}
static int 
ux_startp (int flags, const char *shell, const char *command) 
{  
  if (flags & EXECUTE_AS_SHELL)
	    spawnl  (P_WAIT, shell, shell, "-c", command, (char *) 0);
  else
	    spawnlp (P_WAIT, shell, shell, command, (char *) 0);
  return 0;
}
Пример #14
0
static int tool_exec( tool_type utl, char *p1, char *p2 )
/*******************************************************/
{
    int     rc;
    
    FindToolPath( utl );
    if( !Flags.quiet ) {
        fputs( "\t", stdout );
        fputs( tools[utl].name, stdout );
        fputs( " ", stdout );
        fputs( p1, stdout );
        if( p2 != NULL ) {
            fputs( " ", stdout );
            fputs( p2, stdout );
        }
        fputs( "\n", stdout );
    }
    fflush( NULL );
    if( p2 == NULL ) {
        rc = spawnlp( P_WAIT, tools[utl].path, tools[utl].name, p1, NULL );
    } else {
        rc = spawnlp( P_WAIT, tools[utl].path, tools[utl].name, p1, p2, NULL );
    }
    if( rc != 0 ) {
        if( (rc == -1) || (rc == 255) ) {
            if( utl == TYPE_LINK ) {
                PrintMsg( CL_UNABLE_TO_INVOKE_LINKER );
            } else if( utl == TYPE_PACK ) {
                PrintMsg( CL_UNABLE_TO_INVOKE_CVPACK );
            } else {
                PrintMsg( CL_UNABLE_TO_INVOKE_COMPILER );
            }
        } else {
            if( utl == TYPE_LINK ) {
                PrintMsg( CL_BAD_LINK );
            } else if( utl == TYPE_PACK ) {
                PrintMsg( CL_BAD_LINK );
            } else {
                PrintMsg( CL_BAD_COMPILE, p1 );
            }
        }
    }
    return( rc );
}
Пример #15
0
Файл: link.c Проект: shoo/dmd
int executecmd(char *cmd, char *args, int useenv)
{
    int status;
    size_t len;

    if (!global.params.quiet || global.params.verbose)
    {
        printf("%s %s\n", cmd, args);
        fflush(stdout);
    }

    if (global.params.is64bit)
    {
    }
    else
    {
    if ((len = strlen(args)) > 255)
    {   char *q;
        static char envname[] = "@_CMDLINE";

        envname[0] = '@';
        switch (useenv)
        {   case 0:     goto L1;
            case 2: envname[0] = '%';   break;
        }
        q = (char *) alloca(sizeof(envname) + len + 1);
        sprintf(q,"%s=%s", envname + 1, args);
        status = putenv(q);
        if (status == 0)
            args = envname;
        else
        {
        L1:
            error(0, "command line length of %d is too long",len);
            }
        }
    }

    status = executearg0(cmd,args);
#if _WIN32
    if (status == -1)
        status = spawnlp(0,cmd,cmd,args,NULL);
#endif
//    if (global.params.verbose)
//      printf("\n");
    if (status)
    {
        if (status == -1)
            printf("Can't run '%s', check PATH\n", cmd);
        else
            printf("--- errorlevel %d\n", status);
    }
    return status;
}
static int 
ux_startp (const char *shell, const char *command, const char *parm) 
{
    if (parm) {
         spawnlp (P_WAIT, 
              (char *) shell, 
              (char *) shell, 
              "/c", 
              (char *) command, 
              (char *) parm,
              (char *) 0);
    } else {
         spawnlp (P_WAIT, 
              (char *) shell, 
              (char *) shell, 
              "/c", 
              (char *) command, 
              (char *) 0);
    }
    return 0;
}
Пример #17
0
void main(void)
 {
   char *env[] = { "FILE=SPAWNLXX.C", "LANGUAGE=C",
                   "OS=DOS", NULL};

   spawnle(P_WAIT, "CHILD.EXE", "CHILD.EXE", 
      "Using-spawnle", "BBB", NULL, env);

   spawnlp(P_WAIT, "CHILD.EXE", "CHILD.EXE", "Using-spawnlp", 
      "BBB", NULL);
   spawnlpe(P_WAIT, "CHILD.EXE", "CHILD.EXE", "Using-spawnlpe", 
      "BBB", NULL, env);
 }
Пример #18
0
static FILE* fopenZIPped(const char* filename, const char* mode)
{
    // check mode
    if (mode[0] == 'r')
    {
        // create the pipe
        int hPipe[2];
        if (_pipe(hPipe, 2048, ((mode[1] =='b') ? _O_BINARY : _O_TEXT) | _O_NOINHERIT) == -1)
        {
            fprintf(stderr, "could not create pipe\n");
            return NULL;
        }

        // duplicate stdin/stdout handle so we can restore them later
        int hStdOut = _dup(_fileno(stdout));

        // make the write end of pipe go to stdout
        if (_dup2(hPipe[WRITE_HANDLE], _fileno(stdout)) != 0)
        {
            fprintf(stderr, "could not set pipe output\n");
            return NULL;
        }

        // redirect read end of pipe to input file
        if (_dup2(hPipe[READ_HANDLE], _fileno(stdin)) != 0)
        {
            fprintf(stderr, "could not redirect input file\n");
            return NULL;
        }

        // close original write end of pipe
        close(hPipe[WRITE_HANDLE]);

        // Spawn process
        HANDLE hProcess = (HANDLE) spawnlp(P_NOWAIT, "unzip", "unzip", "-p", filename, NULL);

        // redirect stdout back into stdout
        if (_dup2(hStdOut, _fileno(stdout)) != 0)
        {
            fprintf(stderr, "could not reconstruct stdout\n");
            return NULL;
        }

        // return redirected stdin
        return stdin;
    }
    else
    {
        return NULL;
    }
}
Пример #19
0
static void DoReplace( void )
/***************************/
// this supports concatenated object decks and libraries (PageLen != 0)
{
    FlushBuffer();
    if( PageLen != 0 ) {        // NYI - spawning WLIB every time is
        close( OutFile );       // rather slow. Replace this somehow??
        OutFile = NOFILE;
        if( spawnlp( P_WAIT, WLIB_EXE, WLIB_EXE, TEMP_LIB_NAME, "-b", "+" TEMP_OBJ_NAME, NULL ) != 0 ) {
            Error( "problem with temporary library" );
        }
        QRemove( TEMP_OBJ_NAME );
    }
}
Пример #20
0
static int
RunCommand (char *command)
{
  char *buffer;
  char *shell;
  int pid;

  /* Locate the command shell. */
  shell = o_shell ? tochar8 (o_shell) : getenv ("COMSPEC");
  if (shell == NULL)
    {
      shell = "cmd.exe";
    }

  if ((buffer = malloc (strlen (command) + 5)) != NULL) 
    {
    /*
     * Herbert:
     * Find the name of the shell. I assume cmd.exe and 4os2.exe to
     * understand the "/c" switch and use "-c" for all the others.
     * The quotes around the command *seem* to work for Unix-like
     * shells, they are meant to pass the command to the shell as
     * one string.
     */
      char *org_sep = strrchr (shell, OSPATHSEP);
      char *alt_sep = strrchr (shell, OSALTPSEP);
      char *base = org_sep < alt_sep ? alt_sep : org_sep;
      base = base == NULL? shell: base+1;

      if ( stricmp (base, "cmd.exe") == 0 
           || stricmp (base, "4os2.exe") == 0) 
        {
          sprintf (buffer, "/c %s", command);
        }
      else 
        {
          sprintf (buffer, "-c \"%s\"", command);
        }

      pid = spawnlp (P_NOWAIT, shell, shell, buffer, NULL);
      free (buffer);
      return pid;
    } 
  else 
    {
      return -1;
    }
}
Пример #21
0
static int TI_EXEC_PROG( char *pnam )
{
    int         oStdIn, oStdOut;        // old stdin/stdout
    char        *ppath;                 // program path
    int         ret;                    // return code

    if( pnam != NULL && pnam[0] != '\0' ) {
        // get full path name of program
        ppath = alloca( TI_PATH_LEN + strlen( pnam ) );
        if( ppath == NULL ) {
            return( FALSE );
        }
        strcpy( ppath, TI_PATH_NAME );
        strcat( ppath, pnam );
        ppath[TI_PATH_LEN - 3] = pnam[0]; // replace '?' with first char of fnam

        // record values in qnx_spawn_options
        oStdIn = qnx_spawn_options.iov[0];
        oStdOut = qnx_spawn_options.iov[1];

        // change stdin/out for spawned processes to UIConHandle
        qnx_spawn_options.iov[0] = qnx_spawn_options.iov[1] = UIConHandle;

        // attempt to call pgm in /usr/lib/terminfo/?/
        ret = spawnl( P_WAIT, ppath, NULL );

        if( ret == -1 ) {
            ppath[TI_PATH_LEN - 3] = '\0';
            strcat( ppath, pnam );
            // attempt to call pgm in /usr/lib/terminfo/
            ret = spawnl( P_WAIT, ppath, NULL );
            if( ret == -1 ) {
                // attempt to call pgm in path
                ret = spawnlp( P_WAIT, pnam, NULL );
            }
        }

        // restore values in qnx_spawn_options
        qnx_spawn_options.iov[0] = oStdIn;
        qnx_spawn_options.iov[1] = oStdOut;

        // if program failed...
        if( ret == -1 ) {
            return( FALSE );
        }
    }
    return( TRUE );
}
Пример #22
0
void execute( const char *type, const char *text, const struct optstruct *opts )
{
	int ret;
#ifndef C_WINDOWS
	pid_t pid;
#endif

    if(!optget(opts, "daemon")->enabled) {
	if(sscanf(text, "EXIT_%d", &ret) == 1) {
	    logg("*%s: EXIT_%d\n", type, ret);
	    exit(ret);
	}
	if(system(text) == -1)
	    logg("%s: system(%s) failed\n", type, text);

	return;
    }

#ifdef        C_WINDOWS
	if(active_children < MAX_CHILDREN) {
		if(spawnlp(P_DETACH, text, text, NULL) == -1) {
			logg("^%s: couldn't execute \"%s\".\n", type, text);
			return;
		}
		active_children++;	/* FIXME: this is never reduced */
	} else
		logg("^%s: already %d processes active.\n", type, active_children);
#else
	if ( active_children<MAX_CHILDREN )
	switch( pid=fork() ) {
	case 0:
		if ( -1==system(text) )
		{
		logg("^%s: couldn't execute \"%s\".\n", type, text);
		}
		exit(0);
	case -1:
		logg("^%s::fork() failed, %s.\n", type, strerror(errno));
		break;
	default:
		active_children++;
	}
	else
	{
		logg("^%s: already %d processes active.\n", type, active_children);
	}
#endif
}
Пример #23
0
_WCRTLINK int system( const CHAR_TYPE *cmd )
{
    register CHAR_TYPE *name;
    int ret_code;

    name = getenv("COMSPEC");
    if( cmd == NULL ) {
        return( 1 );
    }
    if( name == NULL ) {
        name = "z:\\command.exe";
    }

    ret_code = spawnlp( P_WAIT, name, "command", "/c", cmd, NULL );
    return( ret_code );
}
Пример #24
0
static void DoCVPack( void )
/**************************/
{
    int         retval;
    char        *name;

    if( LinkFlags & CVPACK_FLAG && !(LinkState & LINK_ERROR) ) {
        if( SymFileName != NULL ) {
            name = SymFileName;
        } else {
            name = Root->outfile->fname;
        }
        retval = spawnlp( P_WAIT, CVPACK_EXE, CVPACK_EXE, "/nologo",
                          name, NULL );
        if( retval == -1 ) {
            PrintIOError( ERR+MSG_CANT_EXECUTE, "12", CVPACK_EXE );
        }
    }
}
Пример #25
0
/*ARGSUSED*/
spawncli(f, n) {
	register void	(*oisig)();
	int		status;
#ifdef	EXTD_DIR
	ensurecwd();
#endif

	if (shellp == NULL) {
		shellp = getenv("SHELL");
		if (shellp == NULL)
			shellp = getenv("shell");
		if (shellp == NULL)
			shellp = "command.x";	/* Safer.		*/
	}
	ttcolor(CTEXT);
	ttnowindow();
	ttmove(nrow-1, 0);
	if (epresf != FALSE) {
		tteeol();
		epresf = FALSE;
	}
	ttclose();
	sgarbf = TRUE;				/* Force repaint.	*/
	oisig = signal(SIGINT,  SIG_IGN);
#ifdef	EXTD_DIR
	dirend();
#endif
	if (spawnlp(P_WAIT, shellp, shellp, NULL) == -1) {
		status = FALSE;
	} else {
		status = TRUE;
	}
	(VOID) signal(SIGINT,  oisig);
	ttopen();
	if(status == FALSE) {
		ewprintf("Failed to run %s", shellp);
		sleep(2);		/* Show this message for 2 sec	*/
					/* before refresh screen.	*/
	}
	dirinit();
	return (status);
}
Пример #26
0
int shell_to_DOS(void)
{
      char *comspec, prompt[256], *oldprompt;
      int retval;

      comspec = getenv("COMSPEC");
      if(comspec == NULL)
            comspec = "COMMAND.COM";     /* Better than nothing... */

      sprintf(prompt, "PROMPT=[Type EXIT to return to program]\r\n%s",
            oldprompt = getenv("PROMPT"));
      putenv(prompt); 

      retval = spawnlp(0, comspec, comspec, NULL);

      sprintf(prompt, "PROMPT=%s", oldprompt);
      putenv(prompt);

      return retval;
}
Пример #27
0
int
os_system(const char *cmd)
{
  char *s;
  int i;
  char *cmd1;

#if defined(OS2)
  if (_osmode == OS2_MODE)
    return(system(cmd));
#endif

  if ((cmd1 = scriptify(cmd)) == NULL) return(1);
  if (s = getenv("SHELL"))
    i = spawnlp(P_WAIT, s, s, cmd1 + strlen(s), NULL);
  else
    i = system(cmd1);
  unlink_and_free(cmd1);
  return(i);
}
Пример #28
0
void run_pult () {

	register ret, o_errno;
	struct wordb word;

	_dos_setvect (0x1C, old_timer);
	VIClear ();
	ret = spawnlp (P_WAIT, pult_file, pult_file, NULL);
	o_errno = errno; /* VRedraw () портит errno */
	VRedraw ();
	_dos_setvect (0x1C, timer_int);
	if (ret == -1)
		error ("%s : %s", pult_file, sys_errlist[o_errno]);
	else {
		ptinitialize();
		old_addr = -1;
		_disable ();
		int_tab [0].ticks = TICK_CHK;
		_enable ();
	}
}
Пример #29
0
static void DoCVPack( void )
/**************************/
{
#if !defined( __UNIX__ ) || defined(__WATCOMC__)
    int         retval;
    char        *name;

    if( (LinkFlags & CVPACK_FLAG) && (LinkState & LINK_ERROR) == 0 ) {
        if( SymFileName != NULL ) {
            name = SymFileName;
        } else {
            name = Root->outfile->fname;
        }
        retval = (int)spawnlp( P_WAIT, CVPACK_EXE, CVPACK_EXE, "/nologo",
                          name, NULL );
        if( retval == -1 ) {
            PrintIOError( ERR+MSG_CANT_EXECUTE, "12", CVPACK_EXE );
        }
    }
#endif
}
Пример #30
0
void make( char *maker ) {
    static char make_opt[ _MAX_PATH ];
//  static char *args[3];
    int err;

    sprintf( make_opt,
" -%cMAP -%cDEBUG -%cNODEFLIB -%cKEEP_SRC -%cKEEP_LST -%cLINK -%cASSEMBLE -%cCOMPILE",
        Def( _map_file), Def( _debug), Def( _nodef_lib),
        Def( _keep_gen ), Def( _dump_lst ),
        Def( _link), Def( _assemble ), Def( _compile ) );
    if ( _keep_rsp )
        strcat( make_opt, " -K" );
    if ( _build_all )
        strcat( make_opt, " -B" );
    printf( "%s%s\n", maker, make_opt );
    err = spawnlp( P_OVERLAY, maker, maker, make_opt, NULL );

    if ( err <  0 )
        error( ERR_RUNTIME, maker );
    else if ( err > 0 )
        error( err, maker );
}