summaryrefslogtreecommitdiff
path: root/buff.c
diff options
context:
space:
mode:
Diffstat (limited to 'buff.c')
-rw-r--r--buff.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/buff.c b/buff.c
index aa66a67..78bee0a 100644
--- a/buff.c
+++ b/buff.c
@@ -1,5 +1,6 @@
#include "buff.h"
#include <regex.h>
+#include <ctype.h>
line_t* __search_pos(int addr){
@@ -11,6 +12,20 @@ line_t* __search_pos(int addr){
return cur;
}
+int get_lineno(line_t *l){
+
+ line_t *t = b_start;
+ int i = 1;
+ while (t && t != l)
+ t = t->next, i+=1;
+ if (!l)
+ return -1;
+ else
+ return i;
+
+}
+
+
int __get_lines(FILE *fin, line_t **first, line_t **last, int *tot){
char buff[4096];
@@ -49,6 +64,7 @@ int __get_lines(FILE *fin, line_t **first, line_t **last, int *tot){
return n;
}
+
int read_file(){
FILE *fin;
@@ -96,11 +112,12 @@ void print_lines(char lineno){
for (i=1; i<addr2; i++) p = p->next;
pos = i;
cur = p;
- while(pos++ < addr1){
+ while(pos < addr1){
if (lineno)
printf("%d\t", pos);
printf("%s", cur->c);
cur = cur->next;
+ pos ++;
}
if (lineno)
printf("%d\t", pos);
@@ -365,4 +382,14 @@ int match(char **c, char bw){
}
+int mark(char *c){
+
+ fprintf (stderr, " >>>> mark: label: '%c'\n", *c);
+ if (!islower(*c))
+ return -1;
+ if (*(c+1) != '\n')
+ return -1;
+ marks[*c - 'a'] = __search_pos(addr1);
+ return 0;
+}