[Trainsched-commit] csv2pdb csv2trainschedpdb.c,1.7.2.1,1.7.2.2
Brought to you by:
philm
|
From: Steve M. <sma...@us...> - 2009-05-04 17:18:21
|
Update of /cvsroot/trainsched/csv2pdb In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11551 Modified Files: Tag: PDB_VER2 csv2trainschedpdb.c Log Message: Fix bug: Bad PDB generated when exactly one abbreviation defined. Index: csv2trainschedpdb.c =================================================================== RCS file: /cvsroot/trainsched/csv2pdb/csv2trainschedpdb.c,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -C2 -d -r1.7.2.1 -r1.7.2.2 *** csv2trainschedpdb.c 2 May 2009 16:18:13 -0000 1.7.2.1 --- csv2trainschedpdb.c 4 May 2009 17:18:12 -0000 1.7.2.2 *************** *** 55,59 **** * record number */ - int writerecordinfo(FILE *pdbfd, unsigned int record_num, long pos) { --- 55,58 ---- *************** *** 84,88 **** { FILE *fd, *pdbfd; ! int c=1, nbgares=0, i,j=0, nbdays=0, nabbrev=0, nabdef=0, nbdir=0, num_colon=0; char temp[LGMAXNOMGARE+1]={0}; int cur_record; --- 83,87 ---- { FILE *fd, *pdbfd; ! int c=1, nbgares=0, i,j=0, nbdays=0, nabbrev=0, nabdef=0, nbdir=0, num_colon=0, datawtn=0; char temp[LGMAXNOMGARE+1]={0}; int cur_record; *************** *** 262,265 **** --- 261,265 ---- if (num_colon < 4) { // Only for 2.0 Version PDB files. /* read Abbreviations List */ + datawtn = 0; for(;;) { c = fgetc(fd); *************** *** 268,271 **** --- 268,272 ---- if (c != '\n') { fwrite(&c,1,1,pdbfd); + datawtn = 1; } else { fwrite("\x0",1,1,pdbfd); *************** *** 273,277 **** } } ! nabbrev++; printf("%i abbreviations found\n",nabbrev); --- 274,278 ---- } } ! if (datawtn) nabbrev++; // Only if we wrote at lease /something/. printf("%i abbreviations found\n",nabbrev); *************** *** 282,285 **** --- 283,287 ---- /* read Abbreviations Definitions */ + datawtn = 0; for(;;) { c = fgetc(fd); *************** *** 288,291 **** --- 290,294 ---- if (c != '\n') { fwrite(&c,1,1,pdbfd); + datawtn = 1; } else { fwrite("\x0",1,1,pdbfd); *************** *** 293,297 **** } } ! nabdef++; if (nabbrev != nabdef) { --- 296,300 ---- } } ! if (datawtn) nabdef++; // Only if we wrote at lease /something/. if (nabbrev != nabdef) { *************** *** 381,385 **** // If no defined abbreviations, write a blank ! if ((c != ':') && (nabbrev == 1)) { fwrite("\x0",1,1,pdbfd); } --- 384,388 ---- // If no defined abbreviations, write a blank ! if ((c != ':') && (nabbrev == 0)) { fwrite("\x0",1,1,pdbfd); } |