Simple warning fixes (#4)

* Fix warnings in config11
* Fix warnings in converters/asc
* Fix warning in converters/decsys
* Fix warning in converters/dtos8cvt
* Fix strncpy() warning
* Fix unsigned/signed warning
* Fix assignment-within-if warning
* Fix assignment-within-if warning
* Fix unused `main` parameters warnings
* Fix assignment-within-if warning
* Fix assignment-within-if warning
* Fix assignment-within-if warning
* Fix assignment-within-if warning
* Fix assignment-within-if warning
* Fix assignment-within-if warning
* config11: Remove accidentally committed debugging code

---------

Co-authored-by: Jan-Benedict Glaw <jbglaw@getslash.de>
This commit is contained in:
Jan-Benedict Glaw
2023-10-10 02:48:38 +02:00
committed by GitHub
parent 6d66f3b9d2
commit a58983117c
15 changed files with 51 additions and 26 deletions

View File

@@ -24,6 +24,7 @@
in this Software without prior written authorization from Robert M Supnik.
*/
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stddef.h>
@@ -57,12 +58,16 @@ char *namtab[RANK_LNT] = {
int main (int argc, char *argv[])
{
(void) argc;
(void) argv;
for ( ;; ) {
for (i = 0; i < RANK_LNT; i++) numctl[i] = 0;
printf ("Enter configuration data\n");
for ( ;; ) {
printf ("Name:\t");
if (gets (inp) == NULL) return 0;
if (fgets (inp, sizeof (inp), stdin) == NULL) return 0;
for (cp = inp; *cp != 0; cp++) if (*cp == '\r' || *cp == '\n') *cp = '\0';
if (*inp == 0) break;
for (cp = inp; *cp != 0; cp++) *cp = toupper (*cp);
for (rank = 0; rank < RANK_LNT; rank++) {
@@ -75,7 +80,7 @@ for ( ;; ) {
printf ("\n");
continue; }
printf ("Number:\t");
gets (inp);
fgets (inp, sizeof (inp), stdin);
errno = 0;
num = strtoul (inp, &ocp, 10);
if (errno || (inp == ocp)) {
@@ -101,7 +106,7 @@ for ( ;; ) {
for (j = 1; j < numctl[i]; j++) {
printf ("\t\t %d\t%06o\n", j + 1, csr);
csr = (csr + modtab[i] + 1) & ~modtab[i]; }
printf (" %\t\tgap\t%06o\n", csr);
printf (" %%\t\tgap\t%06o\n", csr);
}
if ((i + 1) < RANK_LNT) csr = (csr + modtab[i+1] + 1) & ~modtab[i+1];
}

View File

@@ -71,7 +71,7 @@ else mode = MD_WIN;
for (i = 1; i < argc; i++) {
strcpy (oname, argv[i]);
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".new");
if ((ppos = strrchr (oname, '.'))) strcpy (ppos, ".new");
else strcat (oname, ".new");
ifile = fopen (argv[i], "rb");
if (ifile == NULL) {

View File

@@ -42,7 +42,7 @@ if ((argc < 2) || (argv[0] == NULL)) {
for (i = 1; i < argc; i++) {
strcpy (oname, argv[i]);
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".dtp");
if ((ppos = strrchr (oname, '.'))) strcpy (ppos, ".dtp");
else strcat (oname, ".dtp");
ifile = fopen (argv[i], "r");
if (ifile == NULL) {

View File

@@ -42,7 +42,7 @@ if ((argc < 2) || (argv[0] == NULL)) {
for (i = 1; i < argc; i++) {
strcpy (oname, argv[i]);
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".dt8");
if ((ppos = strrchr (oname, '.'))) strcpy (ppos, ".dt8");
else strcat (oname, ".dt8");
ifile = fopen (argv[i], "rb");
if (ifile == NULL) {

View File

@@ -638,12 +638,12 @@ static struct mountedFS *findMount(
uint8_t unitpresent = 0;
unsigned int i;
char *endptr, *ptr;
char origdev[32];
char origdev[33];
if ((ptr = strchr(dev, ':')) != NULL) {
*ptr++ = '\0';
strncpy(origdev, dev, sizeof(origdev));
strncpy(origdev, dev, sizeof(origdev)-1);
/*
* Determine validity of the device name and whether a unit number is

View File

@@ -173,8 +173,9 @@ int main (int argc,
char sig_fwd [SIGNATURE_SIZE], sig_rev [SIGNATURE_SIZE];
char hold, cylinder [CYLINDER_SIZE];
bool identified = false, reversed = false, debug = false;
int i, cyl, from_cyl, to_cyl, remap;
int cyl, from_cyl, to_cyl, remap;
int platter, cylinder_size, hole_size;
unsigned long i;
/* Read the disc image filename. */

View File

@@ -45,8 +45,10 @@ if ((argc < 2) || (argv[0] == NULL)) {
for (i = 1; i < argc; i++) {
strcpy (oname, argv[i]);
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".new");
else strcat (oname, ".new");
if ((ppos = strrchr (oname, '.')))
strcpy (ppos, ".new");
else
strcat (oname, ".new");
ifile = fopen (argv[i], "ra");
if (ifile == NULL) {
printf ("Error opening file: %s\n", argv[i]);

View File

@@ -44,8 +44,10 @@ if ((argc < 2) || (argv[0] == NULL)) {
for (i = 1; i < argc; i++) {
strcpy (oname, argv[i]);
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".new");
else strcat (oname, ".new");
if ((ppos = strrchr (oname, '.')))
strcpy (ppos, ".new");
else
strcat (oname, ".new");
ifile = fopen (argv[i], "rb");
if (ifile == NULL) {
printf ("Error opening file: %s\n", argv[i]);

View File

@@ -38,6 +38,9 @@ char fname[256];
int c, i, j;
unsigned int wd[1024];
(void) argc;
(void) argv;
for (i = 0; i < 8; i++) {
sprintf (fname, "C:\\temp\\m8376\\m8376e%03d.bin", fnum[i]);
fi[i] = fopen (fname, "rb");

View File

@@ -46,8 +46,10 @@ if (argc < 2) {
for (i = 1; i < argc; i++) {
strcpy (oname, argv[i]);
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".tpc");
else strcat (oname, ".tpc");
if ((ppos = strrchr (oname, '.')))
strcpy (ppos, ".tpc");
else
strcat (oname, ".tpc");
ifile = fopen (argv[i], "rb");
if (ifile == NULL) {
printf ("Error opening file: %s\n", argv[i]);

View File

@@ -43,8 +43,10 @@ if ((argc < 2) || (argv[0] == NULL)) {
for (i = 1; i < argc; i++) {
strcpy (oname, argv[i]);
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".tap");
else strcat (oname, ".tap");
if ((ppos = strrchr (oname, '.')))
strcpy (ppos, ".tap");
else
strcat (oname, ".tap");
ifile = fopen (argv[i], "rb");
if (ifile == NULL) {
printf ("Error opening file: %s\n", argv[i]);

View File

@@ -45,8 +45,10 @@ if ((argc < 2) || (argv[0] == NULL)) {
for (i = 1; i < argc; i++) {
strcpy (oname, argv[i]);
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".new");
else strcat (oname, ".new");
if ((ppos = strrchr (oname, '.')))
strcpy (ppos, ".new");
else
strcat (oname, ".new");
ifile = fopen (argv[i], "rb");
if (ifile == NULL) {
printf ("Error opening file: %s\n", argv[i]);

View File

@@ -43,8 +43,10 @@ if ((argc < 2) || (argv[0] == NULL)) {
for (i = 1; i < argc; i++) {
strcpy (oname, argv[i]);
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".new");
else strcat (oname, ".new");
if ((ppos = strrchr (oname, '.')))
strcpy (ppos, ".new");
else
strcat (oname, ".new");
ifile = fopen (argv[i], "rb");
if (ifile == NULL) {
printf ("Error opening file: %s\n", argv[i]);

View File

@@ -33,7 +33,7 @@
int main (int argc, char *argv[])
{
int i, c, ffc;
char *ppos, oline[256], oname[256];
char *ppos, oname[256];
FILE *ifile, *ofile;
if ((argc < 2) || (argv[0] == NULL)) {
@@ -42,8 +42,10 @@ if ((argc < 2) || (argv[0] == NULL)) {
for (i = 1; i < argc; i++) {
strcpy (oname, argv[i]);
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".new");
else strcat (oname, ".new");
if ((ppos = strrchr (oname, '.')))
strcpy (ppos, ".new");
else
strcat (oname, ".new");
ifile = fopen (argv[i], "ra");
if (ifile == NULL) {
printf ("Error opening file: %s\n", argv[i]);

View File

@@ -97,8 +97,10 @@ for (i = 1, numf = 0; i < argc; i++) {
maxaddr[0], k, maxaddr[k]);
return 0; } }
strcpy (oname, argv[i]);
if (ppos = strrchr (oname, '.')) strcpy (ppos, ".bin");
else strcat (oname, ".bin");
if ((ppos = strrchr (oname, '.')))
strcpy (ppos, ".bin");
else
strcat (oname, ".bin");
ofile = fopen (oname, "wb");
if (ofile == NULL) {
printf ("Error opening file: %s\n", oname);