Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 28 Nov 2014, 15:31
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
how to comment your long pipes
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [2 Posts]  
Author Message
technosaurus


Joined: 18 May 2008
Posts: 4380

PostPosted: Mon 11 Mar 2013, 06:09    Post subject:  how to comment your long pipes  

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

Code:
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:
long|freaking|pipe |@ my comments | \
rest|of|pipe
because its not possible to use #comments there

Edit: it could be simplified to:
Code:
int main(void){char s[80];while(write(1,s,read(0,s,80)));}
@.tar.gz
Description  static dietlibc build
gz

 Download 
Filename  @.tar.gz 
Filesize  830 Bytes 
Downloaded  56 Time(s) 

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 887

PostPosted: Tue 12 Mar 2013, 18:00    Post subject:  

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:
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
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [2 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0402s ][ Queries: 12 (0.0037s) ][ GZIP on ]