From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- biblio/bibtex/contrib/astron/puntxt.c | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 biblio/bibtex/contrib/astron/puntxt.c (limited to 'biblio/bibtex/contrib/astron/puntxt.c') 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 +#include + +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); +} -- cgit v1.2.3