OpenCores
URL https://opencores.org/ocsvn/forth-cpu/forth-cpu/trunk

Subversion Repositories forth-cpu

[/] [forth-cpu/] [trunk/] [block.c] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 howe.r.j.8
/**@brief Turn a text file into a Forth block file */
2
 
3
#include <stdio.h>
4
#include <string.h>
5
 
6
int main(void)
7
{
8
        size_t i;
9
        char line[80] = { 0 };
10
 
11
        memset(line, ' ', 64);
12
        for(i = 0;fgets(line, 66, stdin); memset(line, ' ', 64), i++) {
13
                if(strlen(line) > 65) {
14
                        fprintf(stderr, "line %u too long:\n\t%s\n", (unsigned)i, line);
15
                        return -1;
16
                }
17
                line[strlen(line)-1] = ' ';
18
                line[strlen(line)+0] = ' ';
19
                line[strlen(line)+1] = ' ';
20
                fprintf(stdout, "%.64s", line);
21
        }
22
 
23
        return 0;
24
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.