diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /biblio/bibtex/contrib/astron/puntxt.c |
Initial commit
Diffstat (limited to 'biblio/bibtex/contrib/astron/puntxt.c')
-rw-r--r-- | biblio/bibtex/contrib/astron/puntxt.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/biblio/bibtex/contrib/astron/puntxt.c b/biblio/bibtex/contrib/astron/puntxt.c new file mode 100644 index 0000000000..26908c9d93 --- /dev/null +++ b/biblio/bibtex/contrib/astron/puntxt.c @@ -0,0 +1,49 @@ +/* Filter a LISTSERV PUNCH format message into normal text */ + +#include <stdio.h> +#include <string.h> + +int +main() +{ + char buffer[81]; + char *p; + int len, n, k; + + k = 0; + while (gets(buffer) != (char*)NULL) + { + k++; + if (strcmp(buffer,"END/") == 0) + break; + p = strchr(buffer,'/'); + if (p != (char*)NULL) p = strchr(p+1,'/'); + if (p != (char*)NULL) ++p; + if ( (sscanf(buffer,"%d/%d/",&len,&n) != 2) || (p == (char*)NULL) ) + { + fprintf(stderr,"Conversion error on line %d = [%s]\n",k,buffer); +#if 0 + exit(1); +#endif + n = 1; + } + + if (p != (char*)NULL) + fputs(p,stdout); + else + { + fputs("????",stdout); + fputs(buffer,stdout); + } + + for (; n > 1; --n) /* copy continuation lines */ + { + if (gets(buffer) == (char*)NULL) + break; + k++; + fputs(buffer,stdout); + } + fputc('\n',stdout); + } + exit (0); +} |