Thread: execv extension list for shell

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    5

    execv extension list for shell

    Hi,

    I am implementing a shell and would like to call specifically execv in the forked childs according to user input.

    The user input however does not provide the extension for the commands that he inputs. For example, he provides "cat" but NOT "/bin/cat".

    How should the extension be programmed into the execv system call? What is the manner most common manner?

    Thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    You mean like it already can do - search a path
    The functions execlp and execvp will duplicate the actions of the shell
    in searching for an executable file if the specified file name does not
    contain a slash (/) character. The search path is the path specified
    in the environment by the PATH variable. If this variable isn’t speci‐
    fied, the default path ‘‘:/bin:/usr/bin’’ is used.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unknown memory leak with linked lists...
    By RaDeuX in forum C Programming
    Replies: 6
    Last Post: 12-07-2008, 04:09 AM
  2. circular doubly linked list help
    By gunnerz in forum C++ Programming
    Replies: 5
    Last Post: 04-28-2007, 08:38 PM
  3. Anyone good with linked list.....I am not....
    By chadsxe in forum C++ Programming
    Replies: 11
    Last Post: 11-10-2005, 02:48 PM
  4. 1st Class LIST ADT
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 11-09-2001, 07:29 PM