Postfix3.3.1
総合概要
データ構造
ファイル
ファイル一覧
大域各種
postfix-3.3.1
src
util
balpar.c
[詳解]
1
/*++
2
/* NAME
3
/* balpar 3
4
/* SUMMARY
5
/* determine length of string in parentheses
6
/* SYNOPSIS
7
/* #include <stringops.h>
8
/*
9
/* size_t balpar(string, parens)
10
/* const char *string;
11
/* const char *parens;
12
/* DESCRIPTION
13
/* balpar() determines the length of a string enclosed in
14
/* the specified parentheses, zero in case of error.
15
/* SEE ALSO
16
/* A balpar() routine appears in Brian W. Kernighan, P.J. Plauger:
17
/* "Software Tools", Addison-Wesley 1976. This function is different.
18
/* LICENSE
19
/* .ad
20
/* .fi
21
/* The Secure Mailer license must be distributed with this software.
22
/* AUTHOR(S)
23
/* Wietse Venema
24
/* IBM T.J. Watson Research
25
/* P.O. Box 704
26
/* Yorktown Heights, NY 10598, USA
27
/*--*/
28
29
/* System library. */
30
31
#include <
sys_defs.h
>
32
33
/* Utility library. */
34
35
#include <
stringops.h
>
36
37
/* balpar - return length of {text} */
38
39
size_t
balpar
(
const
char
*
string
,
const
char
*parens)
40
{
41
const
char
*cp;
42
int
level;
43
int
ch;
44
45
if
(*
string
!= parens[0])
46
return
(0);
47
for
(level = 1, cp =
string
+ 1; (ch = *cp) != 0; cp++) {
48
if
(ch == parens[1]) {
49
if
(--level == 0)
50
return
(cp -
string
+ 1);
51
}
else
if
(ch == parens[0]) {
52
level++;
53
}
54
}
55
return
(0);
56
}
stringops.h
sys_defs.h
balpar
size_t balpar(const char *string, const char *parens)
Definition:
balpar.c:39
2018年11月10日(土) 18時59分49秒作成 - Postfix3.3.1 / 構成:
1.8.9.1