Changeset 3270 for trunk


Ignore:
Timestamp:
May 1, 2007, 6:40:49 PM (18 years ago)
Author:
bird
Message:

translate /bin/sh and a few other standard things to /@unixroot and PATH searches.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/essentials/app-shells/bash/execute_cmd.c

    r3231 r3270  
    38453845  execve (command, args, env);
    38463846  i = errno;                    /* error from execve() */
     3847
     3848#ifdef __OS2__
     3849  /* A lot of scripts references some core /bin/ programs, like for
     3850     instance the bash testcases. So, to make life easier, we map
     3851     a small set of these to @unixroot and or the PATH to simplify
     3852     porting. */
     3853  if (!strncmp(command, "/bin/", sizeof("/bin/") - 1))
     3854    {
     3855      char *name = command + sizeof("/bin/") - 1;
     3856      int search_path = 1;
     3857      if (!strcmp (name, "sh")
     3858       || !strcmp (name, "sh.exe")
     3859       || !strcmp (name, "bash")
     3860       || !strcmp (name, "bash.exe")
     3861       || !strcmp (name, "ash")
     3862       || !strcmp (name, "ash.exe")
     3863       || !strcmp (name, "ls")
     3864       || !strcmp (name, "ls.exe")
     3865       || !strcmp (name, "cat")
     3866       || !strcmp (name, "cat.exe")
     3867       || !strcmp (name, "mkdir")
     3868       || !strcmp (name, "mkdir.exe")
     3869       || !strcmp (name, "expr")
     3870       || !strcmp (name, "expr.exe")
     3871       || !strcmp (name, "pwd")
     3872       || !strcmp (name, "pwd.exe")
     3873       || !strcmp (name, "tr")
     3874       || !strcmp (name, "tr.exe")
     3875       || (search_path = 0)
     3876       || !strcmp (name, "sort")
     3877       || !strcmp (name, "sort.exe")
     3878       || !strcmp (name, "cp")
     3879       || !strcmp (name, "cp.exe")
     3880       || !strcmp (name, "rm")
     3881       || !strcmp (name, "rm.exe")
     3882       || !strcmp (name, "unlink")
     3883       || !strcmp (name, "unlink.exe")
     3884       || !strcmp (name, "mv")
     3885       || !strcmp (name, "mv.exe")
     3886       || !strcmp (name, "rmdir")
     3887       || !strcmp (name, "rmdir.exe")
     3888      )
     3889        {
     3890          strcat (strcpy (sample, "/@unixroot"), command);
     3891          execve (sample, args, env);
     3892          if (search_path)
     3893            {
     3894              strcpy (sample, name);
     3895              if (!strchr (name, '.'))
     3896                strcat (sample, ".exe");
     3897              execvpe (sample, args, env);
     3898            }
     3899        }
     3900    }
     3901#endif
     3902
    38473903  SETOSTYPE (1);
    38483904
Note: See TracChangeset for help on using the changeset viewer.