od: remove -S alias for -t d4, correct octal output, fix typo in comment

This commit is contained in:
Mikael Pettersson
2018-12-26 11:01:58 +01:00
parent 96be8c9d08
commit 8f7f62a23d

11
od/od.c
View File

@@ -1,6 +1,6 @@
/* /*
* od.c -- od clone for binary files with 9-bit bytes * od.c -- od clone for binary files with 9-bit bytes
* Copyright (C) 2013-2015 Mikael Pettersson * Copyright (C) 2013-2015, 2018 Mikael Pettersson
* *
* This file is part of pdp10-tools. * This file is part of pdp10-tools.
* *
@@ -28,7 +28,7 @@
#include "pdp10-inttypes.h" #include "pdp10-inttypes.h"
#include "pdp10-stdio.h" #include "pdp10-stdio.h"
#define VERSION "pdp10-tools od version 0.1, built " __DATE__ " " __TIME__ "\n" #define VERSION "pdp10-tools od version 0.2, built " __DATE__ " " __TIME__ "\n"
struct options { struct options {
/* user options: */ /* user options: */
@@ -38,7 +38,7 @@ struct options {
char output_type; /* 'c', 'd', 'o', 'u', 'x'; 'a' and 'f' are NYI */ char output_type; /* 'c', 'd', 'o', 'u', 'x'; 'a' and 'f' are NYI */
unsigned char output_z; /* type has trailing 'z' */ unsigned char output_z; /* type has trailing 'z' */
unsigned int bytes_per_datum; /* 1, 2, or 4 */ unsigned int bytes_per_datum; /* 1, 2, or 4 */
unsigned long width; /* -w/--with= */ unsigned long width; /* -w/--width= */
unsigned char version; /* -V */ unsigned char version; /* -V */
/* compiled options: */ /* compiled options: */
char numfmt[8]; /* "%0*{,l,ll}[doux]\0" */ char numfmt[8]; /* "%0*{,l,ll}[doux]\0" */
@@ -438,7 +438,7 @@ static int compile_options(const char *progname, struct options *options)
sprintf(options->numfmt, "%% *%s", PDP10_PRIu36); sprintf(options->numfmt, "%% *%s", PDP10_PRIu36);
break; break;
case 'o': case 'o':
sprintf(options->numfmt, "%%0*%s", PDP10_PRIu36); sprintf(options->numfmt, "%%0*%s", PDP10_PRIo36);
break; break;
case 'x': case 'x':
sprintf(options->numfmt, "%%0*%s", PDP10_PRIx36); sprintf(options->numfmt, "%%0*%s", PDP10_PRIx36);
@@ -474,7 +474,7 @@ int main(int argc, char **argv)
for (;;) { for (;;) {
int ch; int ch;
ch = getopt(argc, argv, "VbcdDiloOsSxXA:j:N:t:w::"); ch = getopt(argc, argv, "VbcdDiloOsxXA:j:N:t:w::");
switch (ch) { switch (ch) {
case 'V': case 'V':
options.version = 1; options.version = 1;
@@ -514,7 +514,6 @@ int main(int argc, char **argv)
options.output_z = 0; options.output_z = 0;
options.bytes_per_datum = 2; options.bytes_per_datum = 2;
continue; continue;
case 'S': /* == -t d4 */
case 'i': /* == -t d<sizeof(int)> */ case 'i': /* == -t d<sizeof(int)> */
case 'l': /* == -t d<sizeof(long)> */ case 'l': /* == -t d<sizeof(long)> */
options.output_type = 'd'; options.output_type = 'd';