diff options
author | Jason Katz-Brown <jason@airbnb.com> | 2013-08-25 02:17:13 -0700 |
---|---|---|
committer | Jason Katz-Brown <jason@airbnb.com> | 2013-08-25 02:17:13 -0700 |
commit | 9306cb60c32082c5403931de0823a9fd5daa196c (patch) | |
tree | ca1b6eb695fdf3f0c2294e92416b272164bae642 /makeswelexicon/rmline.c | |
parent | 8fb2c681cecc01b46b0f4ba02d5cc177c4747b1c (diff) |
Initial git commit.
Diffstat (limited to 'makeswelexicon/rmline.c')
-rw-r--r-- | makeswelexicon/rmline.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/makeswelexicon/rmline.c b/makeswelexicon/rmline.c new file mode 100644 index 0000000..b218a5b --- /dev/null +++ b/makeswelexicon/rmline.c @@ -0,0 +1,27 @@ +// first argument: filename of list of line numbers to delete. files start with line 1. +// stdin: input file +// stdout: output file +// dqplz@yahoo.com / 5 Aug 2008 +#include <stdio.h> + +main(int ac, char *av[]) +{ + FILE *in; + + int line=1; + int del=0; + int rc=0; + unsigned char iw[100]; + if((in=fopen(av[1],"r"))==NULL) { + fprintf(stderr,"%s: can not open '%s' for reading\n",av[0],av[1]); + rc=1; + } + else { + while(fgets(iw,sizeof(iw),stdin)!=NULL) { + if(del==0||del<line) fscanf(in,"%d",&del); + if(line++!=del) fputs(iw,stdout); + } + if(in) fclose(in); + } + return rc; +} |