From 510358301250cbcf4143dd943f903f8b08bbf025 Mon Sep 17 00:00:00 2001 From: Mid Favila Date: Tue, 13 Sep 2022 18:36:47 -0400 Subject: [PATCH] Remove strcmp. Add manpages for overwrite and vis. --- README | 1 - doc/overwrite.1 | 30 ++++++++++++++++++++++++++++++ doc/vis.1 | 30 ++++++++++++++++++++++++++++++ src/Makefile | 1 - src/strcmp.c | 45 --------------------------------------------- 5 files changed, 60 insertions(+), 47 deletions(-) create mode 100644 doc/overwrite.1 create mode 100644 doc/vis.1 delete mode 100644 src/strcmp.c diff --git a/README b/README index f623373..330bcda 100644 --- a/README +++ b/README @@ -6,7 +6,6 @@ highly portable and to cover common problems that can't be easily solved with shell. - -strcmp: Exits with 0 if the provided pair of strings differs. Otherwise, 1. [done] -vis: Replaces non-printing and non-ASCII characters with octal values. [done] -unfold: Exactly what it sounds like. unfold will attempt to merge lines with fewer than the provided number of characters with the next diff --git a/doc/overwrite.1 b/doc/overwrite.1 new file mode 100644 index 0000000..a705b1d --- /dev/null +++ b/doc/overwrite.1 @@ -0,0 +1,30 @@ +.TH overwrite 1 2021-11-21 me-utils "Extended Userland" + +.SH NAME +overwrite \- Overwrite named file(s) with stdin +.PP +.SH SYNOPSIS +.PP +overwrite [ files ... ] +.SH DESCRIPTION +.PP +Overwrite is an extension to the standard userland that reads standard input +into an internal buffer before writing that internal buffer to each named file. +.SH OPTIONS +.PP +Overwrite accepts no arguments. +.SH ENVIRONMENT +This program requires a C89 compiler. +.SH FILES +/usr/src/me-utils/src/overwrite.c +.SH CONFORMING TO +.PP +Non-standard tool. +.SH NOTES +.PP +Nothing to note. +.SH BUGS +.PP +No bugs known. Please report any to . +.SH SEE ALSO +tee(1p) diff --git a/doc/vis.1 b/doc/vis.1 new file mode 100644 index 0000000..ac95cbc --- /dev/null +++ b/doc/vis.1 @@ -0,0 +1,30 @@ +.TH vis 1 2021-11-21 me-utils "Extended Userland" + +.SH NAME +vis \- Print octal values of invisible characters +.PP +.SH SYNOPSIS +.PP +vis +.SH DESCRIPTION +.PP +Vis is an extension to the standard userland that reads standard input +and replaces any non-printing or blank characters with their octal values. +.SH OPTIONS +.PP +Vis accepts no arguments. +.SH ENVIRONMENT +This program requires a C89 compiler. +.SH FILES +/usr/src/me-utils/src/vis.c +.SH CONFORMING TO +.PP +Non-standard tool. +.SH NOTES +.PP +Nothing to note. +.SH BUGS +.PP +No bugs known. Please report any to . +.SH SEE ALSO +od(1p), printf(1p), echo(1p) diff --git a/src/Makefile b/src/Makefile index 90464b2..a46726c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -5,7 +5,6 @@ PREFIX = /usr BINS = \ overwrite \ - strcmp \ vis all: $(BINS) diff --git a/src/strcmp.c b/src/strcmp.c deleted file mode 100644 index b6fba33..0000000 --- a/src/strcmp.c +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include -#include - -#include "support.h" - -int shortestword(const char* word1, const char* word2) - { - int len = 0; - - for(;;) - { - if(!word1[len]) - { - return 0; - } - else if(!word2[len++]) - { - return 1; - } - } - } - -int main(int argc, char **argv) - { - int swl = 0; - - /* modify the program to support comparison of an arbitrary number of strings */ - if(argc != 3) - { - throw(NEEDARG_FAIL, mastrcat(argv[0], " str1 str2")); - } - - if(!shortestword(argv[1], argv[2])) - { - swl = (int) strlen(argv[1]); - } - else - { - swl = (int) strlen(argv[2]); - } - - return(strncmp(argv[1], argv[2], swl)); - }