* (c) 2019 Aaron Taylor <ataylor at subgeniuskitty dot com>
print_usage(char ** argv
)
printf( "VVhitespace Interpreter v%d (www.subgeniuskitty.com)\n"
"Usage: %s -i <file> -o <file>\n"
" -h Help (prints this message)\n"
" -i <file> Specify a pseudo-VVhitespace source file as input.\n"
" -o <file> Specify location for VVhitespace output.\n"
main(int argc
, char ** argv
)
* Process command line arguments
FILE * input
= NULL
, * output
= NULL
;
while ((c
= getopt(argc
,argv
,"i:o:h")) != -1) {
if ((input
= fopen(optarg
, "r")) == NULL
) {
fprintf(stderr
, "ERROR: %s: %s\n", optarg
, strerror(errno
));
if ((output
= fopen(optarg
, "w+")) == NULL
) {
fprintf(stderr
, "ERROR: %s: %s\n", optarg
, strerror(errno
));
fprintf(stderr
, "ERROR: Must specify a pseudo-VVhitespace source file with -i flag.\n");
fprintf(stderr
, "ERROR: Must specify destination for VVhitespace source file with -o flag.\n");
while (fread(&temp_byte
, 1, 1, input
)) {
fwrite(&temp_byte
, 1, 1, output
);
fwrite(&temp_byte
, 1, 1, output
);
fwrite(&temp_byte
, 1, 1, output
);
fwrite(&temp_byte
, 1, 1, output
);
/* Intentionally empty */
/* The first non-[tTsSnNvV] character begins a comment lasting until end of line. */
while (fread(&temp_byte
, 1, 1, input
)) {
if (temp_byte
== '\n') break;