shithub: riscv

ref: 3bd5ff9583c4b33aa27754fb4c3b6792261feb8a
dir: /sys/src/ape/lib/ap/stdio/rename.c/

View raw version
/*
 * pANS stdio -- rename
 */
#include "iolib.h"
int rename(const char *old, const char *new){
	if(link((char *)old, (char *)new)<0) return -1;
	if(unlink((char *)old)<0){
		unlink((char *)new);
		return -1;
	}
	return 0;
}