summaryrefslogtreecommitdiff
path: root/server/src/journal_commit.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/journal_commit.cc')
-rw-r--r--server/src/journal_commit.cc65
1 files changed, 4 insertions, 61 deletions
diff --git a/server/src/journal_commit.cc b/server/src/journal_commit.cc
index 56e7baf..9d76c8f 100644
--- a/server/src/journal_commit.cc
+++ b/server/src/journal_commit.cc
@@ -52,66 +52,6 @@
#include "template.h"
#include "templateparser.h"
-#if 0
-static inline bool iswhitespace(char c)
-{
- return c == ' ' || c == '\n' || c == '\t';
-}
-
-/**
- * Remove all spaces, tabs and newline trailing the string.
- */
-static std::string stripTrailingWhitepace(std::string str)
-{
- if(str == "") return str;
-
- ssize_t end = str.size() - 1;
-
- while(end && iswhitespace(str[end])
- && (end>0 && str[end-1] & 0x80) == false // Make sure we are not in a utf8 character.
- ) {
- end--;
- }
- end++;
-
- return str.substr(0, end);
-}
-
-/**
- * Find all lines longer than 'width', and insert a newline in the
- * first backward occurring space.
- */
-static std::string addNewlines(std::string str, size_t width)
-{
- std::string output;
-
- std::string fraction;
- size_t linelen = 0;
- for(size_t i = 0; i < str.size(); i++) {
-
- fraction += str[i];
-
- if(iswhitespace(str[i])
- && (i>0 && str[i-1] & 0x80) == false // Make sure we are not in a utf8 character.
- ) {
- if(linelen + fraction.size() > width) {
- output[output.size() - 1] = '\n';
- linelen = 0;
- }
- output += fraction;
- linelen += fraction.size();
- fraction = "";
- }
-
- if(str[i] == '\n') linelen = 0;
-
- }
- output += fraction;
-
- return output;
-}
-#endif
-
static int mwrite(int sock, const char *fmt, ...)
{
int l = 0;
@@ -125,7 +65,8 @@ static int mwrite(int sock, const char *fmt, ...)
va_end(args);
if(sock != -1 && write(sock, buffer, l) != l) {
- PRACRO_ERR_LOG(journal, "write did not write all the bytes in the buffer.\n");
+ PRACRO_ERR_LOG(journal,
+ "write did not write all the bytes in the buffer.\n");
}
PRACRO_DEBUG(journal, "%s", buffer);
@@ -173,6 +114,8 @@ int journal_commit(const char *cpr, const char *user,
perror(":");
return -1;
}
+#else
+ sock = open("/tmp/pracro_journal.log", O_CREAT | O_WRONLY | O_TRUNC);
#endif/*WITHOUT_UPLOADSERVER*/
// send header