Changeset 2720

Show
Ignore:
Timestamp:
06/17/08 18:16:47 (5 months ago)
Author:
dhozac
Message:

Add operations needed by Fedora 9 tweaks.

Files:

Legend:

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

    r2536 r2720  
    211211} 
    212212 
     213static int 
     214execMv(int argc, char *argv[]) 
     215{ 
     216  int           res = EXIT_SUCCESS; 
     217 
     218  if (argc!=3) { 
     219    WRITE_MSG(2, "Need exactly two files for 'mv' operation; try '--help' for more information\n"); 
     220    return wrapper_exit_code; 
     221  } 
     222 
     223  if (rename(argv[1], argv[2])==-1) { 
     224    PERROR_Q(ENSC_WRAPPERS_PREFIX "mv", argv[1]); 
     225    res = EXIT_FAILURE; 
     226  } 
     227 
     228  return res; 
     229} 
     230 
    213231static struct Command { 
    214232    char const          *cmd; 
     
    223241  { "chmod",    execChmod }, 
    224242  { "link",     execLink }, 
     243  { "mv",       execMv }, 
    225244  { 0,0 } 
    226245}; 
     
    237256            "\n" 
    238257            "The supported commands are:\n" 
    239             "  cat <file>      ...  gives out <file> to stdout\n" 
    240             "  append <file>   ...  appends stdin to <file> which is created when needed\n" 
    241             "  truncate <file> ...  clear <file> and fill it with stdin; the <file> is\n" 
     258            "  cat <file>      ...  gives out <file> to stdout\n" 
     259            "  append <file>    ...  appends stdin to <file> which is created when needed\n" 
     260            "  truncate <file> ...  clear <file> and fill it with stdin; the <file> is\n" 
    242261            "                       created when needed\n" 
    243             "  rm <file>+      ...  unlink the given files\n" 
    244             "  mkdir <file>+   ...  create the given directories\n" 
     262            "  rm <file>+      ...  unlink the given files\n" 
     263            "  mkdir <file>+    ...  create the given directories\n" 
    245264            "  chmod <mode> <file>+\n" 
    246             "                  ...  change access permissions of files\n" 
    247             "  link <src> dst> ...  create a symbolic link from <src> to <dst>\n\n" 
    248             "Please report bugs to " PACKAGE_BUGREPORT "\n"); 
     265            "                   ...  change access permissions of files\n" 
     266            "  link <src> <dst> ...  create a symbolic link from <src> to <dst>\n" 
     267            "  mv <src> <dst>   ...  rename <src> to <dst>\n" 
     268            "\nPlease report bugs to " PACKAGE_BUGREPORT "\n"); 
    249269  exit(0); 
    250270}