summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/libsmutil/snprintf.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2008-08-28 02:25:51 +0000
committerpeter <peter@FreeBSD.org>2008-08-28 02:25:51 +0000
commitea50d71feb02a78d4d5fa746a26ca7ddc6e8cb19 (patch)
treedaf40952cf309641cc6c7d987989fd2abce2d758 /contrib/sendmail/libsmutil/snprintf.c
parenta2b986fa722f9860a6c56bb5cc724b7e2937d1b7 (diff)
downloadFreeBSD-src-ea50d71feb02a78d4d5fa746a26ca7ddc6e8cb19.zip
FreeBSD-src-ea50d71feb02a78d4d5fa746a26ca7ddc6e8cb19.tar.gz
Stage 1 of sendmail dist tree flattening. contrib/sendmail/contrib
prevents doing this in one pass.
Diffstat (limited to 'contrib/sendmail/libsmutil/snprintf.c')
-rw-r--r--contrib/sendmail/libsmutil/snprintf.c60
1 files changed, 0 insertions, 60 deletions
diff --git a/contrib/sendmail/libsmutil/snprintf.c b/contrib/sendmail/libsmutil/snprintf.c
deleted file mode 100644
index ff3aa3b..0000000
--- a/contrib/sendmail/libsmutil/snprintf.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
- * All rights reserved.
- * Copyright (c) 1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * By using this file, you agree to the terms and conditions set
- * forth in the LICENSE file which can be found at the top level of
- * the sendmail distribution.
- *
- */
-
-#include <sendmail.h>
-
-SM_RCSID("@(#)$Id: snprintf.c,v 8.44 2001/09/11 04:04:56 gshapiro Exp $")
-
-/*
-** SHORTENSTRING -- return short version of a string
-**
-** If the string is already short, just return it. If it is too
-** long, return the head and tail of the string.
-**
-** Parameters:
-** s -- the string to shorten.
-** m -- the max length of the string (strlen()).
-**
-** Returns:
-** Either s or a short version of s.
-*/
-
-char *
-shortenstring(s, m)
- register const char *s;
- size_t m;
-{
- size_t l;
- static char buf[MAXSHORTSTR + 1];
-
- l = strlen(s);
- if (l < m)
- return (char *) s;
- if (m > MAXSHORTSTR)
- m = MAXSHORTSTR;
- else if (m < 10)
- {
- if (m < 5)
- {
- (void) sm_strlcpy(buf, s, m + 1);
- return buf;
- }
- (void) sm_strlcpy(buf, s, m - 2);
- (void) sm_strlcat(buf, "...", sizeof buf);
- return buf;
- }
- m = (m - 3) / 2;
- (void) sm_strlcpy(buf, s, m + 1);
- (void) sm_strlcat2(buf, "...", s + l - m, sizeof buf);
- return buf;
-}
OpenPOWER on IntegriCloud