execv extension list for shell

This is a discussion on execv extension list for shell within the C Programming forums, part of the General Programming Boards category; Hi, I am implementing a shell and would like to call specifically execv in the forked childs according to user ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,451
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 03: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, 01:48 PM
  4. 1st Class LIST ADT
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 11-09-2001, 06:29 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21