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 Wed 26 Nov 2014, 16:30
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 Posts_count  
Author Message
technosaurus


Joined: 18 May 2008
Posts: 4379

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  55 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:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0464s ][ Queries: 13 (0.0083s) ][ GZIP on ]