/[radius]/radius/radiusd/rewrite.y
ViewVC logotype

Diff of /radius/radiusd/rewrite.y

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

revision 1.65 by gray, Thu Oct 16 11:25:10 2003 UTC revision 1.66 by gray, Fri Oct 24 14:02:28 2003 UTC
# Line 5102  bi_sub() Line 5102  bi_sub()
5102          pushn((RWSTYPE) temp_space_fix(base));          pushn((RWSTYPE) temp_space_fix(base));
5103  }  }
5104    
5105    #define ISPRINT(c) (((unsigned char)c) < 128 && (isalnum(c) || c == '-'))
5106    
5107    static void
5108    bi_qprn()
5109    {
5110            char *s = (char*)getarg(1);
5111            char *p;
5112            size_t count;
5113    
5114            for (count = 0, p = s; *p; p++)
5115                    if (!ISPRINT(*p))
5116                            count++;
5117    
5118            /* Each encoded character takes 3 bytes. */
5119            p = heap_reserve(strlen(s) + 2*count + 1);
5120            
5121            pushn((RWSTYPE) p);
5122            for (; *s; s++) {
5123                    if (ISPRINT(*s))
5124                            *p++ = *s;
5125                    else {
5126                            char buf[3];
5127                            snprintf(buf, sizeof buf, "%2X", *s);
5128                            *p++ = '%';
5129                            *p++ = buf[0];
5130                            *p++ = buf[1];
5131                    }
5132            }
5133            *p = 0;
5134    }
5135            
5136  static builtin_t builtin[] = {  static builtin_t builtin[] = {
5137          { bi_length,  "length", Integer, "s" },          { bi_length,  "length", Integer, "s" },
5138          { bi_index,   "index",  Integer, "si" },          { bi_index,   "index",  Integer, "si" },
# Line 5118  static builtin_t builtin[] = { Line 5148  static builtin_t builtin[] = {
5148          { bi_inet_aton, "inet_aton", Integer, "s" },          { bi_inet_aton, "inet_aton", Integer, "s" },
5149          { bi_sub, "sub", String, "sss" },          { bi_sub, "sub", String, "sss" },
5150          { bi_gsub, "gsub", String, "sss" },          { bi_gsub, "gsub", String, "sss" },
5151            { bi_qprn, "qprn", String, "s" },
5152          { NULL }          { NULL }
5153  };  };
5154    

Legend:
Removed from v.1.65  
changed lines
  Added in v.1.66

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