coreutils

General Software Utilities
git clone http://git.omkov.net/coreutils
Log | Tree | Refs | README | LICENCE | Download

AuthorJamozed <[email protected]>
Date2020-10-25 23:22:47
Commitbe8a914b3b1a96276a2d71d6142eb11bdbf61a2d
Parent88802f3e8cf367bd602441cfe7e174597a20cd59

od: Update formatting

Diffstat

M src/od.c | 26 +++++++++++++++-----------

1 files changed, 15 insertions, 11 deletions

diff --git a/src/od.c b/src/od.c
index bbf6ecd..4e88085 100644
--- a/src/od.c
+++ b/src/od.c
@@ -31,7 +31,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
 /*
-	TODO Refactor and cleanup to bring code up to scratch
 	TODO Improve error handling
 	TODO Implement [[+]offset[.][b]] operand as required by POSIX.
 	TODO Fix segfault when using standard input.
@@ -128,8 +127,8 @@ static inline FILE *fnext(void);
 static inline list_t linit(void);
 static inline void lpush(list_t *list, int i);
 
-static void help(void);
-static void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
 	struct opt opt = OPTGET_INIT; opt.lops = lops; int ret = 0;
@@ -145,18 +144,23 @@ int main(int ac, char *av[]) { A0 = av[0];
 	case 'b': { lpush(&tlist, tb); break; }
 	case 'c': { lpush(&tlist, tl); break; }
 	case 'd': { lpush(&tlist, td); break; }
-	case 'j': { errno = 0; start = bparse(opt.arg); if (errno) {
-		warn("%s: invalid skip value", opt.arg); ret = 1; goto end; } break; }
-	case 'N': { errno = 0; limit = bparse(opt.arg); if (errno) {
+	case 'j': {
+		errno = 0; start = bparse(opt.arg); if (errno) {
+		warn("%s: invalid skip value", opt.arg); ret = 1; goto end; }
+		break;
+	}
+	case 'N': {
+		errno = 0; limit = bparse(opt.arg); if (errno) {
 		warn("%s: invalid limit value", opt.arg); ret = 1; goto end; }
-		Nflag = true; break; }
+		Nflag = true; break;
+	}
 	case 'o': { lpush(&tlist, to); break; }
 	case 's': { lpush(&tlist, ts); break; }
 	case 't': { if (tparse(opt.arg)) { goto end; } break; }
 	case 'v': { vflag = true; break; }
 	case 'x': { lpush(&tlist, tx); break; }
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { ret = 1; goto end; }
 	}
 
@@ -361,7 +365,7 @@ static inline void lpush(list_t *list, int i) {
 	} list->data[list->len++] = i; return;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("od - dump files in various formats\n");
 	puts("usage: od [-bcdosvx] [-A base] [-j skip] [-N count] [-t type] \
 [file...]\n");
@@ -382,7 +386,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils od, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");