currently the file gets created , overwritten. trying if file exists exits program. open must used.
if ((dest = open(argv[2], o_wronly | o_creat, 0644)) == -1) { printf("error file %s exists", argv[2]); return 3; }
just use o_excl:
o_exclensure call creates file: if flag specified in conjunctiono_creat, and pathname exists,open()fail.