|
|
1.1 ! root 1: /* x_mv.c - x_mv */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <file.h> ! 6: ! 7: /*------------------------------------------------------------------------ ! 8: * x_mv - (command mv) move (rename) a file ! 9: *------------------------------------------------------------------------ ! 10: */ ! 11: COMMAND x_mv(stdin, stdout, stderr, nargs, args) ! 12: int stdin, stdout, stderr, nargs; ! 13: char *args[]; ! 14: { ! 15: if (nargs != 3) { ! 16: fprintf(stderr, "usage: mv file tofile\n"); ! 17: return(SYSERR); ! 18: } ! 19: if (rename(args[1], args[2]) == SYSERR ) { ! 20: fprintf(stderr, "Cannot move %s\n", args[1]); ! 21: return(SYSERR); ! 22: } ! 23: return(OK); ! 24: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.