how to comment your long pipes

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

how to comment your long pipes

#1 Post by technosaurus »

this is just a pass through that allows you to use its arguments as comments:

Code: Select all

int main(void){
int l=1;
char buf[80];
while(l>0){l=read(0,buf,80);write(1,buf,l);}
}
I named it @

basic usage;

Code: Select all

long|freaking|pipe |@ my comments | \
rest|of|pipe
because its not possible to use #comments there

Edit: it could be simplified to:

Code: Select all

int main(void){char s[80];while(write(1,s,read(0,s,80)));}
Attachments
@.tar.gz
static dietlibc build
(830 Bytes) Downloaded 150 times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#2 Post by seaside »

technosaurus,

That's a nifty pass-a-long.

Perhaps it would be best as a linux basic core utility.

Commenting can be done with pipes by placing the pipe at the end of each line just before the #comment--

Code: Select all

long|freaking|pipe | #my comments 
more|of|pipe| #more comments
end|of|pipes 
Comments made after a pipe symbol are ignored while on the same line, and the next line is then a continuation of a long pipe.

Regards,
s

Post Reply