Migration to new build system.

* fla moved and checked
This commit is contained in:
Mateusz Hromada 2009-06-09 12:54:31 +02:00
parent 1e551bdd1b
commit 9e0afb505e
4 changed files with 71 additions and 61 deletions

View File

@ -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

View File

@ -1,46 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <regex.h>
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');
}

View File

@ -42,7 +42,7 @@ ALL_FFLAGS = -t \$(FFLAGS)
VPATH = ./src VPATH = ./src
PROGRAMS = tok sen PROGRAMS = tok sen fla
TOK_OBJ_FILES = tok.o tok_cmdline.o TOK_OBJ_FILES = tok.o tok_cmdline.o
TOK_FLEX_FILES = tok.l TOK_FLEX_FILES = tok.l
@ -52,6 +52,8 @@ tok.o: tok_cmdline.h
SEN_OBJ_FILES = sen.o SEN_OBJ_FILES = sen.o
SEN_FLEX_FILES = sen.l SEN_FLEX_FILES = sen.l
FLA_OBJ_FILES = fla.o
CONFIG_FILES = src/config.h Makefile CONFIG_FILES = src/config.h Makefile
.SUFFIXES: .SUFFIXES:
@ -60,7 +62,6 @@ CONFIG_FILES = src/config.h Makefile
.INTERMEDIATE: \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES)) .INTERMEDIATE: \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES))
.INTERMEDIATE: \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES)) .INTERMEDIATE: \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES))
.INTERMEDIATE: \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES)) .INTERMEDIATE: \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES))
.INTERMEDIATE: \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES)) .INTERMEDIATE: \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES))
.PHONY: all .PHONY: all

68
src/fla.c Normal file
View File

@ -0,0 +1,68 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <regex.h>
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;
}