summaryrefslogtreecommitdiff
path: root/pages.h
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2019-12-28 01:39:10 +1030
committerDaniel Jones <admin@danieljon.es>2019-12-28 01:39:10 +1030
commit39b4a8695a0e357e3f4a65e290cf3a3c1ca39b82 (patch)
tree797a0b055633105eb275a89a859fc54397e78959 /pages.h
parent61cdc43efe23719c9713ee3ae87818d7b9f2699d (diff)
downloadwebsitegenerator-39b4a8695a0e357e3f4a65e290cf3a3c1ca39b82.tar.gz
websitegenerator-39b4a8695a0e357e3f4a65e290cf3a3c1ca39b82.zip
removed ugly createtmpfile() hack
now instead use a struct that either has a filename or string to write into the file. do whichever is appropriate
Diffstat (limited to 'pages.h')
-rw-r--r--pages.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/pages.h b/pages.h
index e141376..3c34d98 100644
--- a/pages.h
+++ b/pages.h
@@ -21,12 +21,18 @@
#include <unistd.h>
#include <sys/stat.h>
+struct fileorstring
+{
+ const char *file;
+ const char *str;
+};
+
/* helpers */
int createfile(const char *file);
long findstring(const char *file, const char *str);
int deletebytes(const char *file, long offset, size_t bytes);
-int writefileatbyte(const char *dest, const char *source, long offset);
-int replaceinpage(const char *outfile, const char *toreplace, const char *infile);
+int writeatbyte(const char *dest, struct fileorstring *source, long offset);
+int replaceinpage(const char *outfile, const char *toreplace, struct fileorstring *source);
char *gettime();
int createtmpfile(const char *name, const char *content, size_t size);