~ubuntu-branches/ubuntu/vivid/ploticus/vivid

« back to all changes in this revision

Viewing changes to src/glroutines.c

  • Committer: Package Import Robot
  • Author(s): Colin Tuckley
  • Date: 2014-01-08 11:02:15 UTC
  • mfrom: (0.1.5)
  • Revision ID: package-import@ubuntu.com-20140108110215-9y3w9z5ezh4yqgxt
Tags: 2.42-1
* New Upstream release.
* Bump Standards-Version to 3.9.5 (No changes required).
* Upstream Bugfix: Instability with multiline attribute in execline.c
  (LP: #692567)

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
static int Maxlen = 99999;
29
29
static char Member_nullstring[10] = "";
30
30
 
31
 
 
32
31
/* ================================= */
33
32
int
34
33
GL_initstatic()
77
76
}
78
77
 
79
78
 
80
 
 
81
79
/* ============================================= */
82
80
/* GETOK - get next whitespace-delimited token */
83
81
 
100
98
return( Gettok_buf );
101
99
}
102
100
 
 
101
/* ====================================================================== */
 
102
/* MEMBER - returns char position if character c is a member of string s, 
 
103
                0 otherwise. Char positions start with 1 for this purpose.  */
 
104
int
 
105
GL_member( c, s )
 
106
char c, s[];
 
107
{
 
108
int i, len;
 
109
for( i = 0, len = strlen( s ); i < len; i++ ) if( s[i] == c ) return( i+1 );
 
110
return( 0 );
 
111
}
 
112
 
103
113
/* ===================================================================== */
104
114
/* SMEMBER - look for s in list t (white-space delimited).  Case sensitive.
105
115
   If found return 1 else 0. */
144
154
}
145
155
 
146
156
 
147
 
/* ====================================================================== */
148
 
/* MEMBER - returns char position if character c is a member of string s, 
149
 
                0 otherwise. Char positions start with 1 for this purpose.  */
150
 
int
151
 
GL_member( c, s )
152
 
char c, s[];
153
 
{
154
 
int i, len;
155
 
for( i = 0, len = strlen( s ); i < len; i++ ) if( s[i] == c ) return( i+1 );
156
 
return( 0 );
157
 
}
158
157
 
159
158
/* ==================================================================== */
160
159
/* MEMBER_NULLMODE - set a special mode for the benefit of shsql, to consider
709
708
GL_changechars( clist, s, newchar )
710
709
char *clist, *s, *newchar;
711
710
{
712
 
 
713
 
int i, len;
714
 
 
715
 
for( i = 0, len = strlen( s ); i < len; i++ ) {
716
 
        if( GL_member( s[i], clist )) s[i] = newchar[0];
 
711
int i, special;
 
712
 
 
713
special = 0;
 
714
if( strcmp( clist, "not_alnum" )==0 ) special = 1;
 
715
 
 
716
if( newchar[0] == '\0' ) return( 1 );
 
717
for( i = 0; s[i] != '\0'; i++ ) {
 
718
        if( special && !isalnum( (int)s[i] )) s[i] = newchar[0];
 
719
        else if( !special && GL_member( s[i], clist )) s[i] = newchar[0];
717
720
        }
718
721
return( 0 );
719
722
}
726
729
GL_deletechars( clist, s )
727
730
char *clist, *s;
728
731
{
729
 
 
730
 
int i;
731
 
 
732
 
for( i = 0; ; ) {
733
 
        if( s[i] == '\0' ) break;
734
 
        if( GL_member( s[i], clist )) {
735
 
                strcpy( &s[i], &s[i+1] );
736
 
                continue;
737
 
                }
738
 
        else i++;
 
732
int i, j, special;
 
733
 
 
734
special = 0;
 
735
if( strcmp( clist, "not_alnum" )==0 ) special = 1;
 
736
 
 
737
for( i = 0, j = 0; s[i] != '\0';  ) {
 
738
        if( special && !isalnum( (int)s[i] )) i++; 
 
739
        else if( !special && GL_member( s[i], clist )) i++; 
 
740
        else s[j++] = s[i++];
739
741
        }
 
742
s[j] = '\0';
740
743
return( 0 );
741
744
}
742
745
/* ======================================================================== */