Move LINELIST to util.c
This commit is contained in:
parent
aa1898fd66
commit
e456ace07b
8
main.c
8
main.c
|
@ -12,14 +12,6 @@ char* getoutname(char* fname, int fnamelen) {
|
|||
return outf;
|
||||
}
|
||||
|
||||
void printlns(LINELIST* lns, FILE* stream) {
|
||||
LINELIST* curln = lns;
|
||||
while(curln != NULL) {
|
||||
fprintf(stream, "%s\n", curln->content);
|
||||
curln = curln->next;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if(argc < 2) {
|
||||
printf("Usage: %s {input}\n", argv[0]);
|
||||
|
|
1
parser.c
1
parser.c
|
@ -4,6 +4,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include "parser.h"
|
||||
#include "util.h"
|
||||
|
||||
void pushln(LINELIST** curln, char* tmpln, int lnind, int truen) {
|
||||
int size = (lnind+1)*sizeof(char);
|
||||
|
|
7
parser.h
7
parser.h
|
@ -1,14 +1,11 @@
|
|||
#ifndef PARSER_H
|
||||
#define PARSER_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "util.h"
|
||||
|
||||
#define INST_LIMIT 1<<15
|
||||
|
||||
typedef struct lnls {
|
||||
char* content;
|
||||
int truen;
|
||||
struct lnls* next;
|
||||
} LINELIST;
|
||||
|
||||
typedef struct {
|
||||
FILE* input;
|
||||
|
|
8
util.c
8
util.c
|
@ -22,3 +22,11 @@ int countplaces(int n) {
|
|||
}
|
||||
return places;
|
||||
}
|
||||
|
||||
void printlns(LINELIST* lns, FILE* stream) {
|
||||
LINELIST* curln = lns;
|
||||
while(curln != NULL) {
|
||||
fprintf(stream, "%s\n", curln->content);
|
||||
curln = curln->next;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue