From 9e0afb505e266b0a64e2c91b685b3361c9c3bfb3 Mon Sep 17 00:00:00 2001 From: Mateusz Hromada Date: Tue, 9 Jun 2009 12:54:31 +0200 Subject: [PATCH] Migration to new build system. * fla moved and checked --- app/src/fla/Makefile | 13 --------- app/src/fla/fla.c | 46 ------------------------------ auto/output/Makefile | 5 ++-- src/fla.c | 68 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 61 deletions(-) delete mode 100644 app/src/fla/Makefile delete mode 100644 app/src/fla/fla.c create mode 100644 src/fla.c diff --git a/app/src/fla/Makefile b/app/src/fla/Makefile deleted file mode 100644 index b048129..0000000 --- a/app/src/fla/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -PAR = -m32 -# -static - -fla: fla.c - gcc $(PAR) -o fla fla.c - -copy: -ifdef UTT_BIN_DIR - cp fla ${UTT_BIN_DIR} -endif - -clean: - rm fla diff --git a/app/src/fla/fla.c b/app/src/fla/fla.c deleted file mode 100644 index 89fe819..0000000 --- a/app/src/fla/fla.c +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include -#include - -char buf[5001]; - -main(int argc, char **argv) -{ - - char *pattern; - char eoln; - regex_t re; - - int firstline=1; - - if(argc < 2) -/* pattern="[ \t]*([0-9]+[ \t]+){2}EOS([ \t].*)?"; */ - pattern="[ \t]*BOS([ \t].*)?"; - else - pattern=argv[1]; - - if(argc < 3) - eoln='\f'; - else - eoln=atoi(argv[2]); - - if(regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB) !=0) - { - fprintf(stderr,"Invalid pattern.\n"); - exit(1); - } - - while(fgets(buf,5000,stdin)) - { - buf[strlen(buf)-1]='\0'; - if(firstline) - firstline=0; - else - if(regexec(&re, buf, (size_t)0, NULL, 0) == 0) - putchar('\n'); - else - putchar(eoln); - fputs(buf,stdout); - } - putchar('\n'); -} diff --git a/auto/output/Makefile b/auto/output/Makefile index 5cf24ef..4d0f5db 100755 --- a/auto/output/Makefile +++ b/auto/output/Makefile @@ -42,7 +42,7 @@ ALL_FFLAGS = -t \$(FFLAGS) VPATH = ./src -PROGRAMS = tok sen +PROGRAMS = tok sen fla TOK_OBJ_FILES = tok.o tok_cmdline.o TOK_FLEX_FILES = tok.l @@ -52,6 +52,8 @@ tok.o: tok_cmdline.h SEN_OBJ_FILES = sen.o SEN_FLEX_FILES = sen.l +FLA_OBJ_FILES = fla.o + CONFIG_FILES = src/config.h Makefile .SUFFIXES: @@ -60,7 +62,6 @@ CONFIG_FILES = src/config.h Makefile .INTERMEDIATE: \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES)) .INTERMEDIATE: \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES)) .INTERMEDIATE: \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES)) - .INTERMEDIATE: \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES)) .PHONY: all diff --git a/src/fla.c b/src/fla.c new file mode 100644 index 0000000..7d16f4e --- /dev/null +++ b/src/fla.c @@ -0,0 +1,68 @@ +#include +#include +#include +#include + +char buf[5000]; + +int main(int argc, char **argv) +{ + + char *pattern; + char eoln; + regex_t re; + + int firstline = 1; + + if( argc < 2 ) + { +/* pattern="[ \t]*([0-9]+[ \t]+){2}EOS([ \t].*)?"; */ + pattern = "[ \t]*BOS([ \t].*)?"; + } + else + { + pattern = argv[1]; + } + + if( argc < 3 ) + { + eoln = '\f'; + } + else + { + eoln = atoi(argv[2]); + } + + if( 0 != regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB) ) + { + fprintf(stderr, "Invalid pattern.\n"); + return 1; + } + + while( fgets(buf, 5000, stdin) ) + { + buf[strlen(buf)-1] = '\0'; + if( firstline ) + { + firstline = 0; + } + else + { + if( 0 == regexec(&re, buf, (size_t)0, NULL, 0) ) + { + putchar('\n'); + } + else + { + putchar(eoln); + } + } + fputs(buf, stdout); + } + + putchar('\n'); + + return 0; + +} +