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.
14 #pragma ident "%Z%%M% %I% %E% SMI"
18 SM_RCSID("@(#)$Id: snprintf.c,v 8.41 2001/08/28 23:07:01 gshapiro Exp $")
21 ** SHORTENSTRING -- return short version of a string
23 ** If the string is already short, just return it. If it is too
24 ** long, return the head and tail of the string.
27 ** s -- the string to shorten.
28 ** m -- the max length of the string (strlen()).
31 ** Either s or a short version of s.
36 register const char *s
;
40 static char buf
[MAXSHORTSTR
+ 1];
51 (void) sm_strlcpy(buf
, s
, m
+ 1);
54 (void) sm_strlcpy(buf
, s
, m
- 2);
55 (void) sm_strlcat(buf
, "...", sizeof buf
);
59 (void) sm_strlcpy(buf
, s
, m
+ 1);
60 (void) sm_strlcat2(buf
, "...", s
+ l
- m
, sizeof buf
);