[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: geda_sym_format.h
User: cnieves
Date: 07/06/09 12:09:41
Modified: . geda_sym_format.h grenum.c gsch2pcb.c
smash_megafile.c
Log:
Avoid writting '\r' to files on MinGW.
Applied patch #1733826 from Cesar Strauss. Thanks.
When using the "w" mode in fopen, MinGW translates LF into CR-LF.
This creates havoc when reading the same file again, when sharing
schematics files with other systems, and when placing them in a VCS.
This can be avoided by using the "wb" mode. The "b" is ignored on
all POSIX conforming systems, according to these sources:
http://www.die.net/doc/linux/man/man3/fopen.3.html
http://www.opengroup.org/onlinepubs/009695399/functions/fopen.html
There are other ways, however. Adding
#include <fcntl.h>
int _fmode = _O_BINARY;
on some source file should work as well. Another way is linking
against the MinGW supplied binmode.o, which does exactly that.
Revision Changes Path
1.2 eda/geda/gaf/utils/src/geda_sym_format.h
(In the diff below, changes in quantity of whitespace are not shown.)
Index: geda_sym_format.h
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/utils/src/geda_sym_format.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- geda_sym_format.h 30 Oct 2002 02:57:37 -0000 1.1
+++ geda_sym_format.h 9 Jun 2007 16:09:41 -0000 1.2
@@ -149,7 +149,7 @@
* makes file .sym.part that stands for "partial" symbol */
if (vector_found && vector_count == 0)
strcat(fnsym,".part");
- if (!(fsym = fopen(fnsym,"w")))
+ if (!(fsym = fopen(fnsym,"wb")))
{
perror("Opening sym output file");
return -1;
1.6 eda/geda/gaf/utils/src/grenum.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: grenum.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/utils/src/grenum.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- grenum.c 15 Jun 2006 02:48:13 -0000 1.5
+++ grenum.c 9 Jun 2007 16:09:41 -0000 1.6
@@ -1,4 +1,4 @@
-/* $Id: grenum.c,v 1.5 2006-06-15 02:48:13 ahvezda Exp $ */
+/* $Id: grenum.c,v 1.6 2007-06-09 16:09:41 cnieves Exp $ */
/* This is grenum, an advanced refdes renumber utility for gEDA's gschem.
*
* Copyright (C) 2005-2006 Levente Kovacs
@@ -117,7 +117,7 @@
return FILE_OP_ERROR;
}
strcpy(&outfilename[0],&infilename[0]);
- if((outfile=fopen(strcat(&outfilename[0],".tmp"),"w"))==NULL)
+ if((outfile=fopen(strcat(&outfilename[0],".tmp"),"wb"))==NULL)
{
perror("grenum: could not create tmp file");
fclose(infile); /*Close the file*/
@@ -222,7 +222,7 @@
strcpy(&buff[0],&infilename[0]); /*buff has the original infilename*/
/*The next few lines implements the copy program*/
fseek(infile,0L,SEEK_SET); /*Go to the begining of the infile*/
- outfile=fopen(strcat(&buff[0],".save"),"w");
+ outfile=fopen(strcat(&buff[0],".save"),"wb");
if(outfile==NULL)
{
perror("grenum: ould not create backup file");
1.18 eda/geda/gaf/utils/src/gsch2pcb.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: gsch2pcb.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/utils/src/gsch2pcb.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- gsch2pcb.c 17 Apr 2007 20:19:24 -0000 1.17
+++ gsch2pcb.c 9 Jun 2007 16:09:41 -0000 1.18
@@ -1,4 +1,4 @@
-/* $Id: gsch2pcb.c,v 1.17 2007-04-17 20:19:24 pcjc2 Exp $ */
+/* $Id: gsch2pcb.c,v 1.18 2007-06-09 16:09:41 cnieves Exp $ */
/* gsch2pcb
|
@@ -123,7 +123,7 @@
FILE *f;
m4_override_file = "gnet-gsch2pcb-tmp.scm";
- f = fopen(m4_override_file, "w");
+ f = fopen(m4_override_file, "wb");
if (!f)
{
m4_override_file = NULL;
@@ -810,7 +810,7 @@
if ((f_in = fopen(pcb_file, "r")) == NULL)
return 0;
tmp_file = g_strconcat(pcb_file, ".tmp", NULL);
- if ((f_out = fopen(tmp_file, "w")) == NULL)
+ if ((f_out = fopen(tmp_file, "wb")) == NULL)
{
fclose(f_in);
g_free(tmp_file);
@@ -943,7 +943,7 @@
if ((f_in = fopen(pcb_file, "r")) == NULL)
return;
tmp = g_strconcat(pcb_file, ".tmp", NULL);
- if ((f_out = fopen(tmp, "w")) == NULL)
+ if ((f_out = fopen(tmp, "wb")) == NULL)
{
fclose(f_in);
return;
@@ -1025,7 +1025,7 @@
if ((f_in = fopen(pcb_file, "r")) == NULL)
return;
tmp = g_strconcat(pcb_file, ".tmp", NULL);
- if ((f_out = fopen(tmp, "w")) == NULL)
+ if ((f_out = fopen(tmp, "wb")) == NULL)
{
fclose(f_in);
return;
1.5 eda/geda/gaf/utils/src/smash_megafile.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: smash_megafile.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/utils/src/smash_megafile.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- smash_megafile.c 7 Feb 2005 23:57:14 -0000 1.4
+++ smash_megafile.c 9 Jun 2007 16:09:41 -0000 1.5
@@ -19,7 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
*
- * $Id: smash_megafile.c,v 1.4 2005-02-07 23:57:14 danmc Exp $
+ * $Id: smash_megafile.c,v 1.5 2007-06-09 16:09:41 cnieves Exp $
*
*/
@@ -106,7 +106,7 @@
strcpy(output_name, argv[1]);
strcat(output_name, "/");
strcat(output_name, name);
- output = fopen(output_name,"w");
+ output = fopen(output_name,"wb");
if(output == NULL)
{
fclose(megafile);
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs