1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-04 22:33:27 +00:00
freebsd-ports/editors/gate/files/patch-ab
Kevin Lo 02585bd39c Initial import of gate-2.04c.
gate is a simple and unobtrusive line-oriented text editor.

PR: 19905
Submitted by: Christopher N. Harrell <cnh@ivmg.net>
Reviewed by: sobomax
2000-07-21 10:11:44 +00:00

32 lines
735 B
Plaintext

--- file.c.orig Mon Jul 17 23:05:48 2000
+++ file.c Mon Jul 17 23:12:29 2000
@@ -59,12 +59,12 @@
* open file descriptor.
*/
-FILE *copy_file(char *wname)
+FILE *copy_file(char *wname, int fd)
{
FILE *wfp;
int ch;
- if ((wfp= fopen(wname,"w+")) == NULL)
+ if ((wfp= fdopen(fd,"w+")) == NULL)
{
printf("Cannot open file %s\n",wname);
return(NULL);
@@ -84,10 +84,12 @@
void write_file(char *wname)
{
FILE *fp;
+int fd;
if (expand_tilde(wname)) return;
- if ((fp= copy_file(wname)) == NULL) return;
+ fd = open(wname, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
+ if ((fp= copy_file(wname, fd)) == NULL) return;
fclose(fp);
printf("Saved in file %s\n",wname);
}