sed0.c revision 4c6374798c9e6c0fc3b42dbc5a7225f67d27cb9f
/*
* 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
*
* 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_strings.h"
#include "libsed.h"
#include "sed.h"
#include "regexp.h"
#define CCEOF 22
{
const char* error;
}
}
/*
* sed_init_commands
*/
apr_pool_t *p)
{
return APR_EGENERAL;
}
return APR_EGENERAL;
return APR_SUCCESS;
}
/*
* sed_destroy_commands
*/
{
}
/*
* sed_compile_string
*/
{
if (rv == APR_SUCCESS)
}
/*
* sed_compile_file
*/
{
}
/*
* sed_get_finalize_error
*/
{
const sed_label_t *lab;
return SEDERR_TMOMES;
}
/* Empty branch chain is not a issue */
char *error;
return error;
}
return SEDERR_INTERNAL;
}
}
return NULL;
}
/*
* sed_canbe_finalized
*/
{
return commands->canbefinal;
}
/*
* check_finalized
*/
{
const sed_label_t *lab;
return 0;
}
/* Empty branch chain is not a issue */
return 0;
}
}
return 1;
}
/*
* dechain
*/
{
return;
}
}
/*
* fcomp
*/
{
int i, ii;
char fnamebuf[APR_PATH_MAX];
}
return 0;
}
else {
goto comploop;
}
for (;;) {
break;
continue;
goto comploop;
}
if (status != APR_SUCCESS) {
return -1;
}
if (op)
else {
return -1;
}
} else if (p == 0) {
} else {
if ((status != APR_SUCCESS) || (p == 0)) {
return -1;
}
else
} else
}
return -1;
}
swit:
default:
return -1;
case '!':
goto swit;
case '{':
continue;
goto comploop;
case '}':
return -1;
}
return -1;
}
continue;
case '=':
return -1;
}
break;
case ':':
return -1;
}
return -1;
}
}
*--tp = '\0';
return -1;
}
} else {
return -1;
}
}
continue;
case 'a':
return -1;
}
return -1;
}
if (p == NULL)
return -1;
break;
case 'c':
return -1;
}
if (p == NULL)
return -1;
break;
case 'i':
return -1;
}
return -1;
}
if (p == NULL)
return -1;
break;
case 'g':
break;
case 'G':
break;
case 'h':
break;
case 'H':
break;
case 't':
goto jtcommon;
case 'b':
} else
break;
}
return -1;
}
*--tp = '\0';
} else {
}
} else {
return -1;
}
}
break;
case 'n':
break;
case 'N':
break;
case 'p':
break;
case 'P':
break;
case 'r':
return -1;
}
return -1;
}
if (p == NULL)
return -1;
break;
case 'd':
break;
case 'D':
break;
case 'q':
return -1;
}
break;
case 'l':
break;
case 's':
if (p == NULL)
return -1;
if (op)
else {
return -1;
}
} else
if ((p) == NULL)
return -1;
while (1) {
break;
if (i > 512) {
return -1;
}
}
}
}
}
return -1;
}
return -1;
}
goto done;
}
return -1;
}
return -1;
}
}
break;
case 'w':
return -1;
}
return -1;
}
goto done;
}
return -1;
}
return -1;
}
break;
case 'x':
break;
case 'y':
if (p == NULL)
return -1;
break;
}
done:
goto comploop;
return -1;
}
}
return 0;
}
{
char *p, *q;
p = rhsbuf;
for(;;) {
return NULL;
}
if((*p = *q++) == '\\') {
p++;
return NULL;
}
*p = *q++;
return NULL;
}
p++;
continue;
}
*p++ = '\0';
return(p);
}
if(*p++ == '\0') {
return NULL;
}
}
}
/*
* rline
*/
{
char *p;
const char *q;
int t;
p = lbuf;
while((t = *q++) != '\0') {
if(t == '\n') {
goto out1;
}
if (p < lbend)
*p++ = t;
if(t == '\\') {
if((t = *q++) == '\0') {
return(-1);
}
if (p < lbend)
*p++ = t;
}
}
out1:
if (p == lbend) {
return -1;
}
*p = '\0';
return(1);
}
while((t = *q++) != '\0') {
if(t == '\n') {
goto out2;
}
if(p < lbend)
*p++ = t;
if(t == '\\') {
if((t = *q++) == '\0') {
return(-1);
}
if (p < lbend)
*p++ = t;
}
}
out2:
if (p == lbend) {
return -1;
}
*p = '\0';
return(1);
}
bytes_read = 1;
/* XXX extremely inefficient 1 byte reads */
if(t == '\n') {
if (p == lbend) {
return -1;
}
*p = '\0';
return(1);
}
if (p < lbend)
*p++ = t;
if(t == '\\') {
bytes_read = 1;
return -1;
}
if(p < lbend)
*p++ = t;
}
bytes_read = 1;
}
return(-1);
}
/*
* address
*/
{
char *rcp;
*status = APR_SUCCESS;
*status = APR_EGENERAL;
return NULL;
}
return(expbuf);
}
}
lno = 0;
*status = APR_EGENERAL;
return NULL;
}
*status = APR_EGENERAL;
return NULL;
}
return(expbuf);
}
return(NULL);
}
/*
* text
*/
{
char *p, *q;
p = textbuf;
#ifndef S5EMUL
/*
* Strip off indentation from text to be inserted.
*/
while(*q == '\t' || *q == ' ') q++;
#endif
for(;;) {
if(p > tbend)
return(NULL); /* overflowed the buffer */
if((*p = *q++) == '\\')
*p = *q++;
if(*p == '\0') {
return(++p);
}
#ifndef S5EMUL
/*
* Strip off indentation from text to be inserted.
*/
if(*p == '\n') {
while(*q == '\t' || *q == ' ') q++;
}
#endif
p++;
}
}
/*
* search
*/
{
return rp;
rp++;
}
return 0;
}
/*
* ycomp
*/
{
char c;
int cint; /* integer value of char c */
int i;
char *sp;
return NULL;
}
if(c == '\\')
tsp++;
if(c == '\0' || c == '\n') {
return NULL;
}
}
tsp++;
c &= 0377;
sp++;
c = '\n';
}
cint = (int) c;
tsp++;
}
}
}
if(*tsp == '\0') {
}
else {
}
return NULL;
}
for(i = 0; i < 0400; i++)
if(ep[i] == 0)
ep[i] = i;
return(ep + 0400);
}
/*
* comple
*/
{
char *p;
if(p == ep + 1)
return(ep);
return(p);
}
/*
* alloc_reptr
*/
{
return 0;
}
else
return var;
}