C1R Implementation: Difference between revisions

Special treatment for the Quine task
(Initial version)
 
(Special treatment for the Quine task)
Line 2:
c1r is the implementation for the [[C1R]] language on Unix machines; porting to Windows and other platforms should be fairly easy.
 
In fact c1r is a simple shell script that efficiently uses the already available [[C]] compiler named cc:.
The "Quine" task required special treatment.
 
<lang c>#! /bin/bash
 
Line 34 ⟶ 36:
if [ $WORDCOUNT -eq 1 ]
then
# Note: the self-printing Quine program requires special treatment
PAGEURL=$ROSETTAURL/`cat $FILENAME`
if [ `cat $FILENAME` = "Quine" ]
curl $PAGEURL 2>/dev/null | grep -m 1 "<pre class=\"c highlighted_source\">" | removeHTMLtags | unescapeHTML >${FILENAME1}
then
cat << EOF > $FILENAME1
#include <stdio.h>
int main(char args[]) {printf("Quine\\n");}
EOF
else
PAGEURL=$ROSETTAURL/`cat $FILENAME`
curl $PAGEURL 2>/dev/null | grep -m 1 "<pre class=\"c highlighted_source\">" | removeHTMLtags | unescapeHTML >${FILENAME1}
fi
fi