From 0bdf849ecd8d539165dc5fd7a811992ec2b78658 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 26 Oct 1999 23:33:30 +0000 Subject: [PATCH] subst fixes git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@255 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 39 +++++++++++++++++++++++++++++++++------ src/LyXSendto.C | 2 +- src/buffer.C | 2 +- src/insets/insetbib.C | 9 ++++++--- src/insets/insetinclude.C | 4 ++-- src/layout.C | 6 ++---- src/lyx_cb.C | 11 ++++------- src/lyx_main.C | 4 ++-- src/lyx_sendfax_main.C | 12 ++++++------ src/support/filetools.C | 11 +++++------ 10 files changed, 62 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91325f217b..25e038603b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +1999-10-27 Lars Gullik Bjønnes + + * src/support/filetools.C (CleanupPath): subst fix + + * src/insets/insetbib.C (delDatabase): subst fix, this looks + _really_ weird. + + * src/support/filetools.C (PutEnvPath): subst fix, how come nobody + complained about this one? + + * src/insets/insetinclude.C (Latex): subst fix + + * src/insets/insetbib.C (getKeys): subst fix + + * src/LyXSendto.C (SendtoApplyCB): subst fix + + * src/lyx_main.C (init): subst fix + + * src/layout.C (Read): subst fix + + * src/lyx_sendfax_main.C (button_send): subst fix + + * src/buffer.C (RoffAsciiTable): subst fix + + * src/lyx_cb.C (MenuFax): subst fix + (PrintApplyCB): subst fix + +1999-10-26 Lars Gullik Bjønnes + + * development/lyx.spec.in (%build): add CFLAGS also. + + * src/screen.C (drawFrame): removed another warning. + 1999-10-25 Jean-Marc Lasgouttes * renamed WHATSNEW to NEWS (usual GNU style), CHANGES to @@ -9,12 +42,6 @@ unbreakable if we are in freespacing mode (LyX-Code), but not in latex mode. -1999-10-26 Lars Gullik Bjønnes - - * development/lyx.spec.in (%build): add CFLAGS also. - - * src/screen.C (drawFrame): removed another warning. - 1999-10-25 Lars Gullik Bjønnes * src/BackStack.h: fixed initialization order in constructor diff --git a/src/LyXSendto.C b/src/LyXSendto.C index 2c95a3089b..34285484e6 100644 --- a/src/LyXSendto.C +++ b/src/LyXSendto.C @@ -82,7 +82,7 @@ void SendtoApplyCB(FL_OBJECT *, long) ftypeext, true)); if (!contains(command, "$$FName")) command = "( " + command + " ) <$$FName"; - subst(command, "$$FName",fname); + command = subst(command, "$$FName",fname); command += " &"; // execute in background // push directorypath, if necessary string path = OnlyPath(buffer->getFileName()); diff --git a/src/buffer.C b/src/buffer.C index 93894891c2..d7cd5a4c06 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -3539,7 +3539,7 @@ void Buffer::RoffAsciiTable(FILE *file, LyXParagraph *par) par->table->RoffEndOfCell(fp, cell); fclose(fp); string cmd = lyxrc->ascii_roff_command + " >" + fname2; - subst(cmd, "$$FName",fname1); + cmd = subst(cmd, "$$FName", fname1); Systemcalls one(Systemcalls::System, cmd); if (!(lyxerr.debugging(Debug::ROFF))) { remove(fname1.c_str()); diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C index 7b28381712..c95b013648 100644 --- a/src/insets/insetbib.C +++ b/src/insets/insetbib.C @@ -408,8 +408,10 @@ string InsetBibtex::getKeys() // At end of each line check if line begins with '@' if ( c == '\n') { if (prefixIs(linebuf, "@") ) { - subst(linebuf, '{','('); - linebuf=split(linebuf, tmp,'('); + linebuf = subst(linebuf, + '{', '('); + linebuf = split(linebuf, + tmp, '('); tmp = lowercase(tmp); if (!prefixIs(tmp, "@string") && !prefixIs(tmp, "@preamble") ) { linebuf = split(linebuf, tmp,','); @@ -470,9 +472,10 @@ bool InsetBibtex::delDatabase(string const &db) string bd = db; int n = tokenPos(contents, ',', bd); if (n > 0) { + // Weird code, would someone care to explain this?(Lgb) string tmp(","); tmp += bd; - subst(contents, tmp.c_str(), ","); + contents = subst(contents, tmp.c_str(), ","); } else if (n==0) contents = split(contents, bd, ','); else diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 554ae2a3cb..283eb0a1f1 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -352,9 +352,9 @@ int InsetInclude::Latex(string &file, signed char /*fragile*/) writefile = ChangeExtension(getFileName(), ".tex", false); if (!master->tmppath.empty() && !master->niceFile) { - subst(incfile, '/','@'); + incfile = subst(incfile, '/','@'); #ifdef __EMX__ - subst(incfile, ':', '$'); + incfile = subst(incfile, ':', '$'); #endif writefile = AddName(master->tmppath, incfile); } else diff --git a/src/layout.C b/src/layout.C index 9de9933f24..7c73af5362 100644 --- a/src/layout.C +++ b/src/layout.C @@ -523,8 +523,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXLayoutList * list) case LT_LABELSEP: /* label separator */ if (lexrc.next()) { - labelsep = lexrc.GetString(); - subst(labelsep, 'x', ' '); + labelsep = subst(lexrc.GetString(), 'x', ' '); } break; @@ -882,10 +881,9 @@ int LyXTextClass::Read (string const &filename, LyXLayoutList *list) case LT_STYLE: if (lexrc.next()) { - string name = lexrc.GetString(); bool is_new = false; - subst(name, '_',' '); + string name = subst(lexrc.GetString(), '_', ' '); tmpl = l->GetLayout(name); if (!tmpl) { is_new = true; diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 5a6679495e..fdb155bbd5 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -757,8 +757,7 @@ void MenuFax(Buffer *buffer) } Path p(path); if (!lyxrc->fax_program.empty()) { - string help2 = lyxrc->fax_program; - subst(help2, "$$FName",ps); + string help2 = subst(lyxrc->fax_program, "$$FName", ps); help2 += " &"; Systemcalls one(Systemcalls::System, help2); } else @@ -3286,11 +3285,9 @@ extern "C" void PrintApplyCB(FL_OBJECT *, long) // Changes by Stephan Witt (stephan.witt@beusen.de), 19-Jan-99 // User may give a page (range) list // User may print multiple (unsorted) copies - string pages = fl_get_input(fd_form_print->input_pages); - subst(pages, ';',','); - subst(pages, '+',','); - pages = strip (pages) ; - pages = frontStrip (pages) ; + string pages = subst(fl_get_input(fd_form_print->input_pages), ';',','); + pages = subst(pages, '+',','); + pages = frontStrip(strip(pages)) ; while (!pages.empty()) { // a page range was given string piece ; pages = split (pages, piece, ',') ; diff --git a/src/lyx_main.C b/src/lyx_main.C index 68402565ec..53113e06d8 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -158,8 +158,8 @@ void LyX::init(int */*argc*/, char **argv) // Determine path of binary // - string fullbinpath, binpath = argv[0]; - subst(binpath, '\\', '/'); + string fullbinpath; + string binpath = subst(argv[0], '\\', '/'); string binname = OnlyFilename(argv[0]); // Sorry for system specific code. (SMiyata) if (suffixIs(binname, ".exe")) binname.erase(binname.length()-4, string::npos); diff --git a/src/lyx_sendfax_main.C b/src/lyx_sendfax_main.C index 1939dfd652..e497427032 100644 --- a/src/lyx_sendfax_main.C +++ b/src/lyx_sendfax_main.C @@ -115,12 +115,12 @@ bool button_send(string const &fname, string const &sendcmd) cmd = sendcmd + " >"; cmd += logfile + " 2>"; cmd += logfile; - subst(cmd, "$$Host",host); - subst(cmd, "$$Comment",comment); - subst(cmd, "$$Enterprise",enterprise); - subst(cmd, "$$Name",name); - subst(cmd, "$$Phone",phone); - subst(cmd, "$$FName",fname); + cmd = subst(cmd, "$$Host", host); + cmd = subst(cmd, "$$Comment", comment); + cmd = subst(cmd, "$$Enterprise", enterprise); + cmd = subst(cmd, "$$Name", name); + cmd = subst(cmd, "$$Phone", phone); + cmd = subst(cmd, "$$FName", fname); lyxerr << "CMD: " << cmd << endl; Systemcalls one(Systemcalls::System, cmd); show_logfile(logfile,false); diff --git a/src/support/filetools.C b/src/support/filetools.C index 460020c888..0057188406 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -79,7 +79,7 @@ string SpaceLess(string const & file) string temp = AddName(path, name); // Replace spaces with underscores, also in directory // No!!! I checked it that it is not necessary. - // temp.subst(' ','_'); + // temp = subst(temp, ' ', '_'); return temp; } @@ -331,8 +331,8 @@ bool PutEnvPath(string const & envstr) string pathlist = envstr; #warning Verify that this is correct. #ifdef __EMX__ - pathlist.subst(':', ';'); - pathlist.subst('/', '\\'); + pathlist = subst(pathlist, ':', ';'); + pathlist = subst(pathlist, '/', '\\'); #endif return PutEnv(pathlist); } @@ -690,9 +690,8 @@ string NormalizePath(string const & path) string CleanupPath(string const & path) { #ifdef __EMX__ /* SMiyata: This should fix searchpath bug. */ - string temppath(path); - subst(tmppath, '\\', '/'); - subst(tmppath, "//", "/"); + string temppath = subst(path, '\\', '/'); + temppath = subst(temppath, "//", "/"); return lowercase(temppath); #else // On unix, nothing to do return path; -- 2.39.2