X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: Doug Kaufman Newsgroups: comp.os.msdos.djgpp Subject: Re: col filter Date: 16 Dec 2001 00:28:18 GMT Organization: a2i network Lines: 115 Message-ID: <9vgpr2$cqh$1@samba.rahul.net> References: <9vahtk$bvg$1 AT netnews DOT upenn DOT edu> NNTP-Posting-Host: yellow.rahul.net NNTP-Posting-User: dkaufman X-Newsreader: NN version 6.5.6 (NOV) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com juhas AT blue DOT seas DOT upenn DOT edu (PAVOL JUHAS) writes: >I did my homework on GOOGLE, but I could not find it: >Is there a col utility - reverse line-feeds filter for DJGPP? I don't know of a published col for DJGPP, but I have been using it for several years. It is an easy port from the BSD sources. You can get the col source from: "ftp://ftp.uu.net/archive/systems/unix/bsd-sources/usr.bin/col/col.c.Z". The man page is in the same directory. Apply the following patch and it should compile under DJGPP with "gcc -W -Wall -o col.exe col.c". Doug --- col_c.ori Sat Dec 15 12:29:18 2001 +++ col.c Sat Dec 15 13:04:06 2001 @@ -48,6 +48,18 @@ #include #include #include +#ifdef __DJGPP__ +#include +#include +void usage(); +void warn(int); +void flush_lines(int); +void wrerr(); +void flush_blanks(); +typedef struct line_str LINE; +void flush_line(LINE *); +void free_line(LINE *); +#endif /* __DJGPP__ */ #define BS '\b' /* backspace */ #define TAB '\t' /* tab */ @@ -75,7 +87,9 @@ char c_char; /* character in question */ } CHAR; +#ifndef __DJGPP__ typedef struct line_str LINE; +#endif /* __DJGPP__ */ struct line_str { CHAR *l_line; /* characters on the line */ LINE *l_prev; /* previous line */ @@ -101,7 +115,7 @@ if (putchar(ch) == EOF) \ wrerr(); -main(argc, argv) +int main(argc, argv) int argc; char **argv; { @@ -307,7 +321,7 @@ exit(0); } -flush_lines(nflush) +void flush_lines(nflush) int nflush; { LINE *l; @@ -333,7 +347,7 @@ * is the number of half line feeds, otherwise it is the number of whole line * feeds. */ -flush_blanks() +void flush_blanks() { int half, i, nb; @@ -361,7 +375,7 @@ * Write a line to stdout taking care of space to tab conversion (-h flag) * and character set shifts. */ -flush_line(l) +void flush_line(l) LINE *l; { CHAR *c, *endc; @@ -478,7 +492,7 @@ return(l); } -free_line(l) +void free_line(l) LINE *l; { l->l_next = line_freelist; @@ -497,19 +511,19 @@ return(p); } -usage() +void usage() { (void)fprintf(stderr, "usage: col [-bfx] [-l nline]\n"); exit(1); } -wrerr() +void wrerr() { (void)fprintf(stderr, "col: write error.\n"); exit(1); } -warn(line) +void warn(line) int line; { (void)fprintf(stderr, -- Doug Kaufman Internet: dkaufman AT rahul DOT net