Lines Matching defs:to
17 along with this program; if not, write to the Free Software
35 /* We need to open the file in binary modes on system where that makes
44 /* The number of bytes to copy at once. */
47 /* Copy file FROM to file TO, performing no translations.
51 simple_copy (const char *from, const char *to)
61 tofd = open (to, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, 0777);
63 tofd = creat (to, 0777);
95 /* Set the times of the file DESTINATION to be the same as those in
142 /* Rename FROM to TO, copying if TO is a link.
146 smart_rename (const char *from, const char *to, int preserve_dates ATTRIBUTE_UNUSED)
152 exists = lstat (to, &s) == 0;
155 /* Win32, unlike unix, will not erase `to' in `rename(from, to)' but
159 remove (to);
161 ret = rename (from, to);
164 /* We have to clean up here. */
165 non_fatal (_("unable to rename '%s' reason: %s"), to, strerror (errno));
170 only one hard link, and we have permission to write to it. */
178 ret = rename (from, to);
183 /* Try to preserve the permission bits and ownership of
188 able to do the chmod afterward. We don't bother to
193 want to introduce an unexpected setuid file owned by
195 chmod (to, s.st_mode & 0777);
196 if (chown (to, s.st_uid, s.st_gid) >= 0)
197 chmod (to, s.st_mode & 07777);
202 /* We have to clean up here. */
203 non_fatal (_("unable to rename '%s' reason: %s"), to, strerror (errno));
209 ret = simple_copy (from, to);
211 non_fatal (_("unable to copy file '%s' reason: %s"), to, strerror (errno));
214 set_times (to, &s);