Changeset 2536

Show
Ignore:
Timestamp:
04/27/07 11:01:20 (2 years ago)
Author:
hollow
Message:

add link command to chroot-sh

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/chroot-sh.c

    r2407 r2536  
    193193} 
    194194 
     195static int 
     196execLink(int argc, char *argv[]) 
     197{ 
     198  int           res = EXIT_SUCCESS; 
     199 
     200  if (argc!=3) { 
     201    WRITE_MSG(2, "Need exactly two files for 'link' operation; try '--help' for more information\n"); 
     202    return wrapper_exit_code; 
     203  } 
     204 
     205  if (symlink(argv[1], argv[2])==-1) { 
     206    PERROR_Q(ENSC_WRAPPERS_PREFIX "link", argv[1]); 
     207    res = EXIT_FAILURE; 
     208  } 
     209 
     210  return res; 
     211} 
     212 
    195213static struct Command { 
    196214    char const          *cmd; 
     
    204222  { "mkdir",    execMkdir }, 
    205223  { "chmod",    execChmod }, 
     224  { "link",     execLink }, 
    206225  { 0,0 } 
    207226}; 
     
    225244            "  mkdir <file>+   ...  create the given directories\n" 
    226245            "  chmod <mode> <file>+\n" 
    227             "                  ...  change access permissions of files\n\n" 
     246            "                  ...  change access permissions of files\n" 
     247            "  link <src> dst> ...  create a symbolic link from <src> to <dst>\n\n" 
    228248            "Please report bugs to " PACKAGE_BUGREPORT "\n"); 
    229249  exit(0);