{"id":9,"date":"2006-04-27T19:28:29","date_gmt":"2006-04-25T19:23:51","guid":{"rendered":""},"modified":"2017-03-07T15:55:50","modified_gmt":"2017-03-07T15:55:50","slug":"comment_contest","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/agriffis\/2006\/04\/27\/comment_contest\/","title":{"rendered":"comment contest"},"content":{"rendered":"<p>This contest stems from <a href=\"http:\/\/www.csee.wvu.edu\/~dowen\/2006_04_01_archive.html#114442645884093235\">David&#8217;s post<\/a> regarding a script to comment out words in a C file.  The general applicability of this script is questionable, but it&#8217;s still a fun exercise.  Here are the instructions:<\/p>\n<ol>\n<li>Write a command-line filter which will comment out all matches of a pattern given on the command-line, reading a C program from stdin and filtering to stdout.  Whether the pattern is a literal, glob, regular expression is up to the contestant.<\/li>\n<li>The filter should ignore matches that are already contained within a comment (including C++ style comments) or double-quoted string.<\/li>\n<\/ol>\n<p>The existing gawk implementation on David&#8217;s blog is an interesting starting point, though it doesn&#8217;t fulfill all the requirements above.<\/p>\n<p>Samples:<\/p>\n<ol>\n<li>simple: <a href=\"http:\/\/n01se.net\/paste\/FLa\">input<\/a> \/ <a href=\"http:\/\/n01se.net\/paste\/YHN\">output<\/a> (&#8220;add&#8221;)<\/li>\n<li>wacky: <a href=\"http:\/\/n01se.net\/paste\/xxd\">input<\/a> \/ <a href=\"http:\/\/n01se.net\/paste\/XN\">output<\/a> (&#8220;wacky&#8221;)<\/li>\n<li>deranged: <a href=\"http:\/\/n01se.net\/paste\/HhG\">input<\/a> \/ <a href=\"http:\/\/n01se.net\/paste\/1x\">output<\/a> (&#8220;int&#8221;)<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This contest stems from David&#8217;s post regarding a script to comment out words in a C file. The general applicability of this script is questionable, but it&#8217;s still a fun exercise. Here are the instructions: Write a command-line filter which will comment out all matches of a pattern given on the command-line, reading a C &hellip; <a href=\"https:\/\/blogs.gentoo.org\/agriffis\/2006\/04\/27\/comment_contest\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">comment contest<\/span><\/a><\/p>\n","protected":false},"author":25,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/agriffis\/wp-json\/wp\/v2\/posts\/9"}],"collection":[{"href":"https:\/\/blogs.gentoo.org\/agriffis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.gentoo.org\/agriffis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/agriffis\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/agriffis\/wp-json\/wp\/v2\/comments?post=9"}],"version-history":[{"count":1,"href":"https:\/\/blogs.gentoo.org\/agriffis\/wp-json\/wp\/v2\/posts\/9\/revisions"}],"predecessor-version":[{"id":12,"href":"https:\/\/blogs.gentoo.org\/agriffis\/wp-json\/wp\/v2\/posts\/9\/revisions\/12"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/agriffis\/wp-json\/wp\/v2\/media?parent=9"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/agriffis\/wp-json\/wp\/v2\/categories?post=9"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/agriffis\/wp-json\/wp\/v2\/tags?post=9"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}