1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <errno.h> #include <string.h> #include <stdio.h> int main(int argc, const char *argv[]) { if (argc != 3) { fprintf(stderr, "usage: mv from to\n"); return 1; } if (rename(argv[1], argv[2]) < 0) { fprintf(stderr, "mv: %s\n", strerror(errno)); return 1; } }