2 * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
4 * Copyright (c) 1997 Eric P. Allman. All rights reserved.
5 * Copyright (c) 1988, 1993
6 * The Regents of the University of California. All rights reserved.
8 * By using this file, you agree to the terms and conditions set
9 * forth in the LICENSE file which can be found at the top level of
10 * the sendmail distribution.
16 SM_RCSID("@(#)$Id: snprintf.c,v 8.44 2001/09/11 04:04:56 gshapiro Exp $")
19 ** SHORTENSTRING -- return short version of a string
21 ** If the string is already short, just return it. If it is too
22 ** long, return the head and tail of the string.
25 ** s -- the string to shorten.
26 ** m -- the max length of the string (strlen()).
29 ** Either s or a short version of s.
34 register const char *s
;
38 static char buf
[MAXSHORTSTR
+ 1];
49 (void) sm_strlcpy(buf
, s
, m
+ 1);
52 (void) sm_strlcpy(buf
, s
, m
- 2);
53 (void) sm_strlcat(buf
, "...", sizeof buf
);
57 (void) sm_strlcpy(buf
, s
, m
+ 1);
58 (void) sm_strlcat2(buf
, "...", s
+ l
- m
, sizeof buf
);