diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2013-07-19 08:12:20 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2013-07-19 08:12:20 +0000 |
commit | 8a6e995d6c6cb7f0968a1203e816e5d8f4500931 (patch) | |
tree | fd9c106e0dbec67e8bfa738ebd5508caa05bb4a3 /usr.sbin/smtpd/util.c | |
parent | 812724ba80ed5f0b9efd1b86ad3ac00072b96f02 (diff) |
Introduce expand string modifiers
Diffstat (limited to 'usr.sbin/smtpd/util.c')
-rw-r--r-- | usr.sbin/smtpd/util.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c index 453706821ea..02c0055a0c1 100644 --- a/usr.sbin/smtpd/util.c +++ b/usr.sbin/smtpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.95 2013/07/19 07:37:29 eric Exp $ */ +/* $OpenBSD: util.c,v 1.96 2013/07/19 08:12:19 eric Exp $ */ /* * Copyright (c) 2000,2001 Markus Friedl. All rights reserved. @@ -596,6 +596,23 @@ lowercase(char *buf, const char *s, size_t len) return 1; } +int +uppercase(char *buf, const char *s, size_t len) +{ + if (len == 0) + return 0; + + if (strlcpy(buf, s, len) >= len) + return 0; + + while (*buf != '\0') { + *buf = toupper((int)*buf); + buf++; + } + + return 1; +} + void xlowercase(char *buf, const char *s, size_t len) { |