Subversion Repositories SvarDOS

Rev

Rev 397 | Rev 405 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 397 Rev 402
Line 54... Line 54...
54
#include <process.h>
54
#include <process.h>
55
 
55
 
56
#include "cmd.h"
56
#include "cmd.h"
57
#include "env.h"
57
#include "env.h"
58
#include "helpers.h"
58
#include "helpers.h"
-
 
59
#include "redir.h"
59
#include "rmodinit.h"
60
#include "rmodinit.h"
60
 
61
 
61
struct config {
62
struct config {
62
  int locate;
63
  int locate;
63
  int install;
64
  int install;
Line 353... Line 354...
353
    while (*cmdline == ' ') cmdline++;
354
    while (*cmdline == ' ') cmdline++;
354
 
355
 
355
    /* update rmod's ptr to COMPSPEC so it is always up to date */
356
    /* update rmod's ptr to COMPSPEC so it is always up to date */
356
    rmod_updatecomspecptr(rmod_seg, *rmod_envseg);
357
    rmod_updatecomspecptr(rmod_seg, *rmod_envseg);
357
 
358
 
-
 
359
    /* handle redirections (if any) */
-
 
360
    if (redir_parsecmd(cmdline, BUFFER) != 0) {
-
 
361
      outputnl("");
-
 
362
      continue;
-
 
363
    }
-
 
364
 
358
    /* try matching (and executing) an internal command */
365
    /* try matching (and executing) an internal command */
359
    {
366
    {
360
      int ecode = cmd_process(*rmod_envseg, cmdline, BUFFER);
367
      int ecode = cmd_process(*rmod_envseg, cmdline, BUFFER);
361
      if (ecode >= 0) *lastexitcode = ecode;
368
      if (ecode >= 0) *lastexitcode = ecode;
362
      if (ecode >= -1) { /* internal command executed */
369
      if (ecode >= -1) { /* internal command executed */
-
 
370
        redir_revert(); /* revert stdout (in case it was redirected) */
363
        outputnl("");
371
        outputnl("");
364
        continue;
372
        continue;
365
      }
373
      }
366
    }
374
    }
367
 
375
 
368
    /* if here, then this was not an internal command */
376
    /* if here, then this was not an internal command */
369
    run_as_external(cmdline);
377
    run_as_external(cmdline);
370
 
378
 
-
 
379
    /* revert stdout (in case it was redirected) */
-
 
380
    redir_revert();
-
 
381
 
371
    /* execvp() replaces the current process by the new one
382
    /* execvp() replaces the current process by the new one
372
    if I am still alive then external command failed to execute */
383
    if I am still alive then external command failed to execute */
373
    outputnl("Bad command or file name");
384
    outputnl("Bad command or file name");
374
 
385
 
375
  }
386
  }