The patch corrects several bugs reported to me via mail and on comp.text.tex. Also some functionality was added. * Corrected bug in selection of Standard vs. Normal Style reported by Doug L. Hoffman * Corrected bug of writing into strings in Error Message reported by Richard Kooijman * Corrected problems people had with SEEK_SET undefined * New rtf special characters bullet, emdash, endash, left double quote, right double quote, left quote, right quote are now translated. * New Options to use german versions of quotes with german.sty * New option to replace paired double quotes by appropriate left- and right quotes on output. * In Error messages the name of the program should now be printed. Index: r2L_version.h Prereq: 1.2 *** rtf2LaTeX.old/r2L_version.h Thu Apr 15 11:37:30 1993 --- rtf2LaTeX/r2L_version.h Mon Apr 26 11:24:16 1993 *************** *** 1,8 **** /* ! * $Id: r2L_version.h,v 1.2 1993/04/15 09:35:51 ralf Exp $ * This file gives the current version number for rtf2LaTeX * History: * $Log: r2L_version.h,v $ * Revision 1.2 1993/04/15 09:35:51 ralf * New revision with Paul DuBois changes (using 1.6a3) * Makefile has new features. --- 1,19 ---- /* ! * $Id: r2L_version.h,v 1.3 1993/04/26 09:15:38 ralf Exp $ * This file gives the current version number for rtf2LaTeX * History: * $Log: r2L_version.h,v $ + * Revision 1.3 1993/04/26 09:15:38 ralf + * Corrected bug in selection of Standard vs. Normal Style + * Corrected bug of writing into strings in Error Message + * Corrected problems people had with SEEK_SET undefined + * New rtf special characters bullet, emdash, endash, left double quote, + * right double quote, left quote, right quote are now translated. + * New Options to use german versions of quotes with german.sty + * New option to replace paired double quotes by appropriate left- and right + * quotes on output. + * In Error messages the name of the program should now be printed. + * * Revision 1.2 1993/04/15 09:35:51 ralf * New revision with Paul DuBois changes (using 1.6a3) * Makefile has new features. *************** *** 11,14 **** * Initial revision * */ ! static char *version = "Version $Revision: 1.2 $; $Date: 1993/04/15 09:35:51 $ $State: Exp $"; --- 22,25 ---- * Initial revision * */ ! static char *version = "Version $Revision: 1.3 $; $Date: 1993/04/26 09:15:38 $ $State: Exp $"; Index: INSTALL.2LaTeX *** /dev/null Mon Apr 26 11:28:35 1993 --- rtf2LaTeX/INSTALL.2LaTeX Mon Apr 26 11:24:21 1993 *************** *** 0 **** --- 1,8 ---- + - Copy Makefile.2LaTeX to Makefile + (on SysV this may be named Makefile.2LaTe ) + - Edit Makefile to suit your local needs + - make + - make install + - if you want a little test say + make test + (Must be installed before attempting this, sorry) Index: Makefile.2LaTeX *** rtf2LaTeX.old/Makefile.2LaTeX Thu Apr 15 11:37:10 1993 --- rtf2LaTeX/Makefile.2LaTeX Mon Apr 26 11:20:36 1993 *************** *** 13,19 **** SOURCES = rtf.h Makefile.2LaTeX fonts.h rtf2LaTeX.c r2L_version.h \ rtf2LaTeX.h reader.c SUPPORT = mac.code ansi.code english.land german.land ! DOCFILS = Copyright interna.tex README.2LaTeX interna.rtf rtf2LaTeX.man rtf2LaTeX: $(LATEXOBJS) $(CC) -o $@ $(LATEXOBJS) --- 13,20 ---- SOURCES = rtf.h Makefile.2LaTeX fonts.h rtf2LaTeX.c r2L_version.h \ rtf2LaTeX.h reader.c SUPPORT = mac.code ansi.code english.land german.land ! DOCFILS = Copyright interna.tex README.2LaTeX interna.rtf rtf2LaTeX.man \ ! INSTALL.2LaTeX rtf2LaTeX: $(LATEXOBJS) $(CC) -o $@ $(LATEXOBJS) Index: reader.c *** rtf2LaTeX.old/reader.c Thu Apr 15 10:38:49 1993 --- rtf2LaTeX/reader.c Mon Apr 26 11:24:20 1993 *************** *** 833,839 **** if (sp->rtfSNum < 0) { if (strncmp (buf, "Normal", 6) != 0 ! || strncmp (buf, "Standard", 8) != 0) Error ("SSErr - missing style number"); sp->rtfSNum = 0; } --- 833,839 ---- if (sp->rtfSNum < 0) { if (strncmp (buf, "Normal", 6) != 0 ! && strncmp (buf, "Standard", 8) != 0) Error ("SSErr - missing style number"); sp->rtfSNum = 0; } Index: rtf2LaTeX.c *** rtf2LaTeX.old/rtf2LaTeX.c Thu Apr 15 11:24:14 1993 --- rtf2LaTeX/rtf2LaTeX.c Mon Apr 26 11:24:15 1993 *************** *** 19,27 **** * 1/ This copyright notice is preserved * 2/ You send me a copy of any changes for inclusion in a future release */ - #include #include #include #include "fonts.h" #include "r2L_version.h" #include "rtf2LaTeX.h" --- 19,35 ---- * 1/ This copyright notice is preserved * 2/ You send me a copy of any changes for inclusion in a future release */ #include #include + #ifdef __STDC__ + # include + # include + #else /* !__STDC__ */ + # include + #endif /* !__STDC__ */ + #ifndef SEEK_SET + # define SEEK_SET 0 + #endif #include "fonts.h" #include "r2L_version.h" #include "rtf2LaTeX.h" *************** *** 28,33 **** --- 36,42 ---- #include "rtf.h" + char *progname; /* Used in Error messages */ RTFFuncPtr default_read_font = NULL; /* default func to read style table */ RTFFuncPtr default_read_style = NULL; /* default func to read style table */ /*****************************************************************************/ *************** *** 56,67 **** char codefile[20],landfile[20]; char *str = "12345.67"; strcpy(codefile,"mac"); strcpy(landfile,"english"); ! while((c = getopt(ac,av,"cC:dhHL:nprstT:uv:V")) != EOF) { switch (c) { case 'C': strcpy(codefile,optarg); break; --- 65,86 ---- char codefile[20],landfile[20]; char *str = "12345.67"; + progname = av[0]; strcpy(codefile,"mac"); strcpy(landfile,"english"); ! while((c = getopt(ac,av,"cC:dhgGHL:npqrstT:uv:V")) != EOF) { switch (c) { + case 'g': + german_squotes = 1; + break; + case 'G': + german_dquotes = 1; + break; + case 'q': + translate_quotes = 1; + break; case 'C': strcpy(codefile,optarg); break; *************** *** 99,105 **** smaller_cell_factor=atof(optarg); if (!(smaller_cell_factor > 0)) { ! fprintf(stderr,"\nrtf2LaTeX: the argument of the -T flag must be greater than 0,\n but it is %g\n",smaller_cell_factor); fprintf(stderr,"use -h for help\n"); exit(2); } --- 118,124 ---- smaller_cell_factor=atof(optarg); if (!(smaller_cell_factor > 0)) { ! fprintf(stderr,"\n%s: Argument of the -T flag must be greater than 0,\n but it is %g\n", progname, smaller_cell_factor); fprintf(stderr,"use -h for help\n"); exit(2); } *************** *** 111,127 **** verbose = atoi(optarg); if (verbose!=1 && verbose!=2) { ! fprintf(stderr,"\nrtf2LaTeX: The level of verbose can only be 1 or 2\n"); fprintf(stderr,"use -h for help\n"); exit(2); } break; case 'V': ! fprintf(stderr,"RTF2LaTeX: %s\n",version); exit(0); break; case '?': ! fprintf(stderr,"rtf2LaTeX: "); usage(); exit(2); } --- 130,146 ---- verbose = atoi(optarg); if (verbose!=1 && verbose!=2) { ! fprintf(stderr,"\n%s: The level of verbose can only be 1 or 2\n", progname); fprintf(stderr,"use -h for help\n"); exit(2); } break; case 'V': ! fprintf(stderr,"%s: %s\n",progname,version); exit(0); break; case '?': ! fprintf(stderr,"%s: ", progname); usage(); exit(2); } *************** *** 132,138 **** strcat(av[optind],".rtf"); if((fil = fopen(av[optind],"r")) == NULL) { ! fprintf(stderr,"Can't open %s\n",av[optind]); exit(1); } RTFSetStream(fil); --- 151,157 ---- strcat(av[optind],".rtf"); if((fil = fopen(av[optind],"r")) == NULL) { ! fprintf(stderr,"%s: Can't open %s\n",progname,av[optind]); exit(1); } RTFSetStream(fil); *************** *** 139,145 **** } if (optind+1= NTABS) { if(ntabs == NTABS) ! fprintf(stderr,"Attempt to set more than %d tabs\n",NTABS); } else { tabstops[ntabs++].pos = rtfParam; tabstops[ntabs].type = TabLeft; --- 1188,1195 ---- tab=1; if(ntabs >= NTABS) { if(ntabs == NTABS) ! fprintf(stderr,"%s: Attempt to set more than %d tabs\n", ! progname,NTABS); } else { tabstops[ntabs++].pos = rtfParam; tabstops[ntabs].type = TabLeft; *************** *** 1272,1279 **** break; } } ! /*****************************************************************************/ ! /* * Deal with Pict destinations */ static void --- 1340,1347 ---- break; } } ! /***************************************************************************** ! * * Deal with Pict destinations */ static void *************** *** 1281,1292 **** { static int count=0; if (verbose && count++==0) ! fprintf(stderr,"rtf2LaTeX doesn't support any picture-things yet; be patient\n"); if (verbose>1) msg_not_yet(rtfTextBuf+1); } ! /*****************************************************************************/ ! /* * Deal with things like footnote numbering and page numbers; things * that involve the headline or footline */ --- 1349,1361 ---- { static int count=0; if (verbose && count++==0) ! fprintf(stderr,"%s: Don't support any picture-things yet; be patient\n", ! progname); if (verbose>1) msg_not_yet(rtfTextBuf+1); } ! /***************************************************************************** ! * * Deal with things like footnote numbering and page numbers; things * that involve the headline or footline */ *************** *** 1295,1300 **** --- 1364,1370 ---- { int pageno_top = (pageno_y < paper_height/2 ? 1 : 0); if(!change_headfoot) return; + # ifdef notdef /* I think this is left over from rtf2tex */ /* * The headline first * *************** *** 1319,1327 **** output_str("}",'\n'); change_headfoot = 0; /* we've done it * */ } ! /*****************************************************************************/ ! /* * Convert the pageno to the desired form */ static char * --- 1389,1398 ---- output_str("}",'\n'); change_headfoot = 0; /* we've done it * */ + # endif /* notdef */ } ! /***************************************************************************** ! * * Convert the pageno to the desired form */ static char * *************** *** 1338,1345 **** return(""); } } ! /*****************************************************************************/ ! /* * This is called when we see the first text token after each \par */ #define CURRENT(WHAT) /* is WHAT up-to-date? */ \ --- 1409,1416 ---- return(""); } } ! /***************************************************************************** ! * * This is called when we see the first text token after each \par */ #define CURRENT(WHAT) /* is WHAT up-to-date? */ \ *************** *** 1380,1387 **** end_of_par = 0; (void)RTFSetClassCallback(rtfText, start_para); } ! /*****************************************************************************/ ! /* * Force an update of the current state, only emitting commands * that actually change anything. */ --- 1451,1458 ---- end_of_par = 0; (void)RTFSetClassCallback(rtfText, start_para); } ! /***************************************************************************** ! * * Force an update of the current state, only emitting commands * that actually change anything. */ *************** *** 1478,1485 **** rtf_current.LaTeX_stack = NULL; rtf_current.prev = NULL; } ! /*****************************************************************************/ ! /* * ALLDONE */ --- 1549,1556 ---- rtf_current.LaTeX_stack = NULL; rtf_current.prev = NULL; } ! /***************************************************************************** ! * * ALLDONE */ *************** *** 1618,1627 **** } /***************************************************************************** ! /* * Various ways of refusing to deal with a keyword * ! /* * Treat \from as \to (e.g. treat \ul as \i) */ static void --- 1689,1698 ---- } /***************************************************************************** ! * * Various ways of refusing to deal with a keyword * ! * * Treat \from as \to (e.g. treat \ul as \i) */ static void *************** *** 1654,1663 **** char *name; { static int pointer = 0; ! for (pointer=0;(name[pointer]!='\0' && isalpha(name[pointer]));pointer++) continue; ! name[pointer]='\0'; /*No argument will be printed*/ if(verbose && !writing_defs) { ! fprintf(stderr,"rtf2LaTeX doesn't support \\%s; sorry\n",name); } } /* --- 1725,1737 ---- char *name; { static int pointer = 0; ! for (pointer=0;(name[pointer]!='\0' && isalpha(name[pointer]));pointer++) ! continue; ! /* Should fix problem writing to string constants with gcc */ ! if(name[pointer] != '\0') ! name[pointer]='\0'; /*No argument will be printed*/ if(verbose && !writing_defs) { ! fprintf(stderr,"%s: Don't support \\%s; sorry\n",progname,name); } } /* *************** *** 1668,1674 **** char *name; { if(verbose && !writing_defs) { ! fprintf(stderr,"rtf2LaTeX doesn't support \\%s yet; be patient\n",name); } } --- 1742,1748 ---- char *name; { if(verbose && !writing_defs) { ! fprintf(stderr,"%s: Don't support \\%s yet; be patient\n",progname,name); } } *************** *** 1675,1682 **** ! /*****************************************************************************/ ! /* * Convert a string to a form that LaTeX can handle * * Remove spaces and capitalise the following letter, --- 1749,1756 ---- ! /***************************************************************************** ! * * Convert a string to a form that LaTeX can handle * * Remove spaces and capitalise the following letter, *************** *** 1713,1719 **** usage() { static char *msg[] = { - "Usage: rtf2LaTeX [options] [RTF-file]", "Your options are:", " -c No character formatting stuff", " -C file Use another translation-file for characters above 128", --- 1787,1792 ---- *************** *** 1738,1748 **** NULL, }; print_text(msg,stderr); } ! /*****************************************************************************/ ! /* * print some text MSG to a stream FIL */ static void --- 1811,1822 ---- NULL, }; + fprintf(stderr, "Usage: %s [options] [RTF-file]\n", progname); print_text(msg,stderr); } ! /***************************************************************************** ! * * print some text MSG to a stream FIL */ static void *************** *** 1757,1764 **** } } ! /*****************************************************************************/ ! /* * set a Font */ static void --- 1831,1838 ---- } } ! /***************************************************************************** ! * * set a Font */ static void *************** *** 1776,1783 **** } } ! /*****************************************************************************/ ! /* * change fontsize */ set_fontsize(fontsize) --- 1850,1857 ---- } } ! /***************************************************************************** ! * * change fontsize */ set_fontsize(fontsize) *************** *** 1858,1865 **** } ! /*****************************************************************************/ ! /* * set higher or lower text */ --- 1932,1939 ---- } ! /***************************************************************************** ! * * set higher or lower text */ *************** *** 1875,1881 **** { if(verbose) { ! fprintf(stderr,"Failed to find end of sub/superscript\n"); } return; } --- 1949,1956 ---- { if(verbose) { ! fprintf(stderr,"%s: Failed to find end of sub/superscript\n", ! progname); } return; } *************** *** 1905,1912 **** push_LaTeX_stack(" \\egroup",Sub_Super,rtfParam); } } ! /*****************************************************************************/ ! /* * set smallcaps */ --- 1980,1987 ---- push_LaTeX_stack(" \\egroup",Sub_Super,rtfParam); } } ! /***************************************************************************** ! * * set smallcaps */ *************** *** 1923,1930 **** output_str("\\sc ",'\0'); } ! /*****************************************************************************/ ! /* * Print a string, ensuring that we are in math mode at the time */ static void --- 1998,2005 ---- output_str("\\sc ",'\0'); } ! /***************************************************************************** ! * * Print a string, ensuring that we are in math mode at the time */ static void *************** *** 1936,1943 **** output('$',0); } ! /*****************************************************************************/ ! /* * Write a character, filling the the output text as we go. Characters * special to LaTeX are treated appropriately. */ --- 2011,2018 ---- output('$',0); } ! /***************************************************************************** ! * * Write a character, filling the the output text as we go. Characters * special to LaTeX are treated appropriately. */ *************** *** 1980,1988 **** str = (c < 128) ? symbol[c] : symbol8[c & '\177']; if(*str == '\0') { ! if(verbose) { ! fprintf(stderr,"Unknown Tech character: 0x%x\n",c); ! } } if(verbose) { fprintf(stderr,"A Tech character: 0x%x\n",c); --- 2055,2064 ---- str = (c < 128) ? symbol[c] : symbol8[c & '\177']; if(*str == '\0') { ! /* if(verbose) { */ ! fprintf(stderr,"%s: Unknown Tech character: 0x%x\n", ! progname,c); ! /* } */ } if(verbose) { fprintf(stderr,"A Tech character: 0x%x\n",c); *************** *** 2003,2010 **** output_str("$^{\\wedge}$",'\0'); return; case '"': ! fputc('`',stdout); ! c = '`'; column++; break; case '<': case '>': --- 2079,2089 ---- output_str("$^{\\wedge}$",'\0'); return; case '"': ! if(translate_quotes) ! c = (quotecount++ % 2) ? '\'' : '`'; ! else ! c = '`'; ! fputc(german_dquotes ? '"' : c, stdout); column++; break; case '<': case '>': *************** *** 2032,2038 **** if(!isalnum(c) && !ispunct(c)) { if (verbose) ! fprintf(stderr,"rtf2LaTeX: Unknown 7-bit character: 0x%x\n",c); return; } break; --- 2111,2118 ---- if(!isalnum(c) && !ispunct(c)) { if (verbose) ! fprintf(stderr,"%s: Unknown 7-bit character: 0x%x\n", ! progname,c); return; } break; *************** *** 2042,2049 **** fputc(c,stdout); column++; } ! /*****************************************************************************/ ! /* * Output an entire word, without trying to quote any special characters. * The character C is then output using output(), which allows proper page * breaks. --- 2122,2129 ---- fputc(c,stdout); column++; } ! /***************************************************************************** ! * * Output an entire word, without trying to quote any special characters. * The character C is then output using output(), which allows proper page * breaks. *************** *** 2072,2079 **** column=0; } ! /*****************************************************************************/ ! /* * Deal with special characters above \177. */ --- 2152,2159 ---- column=0; } ! /***************************************************************************** ! * * Deal with special characters above \177. */ *************** *** 2088,2095 **** char8 *help; ! /*****************************************************************************/ ! /* * write a 8bit character */ --- 2168,2175 ---- char8 *help; ! /***************************************************************************** ! * * write a 8bit character */ *************** *** 2112,2127 **** if(verbose) { static count=0; ! fprintf(stderr,"Unknown 8-bit character: 0x%x\n",c); if (count++<1||verbose>1) fprintf(stderr," Have a look in the file .cod\n"); } } } ! /*****************************************************************************/ ! /* * read the file mac.code (or an other file e.g. ansi.code: use flag -C) ! * and store the commands for characters with the 8bit set in the list "list_8bit" */ --- 2192,2208 ---- if(verbose) { static count=0; ! fprintf(stderr,"%s: Unknown 8-bit character: 0x%x\n",progname,c); if (count++<1||verbose>1) fprintf(stderr," Have a look in the file .cod\n"); } } } ! /***************************************************************************** ! * * read the file mac.code (or an other file e.g. ansi.code: use flag -C) ! * and store the commands for characters with the 8bit set in the list ! * "list_8bit" */ *************** *** 2136,2152 **** open_code_file(codefile); if (fgets(line,line_length,fpcode)==NULL) { ! fprintf(stderr,"\nincorrect file a8bit \ \nat first there must be a number of the ascii character with msb set \ ! \n(between 128 and 255)"); exit(1); } for (pos=23;line[pos]==' ';pos--); ! line[pos+1]='\0'; /* cut the commentar in the file*/ list_8bit=(struct Char8bit *)malloc((int)sizeof(struct Char8bit)); if (list_8bit==(struct Char8bit *)NULL) { ! fprintf(stderr,"TCErr - cannot allocate a 8bit-character name\n"); exit(1); } sscanf(line,"%d",&(list_8bit->nr)); --- 2217,2233 ---- open_code_file(codefile); if (fgets(line,line_length,fpcode)==NULL) { ! fprintf(stderr,"\n%s: Incorrect file a8bit \ \nat first there must be a number of the ascii character with msb set \ ! \n(between 128 and 255)\n",progname); exit(1); } for (pos=23;line[pos]==' ';pos--); ! line[pos+1]='\0'; /* cut the comment in the file*/ list_8bit=(struct Char8bit *)malloc((int)sizeof(struct Char8bit)); if (list_8bit==(struct Char8bit *)NULL) { ! fprintf(stderr,"%s: TCErr - cannot allocate a 8bit-character name\n", progname); exit(1); } sscanf(line,"%d",&(list_8bit->nr)); *************** *** 2153,2161 **** list_8bit->str=StrSave(line+4); if (list_8bit->nr<128 || list_8bit->nr>255) { ! fprintf(stderr,"\nincorrect file a8bit \ \nat first there must be a number of the ascii character with msb set \ ! \n(between 128 and 255)"); exit(1); } list_8bit->next=NULL; --- 2234,2242 ---- list_8bit->str=StrSave(line+4); if (list_8bit->nr<128 || list_8bit->nr>255) { ! fprintf(stderr,"\n%s: Incorrect file a8bit \ \nat first there must be a number of the ascii character with msb set \ ! \n(between 128 and 255)\n", progname); exit(1); } list_8bit->next=NULL; *************** *** 2166,2172 **** help=(struct Char8bit *)malloc((int)sizeof(struct Char8bit)); if (help==(struct Char8bit *)NULL) { ! fprintf(stderr,"SSErr - cannot allocate a 8bit-character name\n"); exit(1); } help->next=list_8bit; --- 2247,2253 ---- help=(struct Char8bit *)malloc((int)sizeof(struct Char8bit)); if (help==(struct Char8bit *)NULL) { ! fprintf(stderr,"%s: SSErr - cannot allocate a 8bit-character name\n", progname); exit(1); } help->next=list_8bit; *************** *** 2175,2183 **** list_8bit->str=StrSave(line+4); if (list_8bit->nr<128 || list_8bit->nr>255) { ! fprintf(stderr,"\nincorrect file a8bit \ \nat first there must be a number of the ascii character with msb set \ ! \n(between 128 and 255)"); exit(1); } } --- 2256,2264 ---- list_8bit->str=StrSave(line+4); if (list_8bit->nr<128 || list_8bit->nr>255) { ! fprintf(stderr,"\n%s: Incorrect file a8bit \ \nat first there must be a number of the ascii character with msb set \ ! \n(between 128 and 255)\n", progname); exit(1); } } *************** *** 2185,2201 **** } ! /*****************************************************************************/ ! /* * write an errormassage to stderr * */ static void p6(proc_name) ! char *proc_name; /*name of ther procedure where the mistake must be ! */ { ! fprintf(stderr," rtf2LaTeX: mistake in procedure %s\n",proc_name); fprintf(stderr," please call Erwin Wechtl\n"); fprintf(stderr," W""ortgasse 2/18\n"); fprintf(stderr," A-2500 Baden\n"); --- 2266,2281 ---- } ! /***************************************************************************** ! * * write an errormassage to stderr * */ static void p6(proc_name) ! char *proc_name; /*name of ther procedure where the mistake must be */ { ! fprintf(stderr," %s: Problem in procedure %s\n",progname,proc_name); fprintf(stderr," please call Erwin Wechtl\n"); fprintf(stderr," W""ortgasse 2/18\n"); fprintf(stderr," A-2500 Baden\n"); *************** *** 2203,2210 **** fprintf(stderr," Tel.: 43/2252/44686\n"); } ! /*****************************************************************************/ ! /* * set end af table */ --- 2283,2290 ---- fprintf(stderr," Tel.: 43/2252/44686\n"); } ! /***************************************************************************** ! * * set end af table */ *************** *** 2223,2230 **** } ! /*****************************************************************************/ ! /* * translate each RTF-style into a new LaTeX environment * and look for special WORD styles like heading (tranlated into section) * or footer (ignored) --- 2303,2310 ---- } ! /***************************************************************************** ! * * translate each RTF-style into a new LaTeX environment * and look for special WORD styles like heading (tranlated into section) * or footer (ignored) *************** *** 2244,2250 **** LaTeXstyle=(LATEXStyle *)malloc(sizeof(struct LATEXStyle)); if (LaTeXstyle==NULL) { ! fprintf(stderr,"\nrtf2LaTeX: can't alloc LaTeXstyle"); exit(1); } LaTeXstyle->stacktype=Undefined; --- 2324,2330 ---- LaTeXstyle=(LATEXStyle *)malloc(sizeof(struct LATEXStyle)); if (LaTeXstyle==NULL) { ! fprintf(stderr,"\n%s: Can't alloc LaTeXstyle\n",progname); exit(1); } LaTeXstyle->stacktype=Undefined; *************** *** 2296,2303 **** if (fpland!=NULL) fclose(fpland); } ! /*****************************************************************************/ ! /* * begin a style environment */ --- 2376,2383 ---- if (fpland!=NULL) fclose(fpland); } ! /***************************************************************************** ! * * begin a style environment */ *************** *** 2320,2327 **** rtfstyle=RTFGetStyle(n); if (verbose>1 || (verbose && count++==0)) { ! fprintf(stderr,"There are some troubles with the style %s with the number %d, \n so this style is ignored\n",rtfstyle->rtfSName,n); } /* sprintf(buf,"\n%% The Style %s with the number %d may begin here\n",rtfstyle->rtfSName,n); output_str(buf,'\0'); output_str("%%But rtf2LaTeX has had some troubles with it",'\0'); --- 2400,2409 ---- rtfstyle=RTFGetStyle(n); if (verbose>1 || (verbose && count++==0)) { ! fprintf(stderr,"%s: There are some troubles with the style %s with the number %d, \n so this style is ignored\n", ! progname,rtfstyle->rtfSName,n); } + # ifdef notdef /* Don't know if this is needed anymore */ /* sprintf(buf,"\n%% The Style %s with the number %d may begin here\n",rtfstyle->rtfSName,n); output_str(buf,'\0'); output_str("%%But rtf2LaTeX has had some troubles with it",'\0'); *************** *** 2328,2333 **** --- 2410,2416 ---- sprintf(buf,"\n% The Style %s with the number %d may end here\n",rtfstyle->rtfSName,n); push_LaTeX_stack(buf,NormalWORDstyle,0); */ + # endif /* notdef */ return; } if (LaTeXstyle->special_WinwordStyle) /* if heading,footer, ... */ *************** *** 2350,2358 **** push_LaTeX_stack(LaTeXstyle->EndCommand,LaTeXstyle->stacktype,0); } ! /*****************************************************************************/ ! /* ! * look in the file english.land (or an other file e.g. german.land: use flag -L) * if this is a Spezial WORD style like heading, footer, ... */ --- 2433,2442 ---- push_LaTeX_stack(LaTeXstyle->EndCommand,LaTeXstyle->stacktype,0); } ! /***************************************************************************** ! * ! * look in the file english.land (or an other file e.g. german.land: ! * use flag -L) * if this is a Spezial WORD style like heading, footer, ... */ *************** *** 2385,2392 **** return(0); } ! /*****************************************************************************/ ! /* * malloc for a string */ --- 2469,2476 ---- return(0); } ! /***************************************************************************** ! * * malloc for a string */ *************** *** 2397,2409 **** char *p; if ((p = (char *)malloc (strlen (s) + 1)) == (char *) NULL) ! fprintf(stderr,"malloc\n"); return (strcpy (p, s)); } ! /*****************************************************************************/ ! /* * set the position of the Tabstops and output the begin environment */ --- 2481,2493 ---- char *p; if ((p = (char *)malloc (strlen (s) + 1)) == (char *) NULL) ! fprintf(stderr,"%s: Error in malloc\n",progname); return (strcpy (p, s)); } ! /***************************************************************************** ! * * set the position of the Tabstops and output the begin environment */ *************** *** 2441,2448 **** tab=2; } ! /*****************************************************************************/ ! /* * initialise the array of the Tabstops-positions */ --- 2525,2532 ---- tab=2; } ! /***************************************************************************** ! * * initialise the array of the Tabstops-positions */ *************** *** 2459,2466 **** ntabs=0; } ! /*****************************************************************************/ ! /* * Stack stuff -- RTF and LaTeX grouping go on separate stacks * * pop the status stack, putting the free'd element on the free list --- 2543,2550 ---- ntabs=0; } ! /***************************************************************************** ! * * Stack stuff -- RTF and LaTeX grouping go on separate stacks * * pop the status stack, putting the free'd element on the free list *************** *** 2472,2478 **** RTF_STACK *temp; if(rtf_ptr->prev == NULL) { ! fprintf(stderr,"Attempt to pop an empty stack\n"); abort(); } temp = rtf_ptr->prev; --- 2556,2562 ---- RTF_STACK *temp; if(rtf_ptr->prev == NULL) { ! fprintf(stderr,"%s: Attempt to pop an empty stack\n", progname); abort(); } temp = rtf_ptr->prev; *************** *** 2493,2499 **** rtf_free_list = rtf_free_list->prev; } else { if((temp = (RTF_STACK *)malloc(sizeof(RTF_STACK))) == NULL) { ! fprintf(stderr,"Can't allocate storage for stack\n"); exit(1); } } --- 2577,2583 ---- rtf_free_list = rtf_free_list->prev; } else { if((temp = (RTF_STACK *)malloc(sizeof(RTF_STACK))) == NULL) { ! fprintf(stderr,"%s: Can't allocate storage for stack\n",progname); exit(1); } } *************** *** 2502,2509 **** rtf_ptr = temp; rtf_ptr->LaTeX_stack = NULL; } ! /*****************************************************************************/ ! /* * Now the LaTeX stacks. Use the stack in the current rtf_ptr frame */ static LATEX_STACK *myTeX_free_list = NULL; --- 2586,2593 ---- rtf_ptr = temp; rtf_ptr->LaTeX_stack = NULL; } ! /***************************************************************************** ! * * Now the LaTeX stacks. Use the stack in the current rtf_ptr frame */ static LATEX_STACK *myTeX_free_list = NULL; *************** *** 2546,2552 **** myTeX_free_list = myTeX_free_list->prev; } else { if((temp = (LATEX_STACK *)malloc(sizeof(LATEX_STACK))) == NULL) { ! fprintf(stderr,"Can't allocate storage for stack\n"); exit(1); } } --- 2630,2636 ---- myTeX_free_list = myTeX_free_list->prev; } else { if((temp = (LATEX_STACK *)malloc(sizeof(LATEX_STACK))) == NULL) { ! fprintf(stderr,"%s: Can't allocate storage for stack\n",progname); exit(1); } } *************** *** 2558,2565 **** rtf_ptr->LaTeX_stack->flags = flags; return; } ! /*****************************************************************************/ ! /* * Return the flags of the proper type for the top element of the LaTeX stack */ int --- 2642,2649 ---- rtf_ptr->LaTeX_stack->flags = flags; return; } ! /***************************************************************************** ! * * Return the flags of the proper type for the top element of the LaTeX stack */ int *************** *** 2586,2598 **** strcat(filename,".code"); if((fpcode = fopen(filename,"r")) == NULL) { ! fprintf(stderr,"Can't open %s\n",filename); exit(1); } if (fgets(line,line_length,fpcode)==NULL) { ! fprintf(stderr,"\nincorrect file a8bit \ ! \nthere must be a commentar in the first line\n"); exit(1); } } --- 2670,2683 ---- strcat(filename,".code"); if((fpcode = fopen(filename,"r")) == NULL) { ! fprintf(stderr,"%s: Can't open %s\n",progname,filename); exit(1); } if (fgets(line,line_length,fpcode)==NULL) { ! fprintf(stderr,"\n%s: Incorrect file a8bit \ ! \nthere must be a comment in the first line\n", ! progname); exit(1); } } *************** *** 2606,2612 **** if ((strchr(landfile,'.')) == NULL) strcat(filename,".land"); if((fpland = fopen(filename,"r")) == NULL) { ! fprintf(stderr,"Can't open %s\n",filename); exit(1); } } --- 2691,2697 ---- if ((strchr(landfile,'.')) == NULL) strcat(filename,".land"); if((fpland = fopen(filename,"r")) == NULL) { ! fprintf(stderr,"%s: Can't open %s\n",progname,filename); exit(1); } } Index: rtf2LaTeX.h *** rtf2LaTeX.old/rtf2LaTeX.h Tue Apr 13 12:04:25 1993 --- rtf2LaTeX/rtf2LaTeX.h Mon Apr 26 11:24:17 1993 *************** *** 294,300 **** static int text_out = 0; /* we are actually writing text */ static int LaTeX_group = 0; /* level of RTF grouping */ static int writing_defs = 0; /* are we writing macro definitions? */ ! #define line_length 255 /* the parameter for fgets */ static void read_code_file(); /* file with the characters above 128 */ --- 294,305 ---- static int text_out = 0; /* we are actually writing text */ static int LaTeX_group = 0; /* level of RTF grouping */ static int writing_defs = 0; /* are we writing macro definitions? */ ! static int german_squotes =0; /* German single quotes on output ? */ ! static int german_dquotes =0; /* German double quotes on output ? */ ! static int quotecount =0; /* Count doublequotes if next true */ ! static int translate_quotes =0; /* Translate doublequotes to ! * alternating begin and end quotes ! */ #define line_length 255 /* the parameter for fgets */ static void read_code_file(); /* file with the characters above 128 */ Index: rtf2LaTeX.man *** rtf2LaTeX.old/rtf2LaTeX.man Tue Apr 13 12:04:26 1993 --- rtf2LaTeX/rtf2LaTeX.man Mon Apr 26 11:21:34 1993 *************** *** 13,18 **** --- 13,24 ---- .B \-d ] [ + .B \-g + ] + [ + .B \-G + ] + [ .B \-h ] [ *************** *** 25,30 **** --- 31,39 ---- .B \-p ] [ + .B \-q + ] + [ .B \-r ] [ *************** *** 100,105 **** --- 109,126 ---- footnotes, header, etc. .TP + .B \-g + Generate german single quotes (this needs + the style option german.sty by H. Partl available on the net) + instead of the english version of single quotes. + + .TP + .B \-G + Generate german double quotes (this needs + the style option german.sty by H. Partl available on the net) + instead of the english version of double quotes. + + .TP .B \-h Print a summary of your options. *************** *** 145,150 **** --- 166,179 ---- .TP .B \-p Generate LaTeX-file without paragraph-formatting. + + .TP + .B \-q + Count double quotes and replace every second quote with a closing quote + on output. This is useful if you entered only one sort of quotes in the + document and you are sure that you did't forget quotes. Warning: this + option will almost certainly produce junk if the document contains left and + right double quotes. .TP .B \-r