aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Liodden <[email protected]>2018-01-03 00:49:42 +0100
committerErik Liodden <[email protected]>2018-01-03 00:49:42 +0100
commit8b7e2c1fedebdc9f94ad3cc6b6e9f9cfc741d92f (patch)
tree306f37a29eed62d9f0c3292dd854b1ab2b834054
parent3e71367b2b4ff9350ce5e7d7da1837ce93be212d (diff)
downloadalgdat-8b7e2c1fedebdc9f94ad3cc6b6e9f9cfc741d92f.tar.gz
remove io.
this was a complete mess and wasn't used anyway. it should be rewritten. i think maybe a read_lines(char **lines, int *nlines) could be useful.
-rw-r--r--Makefile4
-rw-r--r--io.c66
-rw-r--r--io.h35
3 files changed, 2 insertions, 103 deletions
diff --git a/Makefile b/Makefile
index 2b4168d..d2262b0 100644
--- a/Makefile
+++ b/Makefile
@@ -6,9 +6,9 @@ AR=ar
PROG= oving1 oving2
-LIB_OBJS=stack.o queue.o llist.o io.o misc.o sort.o heap.o
+LIB_OBJS=stack.o queue.o llist.o misc.o sort.o heap.o
LIB_FILE=libalgdat.a
-LIB_H=structure.h misc.h io.h sort.h
+LIB_H=structure.h misc.h sort.h
LIBS = $(LIB_FILE)
LIB_PATH=/usr/local/lib
diff --git a/io.c b/io.c
deleted file mode 100644
index 7611f33..0000000
--- a/io.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * io.c
- * implementation of basic io operations
- *
- * Erik Liodden
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include "io.h"
-
-/*
- * read_line:
- * read line from stream. I should probably delete this as fgets works just
- * fine.
- */
-int read_line(char *buf, FILE *stream)
-{
- fgets(buf, BUF_SIZE, stream);
- return 0;
-}
-
-/*
- * str_count_words:
- * count words in the string `str` and return this number
- */
-int str_count_words(char *str)
-{
- int nwords = 0;
- int in = 0;
- while (*str) {
- if (isspace(*str)) {
- in = 0;
- } else if (in == 0) {
- in = 1;
- nwords++;
- }
- str++;
- }
- return nwords;
-}
-
-/*
- * string_to_int_array:
- * convert a string `buf` of ints reperated by spaces into the array `numbers`
- * the function returns a pointer to the array of ints
- * the caller has to make sure *numbers has enough space
- */
-int *string_to_int_array(char *buf, int *numbers)
-{
- char *token;
- int n = 0;
-
- /* put numbers in array */
- token = strtok(buf, " ");
- while (token != NULL) {
- if (!isspace(*token)) {
- numbers[n] = atoi(token);
- n++;
- }
- token = strtok(NULL, " ");
- }
- return numbers;
-}
diff --git a/io.h b/io.h
deleted file mode 100644
index ee28320..0000000
--- a/io.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * io.h
- * decleration of basic io operations
- *
- * Erik Liodden
- */
-
-#ifndef IO_H
-#define IO_H
-
-#define BUF_SIZE 1024
-
-
-/*
- * read_line:
- * read line from stream. I should probably delete this as fgets works just
- * fine.
- */
-int read_line(char *buf, FILE *stream);
-
-/*
- * str_count_words:
- * count words in the string `str` and return this number
- */
-int str_count_words(char *str);
-
-/*
- * string_to_int_array:
- * convert a string `buf` of ints reperated by spaces into the array `numbers`
- * the function returns a pointer to the array of ints
- */
-int *string_to_int_array(char *buf, int *numbers);
-
-
-#endif /* IO_H */