/[global]/global/libutil/strmake.c
ViewVC logotype

Diff of /global/libutil/strmake.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by shigio, Tue Oct 12 23:18:23 2004 UTC revision 1.6 by shigio, Thu Oct 14 00:26:08 2004 UTC
# Line 29  Line 29 
29  #include "strbuf.h"  #include "strbuf.h"
30  #include "strmake.h"  #include "strmake.h"
31    
 static STRBUF *sb;  
   
32  /*  /*
33   * strmake: make string from original string p.   * strmake: make string from original string with limit character.
34   *   *
35   *      i)      p       original string.   *      i)      p       original string.
36   *      i)      lim     limitter   *      i)      lim     limitter
# Line 41  static STRBUF *sb; Line 39  static STRBUF *sb;
39   * Usage:   * Usage:
40   *      strmake("aaa:bbb", ":/=")       => "aaaa"   *      strmake("aaa:bbb", ":/=")       => "aaaa"
41   *   *
42   * Note: The result string area is module local. So, following call   * Note: The result string area is function local. So, following call
43   *       to the function in this module may destroy the area.   *       to this function may destroy the area.
44   */   */
45  char *  char *
46  strmake(p, lim)  strmake(p, lim)
47          const char *p;          const char *p;
48          const char *lim;          const char *lim;
49  {  {
50            static STRBUF *sb;
51          const char *c;          const char *c;
52    
53          if (sb == NULL)          if (sb == NULL)
# Line 65  end: Line 64  end:
64  }  }
65    
66  /*  /*
67   * strtrim: delete blanks from original string.   * strtrim: make string from original string with deleting blanks.
68   *   *
69   *      i)      p       original string.   *      i)      p       original string.
70   *      i)      flag    TRIM_HEAD       from only head   *      i)      flag    TRIM_HEAD       from only head
# Line 82  end: Line 81  end:
81   *      strtrim(" # define ", TRIM_BOTH, NULL)  => "# define"   *      strtrim(" # define ", TRIM_BOTH, NULL)  => "# define"
82   *      strtrim(" # define ", TRIM_ALL, NULL)   => "#define"   *      strtrim(" # define ", TRIM_ALL, NULL)   => "#define"
83   *   *
84   * Note: The result string area is module local. So, following call   * Note: The result string area is function local. So, following call
85   *       to the function in this module may destroy the area.   *       to this function may destroy the area.
86   */   */
87  char *  char *
88  strtrim(p, flag, len)  strtrim(p, flag, len)
# Line 91  strtrim(p, flag, len) Line 90  strtrim(p, flag, len)
90          int flag;          int flag;
91          int *len;          int *len;
92  {  {
93            static STRBUF *sb;
94          int cut_off = -1;          int cut_off = -1;
95    
96          if (sb == NULL)          if (sb == NULL)

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26