public
Description: An implementation of markdown in C, using a PEG grammar
Clone URL: git://github.com/jgm/peg-markdown.git
Search Repo:
Code cleanup - moved declarations to beginning.
jgm (author)
Mon May 19 15:06:53 -0700 2008
commit  f764c7a308fbd2b83a8e0c25d6385a77752b4b31
tree    536920b009e453d91890674f1bb7b52fb40ec781
parent  d40090cb8831139d9923d81c6942af86a80a32bc
...
82
83
84
 
 
 
 
 
 
 
 
 
 
 
 
85
86
87
...
90
91
92
 
93
94
95
...
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
 
183
184
185
...
193
194
195
 
 
 
196
197
198
...
227
228
229
230
 
231
232
233
...
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
...
102
103
104
105
106
107
108
...
181
182
183
 
 
 
 
 
 
 
 
 
 
 
 
184
185
186
187
...
195
196
197
198
199
200
201
202
203
...
232
233
234
 
235
236
237
238
0
@@ -82,6 +82,18 @@
0
 
0
 int main(int argc, char * argv[]) {
0
 
0
+ int numargs; /* number of filename arguments */
0
+ FILE *inputs[argc]; /* array of file pointers for inputs */
0
+ int lastinp; /* index of last file in inputs */
0
+ int i;
0
+ int buflength = 0;
0
+ int maxlength = INCREMENT;
0
+
0
+ char *inputbuf;
0
+
0
+ FILE *input;
0
+ char *curchar;
0
+ int charstotab;
0
     char *progname = argv[0];
0
     int opt;
0
     /* the output filename is initially 0 (a.k.a. stdout) */
0
@@ -90,6 +102,7 @@
0
     char *exts = 0;
0
 
0
     int output_format = HTML_FORMAT;
0
+ element parsed_input;
0
 
0
     char *shortopts = "Vhx::o:t:";
0
     /* long options list */
0
@@ -168,18 +181,7 @@
0
             return 1;
0
         }
0
 
0
- int numargs; /* number of filename arguments */
0
- FILE *inputs[argc]; /* array of file pointers for inputs */
0
- int lastinp; /* index of last file in inputs */
0
- int i;
0
- int buflength = 0;
0
- int maxlength = INCREMENT;
0
- char *inputbuf;
0
- inputbuf = malloc(INCREMENT);
0
- FILE *input;
0
- char *curchar = inputbuf;
0
- int charstotab;
0
-
0
+
0
     numargs = argc - optind;
0
     if (numargs == 0) { /* use stdin if no files specified */
0
        inputs[0] = stdin;
0
@@ -193,6 +195,9 @@
0
             }
0
        lastinp = i - 1;
0
     }
0
+
0
+ inputbuf = malloc(INCREMENT);
0
+ curchar = inputbuf;
0
    
0
     for (i=0; i <= lastinp; i++) {
0
         input = inputs[i];
0
@@ -227,7 +232,7 @@
0
 
0
     strcat(inputbuf, strdup("\n\n")); /* add newlines to end to match Markdown.pl behavior */
0
    
0
- element parsed_input = markdown(inputbuf, extensions);
0
+ parsed_input = markdown(inputbuf, extensions);
0
 
0
     print_element(parsed_input, output_format);
0
 

Comments

    No one has commented yet.