On Tue, Sep 09, 2008 at 10:10:42PM +0200, Ruediger Pluem wrote: > > > On 09/03/2008 01:01 AM, [EMAIL PROTECTED] wrote: >> Added: httpd/httpd/trunk/modules/filters/sed1.c >> URL: >> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/sed1.c?rev=691418&view=auto >> ============================================================================== >> --- httpd/httpd/trunk/modules/filters/sed1.c (added) >> +++ httpd/httpd/trunk/modules/filters/sed1.c Tue Sep 2 16:01:47 2008 >> @@ -0,0 +1,957 @@ >> +/* >> + * Copyright (c) 2005, 2008 Sun Microsystems, Inc. All Rights Reserved. >> + * Use is subject to license terms. >> + * >> + * Copyright (c) 1984 AT&T >> + * All Rights Reserved >> + * >> + * Licensed under the Apache License, Version 2.0 (the "License"); >> + * you may not use this file except in compliance with the License. >> + * You may obtain a copy of the License at >> + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless >> required by applicable law or agreed to in writing, software + * >> distributed under the License is distributed on an "AS IS" BASIS, + * >> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or >> implied. + * See the License for the specific language governing >> permissions and >> + * limitations under the License. + */ >> + >> +#include "apr.h" >> +#include "apr_lib.h" >> +#include "libsed.h" >> +#include "sed.h" >> +#include "apr_strings.h" >> +#include "regexp.h" >> + >> +char *trans[040] = { >> + "\\01", >> + "\\02", >> + "\\03", >> + "\\04", >> + "\\05", >> + "\\06", >> + "\\07", >> + "-<", >> + "->", > > What are the above constants supposed to be. Opening the file in vi shows > that they are special > characters or better control characters. Looking with a hex editor these () > seem to be \\08. > Is this correct?
Sed has a "l" command. From the sed man page : (2)l List the pattern space on the standard out- put in an unambiguous form. Non-printing characters are spelled in two digit ASCII and long lines are folded. >From the code : p3 = trans[(unsigned char)*p1-1]; while ((*p2++ = *p3++) != 0) if(p2 >= eval->lcomend) { *p2 = '\\'; wline(eval, eval->genbuf, strlen(eval->genbuf)); p2 = eval->genbuf; } It looks to me that it is trying to print character from value 0 to 31 as printable characters. >> + "-<", >> + "->", It seems to me that it should be \\08 and \\09. I will dig deeper to see if these can be simplified. It looks little weird that there are binary characters in source file. Regards, Basant.