Compare commits

...

2 Commits

Author SHA1 Message Date
Mid Favila 2baca20487 Remove redundant material from common.h and adjust Makefile to account
for wc being gone.
2022-08-19 14:54:58 -04:00
Mid Favila c772d723ef Remove wc.c. Will write it (and rewrite cat) when better way to handle
argument parsing is discovered.
2022-08-19 14:48:33 -04:00
4 changed files with 2 additions and 83 deletions

View File

@ -7,7 +7,7 @@ LDLIBS =
PREFIX = /usr/local/bin/
DESTDIR =
all: echo wc yes true false cat
all: echo yes true false cat
echo: echo.c
wc: wc.c
yes: yes.c
@ -17,7 +17,7 @@ false:
cat: cat.c
clean:
rm echo true wc yes false cat
rm echo true yes false cat
.SUFFIXES: .c .o
.c.o:

View File

@ -100,7 +100,6 @@ int main(int argc, char **argv)
buf = tmpbuf;
}
}
if(!fppresence)

View File

@ -5,19 +5,6 @@
#include <unistd.h>
#include <sys/stat.h>
/* arrconcat -- function to copy copy_n bytes from arr2 to arr1, starting at startpos (in arr1) */
void arrconcat(char* arr1, char* arr2, unsigned int startpos, unsigned int copy_n)
{
unsigned int i, i2;
for(i = startpos, i2 = 0; i <= copy_n && arr2 != NULL; i++, i2++)
{
arr1[i] = arr2[i2];
}
}
/* arrccat -- function to copy arr2len bytes from arr2 to the arr1len'th position of arr1. returns *newarr, and stores the length */
/* of newarr[] in arr1len (that's why it needs to be a pointer to arr1len and not just a long unsigned integer). */
char *arrccat(char *arr1, char *arr2, size_t *arr1len, size_t arr2len)

View File

@ -1,67 +0,0 @@
#include "common.h"
enum {
LINES,
WORDS,
BYTES
};
int* count_values(FILE *fp)
{
static int count[3] = {0};
char in_word, c;
in_word = c = 0;
while((c = getc(fp)) != EOF)
if(in_word)
switch(c)
{
case '\n':
count[LINES]++, count[BYTES]++;
in_word = 0;
break;
case ' ':
in_word = 0;
count[BYTES]++;
break;
case '\t':
in_word = 0;
count[BYTES]++;
break;
default:
count[BYTES]++;
break;
}
else
switch(c)
{
case '\n':
count[LINES]++, count[BYTES]++;
break;
case ' ':
count[BYTES]++;
break;
case '\t':
count[BYTES]++;
break;
default:
count[WORDS]++, count[BYTES]++;
in_word = 1;
break;
}
return count;
}
int main(int argc, char **argv)
{
return 0;
err:
}