summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/relayd.c
diff options
context:
space:
mode:
authorPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-10-02 21:04:14 +0000
committerPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-10-02 21:04:14 +0000
commita86c5bc9bd4af827a0028e48843b2799471dd027 (patch)
tree9b76e922ccf0cd29e2a1170a74621bc51bb4e294 /usr.sbin/relayd/relayd.c
parent961d9e3f56705e98393e7bb848303dbb69074fbd (diff)
stop messing with lgetc to please hoststated's check/expect.
instead move some of the logic in yylex and do hoststated specific translations into hoststated.c ok gilles@
Diffstat (limited to 'usr.sbin/relayd/relayd.c')
-rw-r--r--usr.sbin/relayd/relayd.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c
index 15c0d3b948b..766654c1fcb 100644
--- a/usr.sbin/relayd/relayd.c
+++ b/usr.sbin/relayd/relayd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.c,v 1.41 2007/09/28 20:23:38 pyr Exp $ */
+/* $OpenBSD: relayd.c,v 1.42 2007/10/02 21:04:13 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -849,3 +849,31 @@ expand_string(char *label, size_t len, const char *srch, const char *repl)
return (0);
}
+
+void
+translate_string(char *str)
+{
+ char *reader;
+ char *writer;
+
+ reader = writer = str;
+
+ while (*reader) {
+ if (*reader == '\\') {
+ reader++;
+ switch (*reader) {
+ case 'n':
+ *writer++ = '\n';
+ break;
+ case 'r':
+ *writer++ = '\r';
+ break;
+ default:
+ *writer++ = *reader;
+ }
+ } else
+ *writer++ = *reader;
+ reader++;
+ }
+ *writer = '\0';
+}