Postfix3.3.1
trimblanks.c
[詳解]
1 /*++
2 /* NAME
3 /* trimblanks 3
4 /* SUMMARY
5 /* skip leading whitespace
6 /* SYNOPSIS
7 /* #include <stringops.h>
8 /*
9 /* char *trimblanks(string, len)
10 /* char *string;
11 /* ssize_t len;
12 /* DESCRIPTION
13 /* trimblanks() returns a pointer to the beginning of the trailing
14 /* whitespace in \fIstring\fR, or a pointer to the string terminator
15 /* when the string contains no trailing whitespace.
16 /* The \fIlen\fR argument is either zero or the string length.
17 /* LICENSE
18 /* .ad
19 /* .fi
20 /* The Secure Mailer license must be distributed with this software.
21 /* AUTHOR(S)
22 /* Wietse Venema
23 /* IBM T.J. Watson Research
24 /* P.O. Box 704
25 /* Yorktown Heights, NY 10598, USA
26 /*--*/
27 
28 /* System library. */
29 
30 #include "sys_defs.h"
31 #include <ctype.h>
32 
33 /* Utility library. */
34 
35 #include "stringops.h"
36 
37 char *trimblanks(char *string, ssize_t len)
38 {
39  char *curr;
40 
41  if (len) {
42  curr = string + len;
43  } else {
44  for (curr = string; *curr != 0; curr++)
45  /* void */ ;
46  }
47  while (curr > string && ISSPACE(curr[-1]))
48  curr -= 1;
49  return (curr);
50 }
char * trimblanks(char *string, ssize_t len)
Definition: trimblanks.c:37
#define ISSPACE(c)
Definition: sys_defs.h:1753