projects
/
biaweb2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Separated the strings used for document tree generation from code
[biaweb2.git]
/
biawebutil.hpp
diff --git
a/biawebutil.hpp
b/biawebutil.hpp
index
ee6cd5a
..
c8603ea
100644
(file)
--- a/
biawebutil.hpp
+++ b/
biawebutil.hpp
@@
-23,16
+23,19
@@
namespace biaweb {
// till a cleaner solution can be found.
MMIOT *doc;
doc = mkd_string (str.c_str(), str.size(), 0);
// till a cleaner solution can be found.
MMIOT *doc;
doc = mkd_string (str.c_str(), str.size(), 0);
- FILE *f = fopen (".biaweb.tmp", "w");
+ char tempfile[20];
+ strcpy (tempfile, "/tmp/biawebXXXXXX");
+ int fd = mkstemp (tempfile);
+ FILE *f = fdopen (fd, "w");
markdown (doc, f, 0);
fclose (f);
markdown (doc, f, 0);
fclose (f);
- std::ifstream ftmp (
".biaweb.tmp"
);
+ std::ifstream ftmp (
tempfile
);
std::string tmpl ( (std::istreambuf_iterator<char> (ftmp)),
(std::istreambuf_iterator<char> ())
);
ftmp.close ();
mkd_cleanup (doc);
std::string tmpl ( (std::istreambuf_iterator<char> (ftmp)),
(std::istreambuf_iterator<char> ())
);
ftmp.close ();
mkd_cleanup (doc);
- remove (
".biaweb.tmp"
);
+ remove (
tempfile
);
return tmpl;
}
return tmpl;
}