summaryrefslogtreecommitdiff
path: root/src/qsutil.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:52:39 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:52:39 +0200
commita6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f (patch)
treeb88cc7a8457658d67e0321718556ac807f6bccf3 /src/qsutil.c
parent00be7622c428f279872f84569f098ce16150f8a8 (diff)
format files
Diffstat (limited to 'src/qsutil.c')
-rw-r--r--src/qsutil.c73
1 files changed, 37 insertions, 36 deletions
diff --git a/src/qsutil.c b/src/qsutil.c
index 9c438ea..1d3c9c3 100644
--- a/src/qsutil.c
+++ b/src/qsutil.c
@@ -1,64 +1,66 @@
+#include "qsutil.h"
+
#include <unistd.h>
-#include "stralloc.h"
+
#include "buffer.h"
-#include "qsutil.h"
+#include "stralloc.h"
static stralloc foo = {0};
static char errbuf[1];
-static struct buffer be = BUFFER_INIT(write,0,errbuf,1);
+static struct buffer be = BUFFER_INIT(write, 0, errbuf, 1);
-void logsa(stralloc *sa)
+void logsa(stralloc *sa)
{
- buffer_putflush(&be,sa->s,sa->len);
+ buffer_putflush(&be, sa->s, sa->len);
}
-void log1s(char *s1)
+void log1s(char *s1)
{
- buffer_putsflush(&be,s1);
+ buffer_putsflush(&be, s1);
}
-void log2s(char *s1,char *s2)
+void log2s(char *s1, char *s2)
{
- buffer_putsflush(&be,s1);
- buffer_putsflush(&be,s2);
+ buffer_putsflush(&be, s1);
+ buffer_putsflush(&be, s2);
}
-void log3s(char *s1,char *s2,char *s3)
+void log3s(char *s1, char *s2, char *s3)
{
- buffer_putsflush(&be,s1);
- buffer_putsflush(&be,s2);
- buffer_putsflush(&be,s3);
+ buffer_putsflush(&be, s1);
+ buffer_putsflush(&be, s2);
+ buffer_putsflush(&be, s3);
}
-void log4s(char *s1,char *s2,char *s3,char *s4)
+void log4s(char *s1, char *s2, char *s3, char *s4)
{
- buffer_putsflush(&be,s1);
- buffer_putsflush(&be,s2);
- buffer_putsflush(&be,s3);
- buffer_putsflush(&be,s4);
+ buffer_putsflush(&be, s1);
+ buffer_putsflush(&be, s2);
+ buffer_putsflush(&be, s3);
+ buffer_putsflush(&be, s4);
}
-void log5s(char *s1,char *s2,char *s3,char *s4,char *s5)
+void log5s(char *s1, char *s2, char *s3, char *s4, char *s5)
{
- buffer_putsflush(&be,s1);
- buffer_putsflush(&be,s2);
- buffer_putsflush(&be,s3);
- buffer_putsflush(&be,s4);
- buffer_putsflush(&be,s5);
+ buffer_putsflush(&be, s1);
+ buffer_putsflush(&be, s2);
+ buffer_putsflush(&be, s3);
+ buffer_putsflush(&be, s4);
+ buffer_putsflush(&be, s5);
}
-void nomem()
-{
- log1s("alert: out of memory, sleeping...\n");
- sleep(10);
+void nomem()
+{
+ log1s("alert: out of memory, sleeping...\n");
+ sleep(10);
}
void pausedir(char *dir)
-{
- log3s("alert: unable to opendir ",dir,", sleeping...\n");
- sleep(10);
+{
+ log3s("alert: unable to opendir ", dir, ", sleeping...\n");
+ sleep(10);
}
int issafe(char ch)
@@ -73,13 +75,12 @@ void logsafe(char *s)
{
int i;
- while (!stralloc_copys(&foo,s)) nomem();
+ while (!stralloc_copys(&foo, s)) nomem();
for (i = 0; i < foo.len; ++i)
if (foo.s[i] == '\n')
foo.s[i] = '/';
- else
- if (!issafe(foo.s[i]))
- foo.s[i] = '_';
+ else if (!issafe(foo.s[i]))
+ foo.s[i] = '_';
logsa(&foo);
}