Skip to content

Commit

Permalink
[cmds] Another pass at reducing build compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaerr committed Dec 29, 2022
1 parent 233d23d commit b849dd1
Show file tree
Hide file tree
Showing 26 changed files with 106 additions and 143 deletions.
6 changes: 2 additions & 4 deletions elkscmd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ include $(BASEDIR)/Make.defs

# All subdirectories to build & clean

# TODO: broken command compilations
# byacc screen m4 xvi nano
# TODO: broken command compilations: byacc m4 xvi
# unused commands but working compilations: mtools nano prems
SUBDIRS = \
lib \
ash \
Expand All @@ -32,9 +32,7 @@ SUBDIRS = \
minix2 \
minix3 \
misc_utils \
mtools \
nano-X \
prems \
sash \
screen \
cron \
Expand Down
2 changes: 1 addition & 1 deletion elkscmd/ash/cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static char sccsid[] = "@(#)cd.c 5.2 (Berkeley) 3/13/91";
#ifdef __STDC__
STATIC int docd(char *, int, int);
STATIC void updatepwd(char *);
STATIC void getpwd(void);
/*STATIC void getpwd(void);*/
STATIC char *getcomponent(void);
#else
STATIC int docd();
Expand Down
6 changes: 3 additions & 3 deletions elkscmd/ash/eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,11 +666,11 @@ evalcommand(cmd, flags, backcmd)

/* Fork off a child process if necessary. */
if (cmd->ncmd.backgnd
|| cmdentry.cmdtype == CMDNORMAL && (flags & EV_EXIT) == 0
|| (flags & EV_BACKCMD) != 0
|| (cmdentry.cmdtype == CMDNORMAL && (flags & EV_EXIT) == 0)
|| ((flags & EV_BACKCMD) != 0
&& (cmdentry.cmdtype != CMDBUILTIN
|| cmdentry.u.index == DOTCMD
|| cmdentry.u.index == EVALCMD)) {
|| cmdentry.u.index == EVALCMD))) {
jp = makejob(cmd, 1);
mode = cmd->ncmd.backgnd;
if (flags & EV_BACKCMD) {
Expand Down
12 changes: 6 additions & 6 deletions elkscmd/ash/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ hashcmd(argc, argv) char **argv; {
while ((name = *argptr) != NULL) {
if ((cmdp = cmdlookup(name, 0)) != NULL
&& (cmdp->cmdtype == CMDNORMAL
|| cmdp->cmdtype == CMDBUILTIN && builtinloc >= 0))
|| (cmdp->cmdtype == CMDBUILTIN && builtinloc >= 0)))
delete_cmd_entry();
find_command(name, &entry, 1);
if (verbose) {
Expand Down Expand Up @@ -567,7 +567,7 @@ hashcd() {
for (pp = cmdtable ; pp < &cmdtable[CMDTABLESIZE] ; pp++) {
for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) {
if (cmdp->cmdtype == CMDNORMAL
|| cmdp->cmdtype == CMDBUILTIN && builtinloc >= 0)
|| (cmdp->cmdtype == CMDBUILTIN && builtinloc >= 0))
cmdp->rehash = 1;
}
}
Expand Down Expand Up @@ -599,8 +599,8 @@ changepath(newval)
for (;;) {
if (*old != *new) {
firstchange = index;
if (*old == '\0' && *new == ':'
|| *old == ':' && *new == '\0')
if ((*old == '\0' && *new == ':')
|| (*old == ':' && *new == '\0'))
firstchange++;
old = new; /* ignore subsequent differences */
}
Expand Down Expand Up @@ -637,8 +637,8 @@ clearcmdentry(firstchange) {
for (tblp = cmdtable ; tblp < &cmdtable[CMDTABLESIZE] ; tblp++) {
pp = tblp;
while ((cmdp = *pp) != NULL) {
if (cmdp->cmdtype == CMDNORMAL && cmdp->param.index >= firstchange
|| cmdp->cmdtype == CMDBUILTIN && builtinloc >= firstchange) {
if ((cmdp->cmdtype == CMDNORMAL && cmdp->param.index >= firstchange)
|| (cmdp->cmdtype == CMDBUILTIN && builtinloc >= firstchange)) {
*pp = cmdp->next;
ckfree(cmdp);
} else {
Expand Down
4 changes: 2 additions & 2 deletions elkscmd/ash/expand.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ evalvar(p, full)
val = NULL;
} else {
val = lookupvar(var);
if (val == NULL || (flags & VSNUL) && val[0] == '\0') {
if (val == NULL || ((flags & VSNUL) && val[0] == '\0')) {
val = NULL;
set = 0;
} else
Expand Down Expand Up @@ -890,7 +890,7 @@ expmeta(enddir, name)
*endname++ = '\0';
}
matchdot = 0;
if (start[0] == '.' || start[0] == CTLESC && start[1] == '.')
if (start[0] == '.' || (start[0] == CTLESC && start[1] == '.'))
matchdot++;
while (! int_pending() && (dp = readdir(dirp)) != NULL) {
if (dp->d_name[0] == '.' && ! matchdot)
Expand Down
2 changes: 1 addition & 1 deletion elkscmd/ash/jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ cmdputs(s)
subtype = 0;
} else if (c == CTLENDVAR) {
*q++ = '}';
} else if (c == CTLBACKQ | c == CTLBACKQ+CTLQUOTE)
} else if (c == CTLBACKQ || c == CTLBACKQ+CTLQUOTE)
cmdnleft++; /* ignore it */
else
*q++ = c;
Expand Down
2 changes: 1 addition & 1 deletion elkscmd/ash/machdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ union align {
char *cp;
};

#define ALIGN(nbytes) ((nbytes) + sizeof(union align) - 1 &~ (sizeof(union align) - 1))
#define ALIGN(nbytes) (((nbytes) + sizeof(union align) - 1) &~ (sizeof(union align) - 1))
#endif
2 changes: 1 addition & 1 deletion elkscmd/ash/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ options(cmdline) {
argptr++;
if ((c = *p++) == '-') {
val = 1;
if (p[0] == '\0' || p[0] == '-' && p[1] == '\0') {
if (p[0] == '\0' || (p[0] == '-' && p[1] == '\0')) {
if (!cmdline) {
/* "-" means turn off -x and -v */
if (p[0] == '\0')
Expand Down
2 changes: 1 addition & 1 deletion elkscmd/ash/var.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ bltinlookup(name, doall)
for (v = *hashvar(name) ; v ; v = v->next) {
if (varequal(v->text, name)) {
if (v->flags & VUNSET
|| ! doall && (v->flags & VEXPORT) == 0)
|| (! doall && (v->flags & VEXPORT) == 0))
return NULL;
return strchr(v->text, '=') + 1;
}
Expand Down
2 changes: 1 addition & 1 deletion elkscmd/minix1/cut.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void get_args()

void cut()
{
int i, j, length, maxcol;
int i, j, length, maxcol = 0;
char *columns[MAX_FIELD];

while (fgets(line, BUFSIZ, fd)) {
Expand Down
6 changes: 2 additions & 4 deletions elkscmd/minix1/uniq.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static int ourgetline(char *buf, int count)
int main(int argc, char **argv)
{
char *p;
int inf = -1, outf;
int inf = -1;

setbuf(stdout, buffer);
for (--argc, ++argv; argc > 0 && (**argv == '-' || **argv == '+');
Expand Down Expand Up @@ -161,9 +161,7 @@ int main(int argc, char **argv)
xfopen(*argv++, "r");
argc--;
}
if (argc == 0)
outf = 1;
else {
if (argc > 0) {
fclose(stdout);
xfopen(*argv++, "w");
argc--;
Expand Down
3 changes: 2 additions & 1 deletion elkscmd/minix2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ include $(BASEDIR)/Make.rules
###############################################################################

# TODO: lpd man mt install # Do not compile.
PRGS=env lp pwdauth remsync synctree tget
# compiling but unused: pwdauth
PRGS=env lp remsync synctree tget

env: env.o $(TINYPRINTF)
$(LD) $(LDFLAGS) -o env env.o $(TINYPRINTF) $(LDLIBS)
Expand Down
6 changes: 3 additions & 3 deletions elkscmd/minix2/tget.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <string.h>
#include <termcap.h>

void fputchar(int c)
int fputchar(int c)
{
putchar(c);
return putchar(c);
}

void usage(void)
Expand All @@ -20,7 +20,7 @@ void usage(void)
exit(-1);
}

void main(int argc, char **argv)
int main(int argc, char **argv)
{
char termbuf[1024];
char string[256], *pstr;
Expand Down
5 changes: 2 additions & 3 deletions elkscmd/minix3/find.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ struct oper {
char **ipp; /* pointer to next argument during parsing */
char *prog; /* program name (== argv [0]) */
char *epath; /* value of PATH environment string */
long current_time; /* for computing age */
time_t current_time; /* for computing age */
int tty; /* fd for /dev/tty when using -ok */
int xdev_flag = 0; /* cross device boundaries? */
int devnr; /* device nr of first inode */
Expand Down Expand Up @@ -273,7 +273,7 @@ char *path, *last;
struct node *pred;
{
char spath[PATH_MAX];
register char *send = spath, *p;
register char *send = spath;
struct stat st;
DIR *dp;
struct dirent *de;
Expand Down Expand Up @@ -310,7 +310,6 @@ struct node *pred;
}
send[-1] = '/';
while ((de = readdir(dp)) != NULL) {
p = de->d_name;
if ((de->d_name[0] != '.') || ((de->d_name[1])
&& ((de->d_name[1] != '.')
|| (de->d_name[2])))) {
Expand Down
2 changes: 1 addition & 1 deletion elkscmd/misc_utils/ed.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ printlines(num1, num2, expandflag)
* Show control characters and characters with the
* high bit set specially.
*/
cp = lp->data;
cp = (unsigned char *)lp->data;
count = lp->len;
if ((count > 0) && (cp[count - 1] == '\n'))
count--;
Expand Down
4 changes: 3 additions & 1 deletion elkscmd/misc_utils/miniterm.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@ int main(int argc, char **argv)
speed_t baudrate = 9600;
enum terminal_mode mode = MODE_TEXT;
bool escape = false, rtscts = false;
bool enable_rts = false, enable_dtr = false;
bool add_lf = false;
const char *device = "/dev/ttyS0";
bool no_reset = false;
/*bool enable_rts = false, enable_dtr = false;*/

while ((ch = getopt(argc, argv, "s:SrdRlxh")) != -1) {
switch (ch) {
Expand All @@ -381,12 +381,14 @@ int main(int argc, char **argv)
case 'r':
rtscts = true;
break;
#if later
case 'd':
enable_dtr = true;
break;
case 'R':
enable_rts = true;
break;
#endif
case 'l':
add_lf = true;
break;
Expand Down
7 changes: 4 additions & 3 deletions elkscmd/nano-X/demos/landmine.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#if UNIX
#include <fcntl.h>
#include <unistd.h>
Expand Down Expand Up @@ -756,10 +757,10 @@ drawbutton(window, label)
GR_SIZE height;
GR_SIZE base;

GrGetGCTextSize(buttongc, label, strlen(label), &width, &height, &base);
GrGetGCTextSize(buttongc, (unsigned char *)label, strlen(label), &width, &height, &base);
GrText(window, buttongc, (BUTTONWIDTH - width) / 2,
(BUTTONHEIGHT - height) / 2 + height - 1,
label, strlen(label));
(unsigned char *)label, strlen(label));
}


Expand Down Expand Up @@ -902,7 +903,7 @@ static void printline(GR_COORD row, char * fmt, ...)
}
if (width) {
GrText(statwid, statgc, charxpos, charypos,
cp - cc, cc);
(unsigned char *)cp - cc, cc);
charxpos += width;
}

Expand Down
3 changes: 2 additions & 1 deletion elkscmd/nano-X/demos/nterm.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
#include "nano-X.h"
/*
* Nano-X terminal emulator
Expand Down Expand Up @@ -189,7 +190,7 @@ GR_SIZE base; /* height of baseline */

void text_init()
{
GrGetGCTextSize(gc1, "A", 1, &width, &height, &base);
GrGetGCTextSize(gc1, (unsigned char *)"A", 1, &width, &height, &base);
}

void char_del(GR_COORD x, GR_COORD y)
Expand Down
10 changes: 6 additions & 4 deletions elkscmd/nano-X/demos/world.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include "nano-X.h"

Expand Down Expand Up @@ -436,7 +438,7 @@ showcoords(show)
mintostr(coordstring + strlen(coordstring), curlat);
}

GrText(mapwid, xorgc, coordx, coordy, coordstring, strlen(coordstring));
GrText(mapwid, xorgc, coordx, coordy, (unsigned char *)coordstring, strlen(coordstring));
coordvisible = show;
}

Expand All @@ -454,7 +456,7 @@ mintostr(buf, min)
min = -min;
*buf++ = '-';
}
sprintf(buf, "%d'%02d", min / 60, min % 60);
sprintf(buf, "%d'%02d", (int)min / 60, (int)min % 60);
}


Expand Down Expand Up @@ -512,9 +514,9 @@ load(fn)
register DBPOINT *pp;
DBPOINT *pend;
FLOAT x, y, LonPrv, LatPrv;
long oldlong;
long oldlong = 0;
GR_COORD xnew, ynew;
GR_COORD xold, yold;
GR_COORD xold = 0, yold = 0;
GR_BOOL is_out;
GR_BOOL was_out;
GR_BOOL newseg;
Expand Down
6 changes: 4 additions & 2 deletions elkscmd/nano-X/drivers/vgaplan4.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ ega_init(PSD psd)

#if MSDOS | ELKS
/* fill in screendevice struct if not framebuffer driver*/
psd->addr = SCREENBASE; /* long ptr -> short on 16bit sys*/
psd->addr = (char *)SCREENBASE; /* long ptr -> short on 16bit sys*/
psd->linelen = BYTESPERLINE;
#endif
psd->size = 65535;
#else
/* framebuffer mmap size*/
psd->size = 0x10000;
#endif

/* Set up some default values for the VGA Graphics Registers. */
set_enable_sr (0x0f);
Expand Down
4 changes: 2 additions & 2 deletions elkscmd/nano-X/engine/devdraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ GdOpenScreen(void)
extern RGBENTRY stdpal1[2];
extern RGBENTRY stdpal2[4];
extern RGBENTRY stdpal4[16];
extern RGBENTRY stdpal8[256];
/*extern RGBENTRY stdpal8[256];*/

if(scrdev.Open(&scrdev) < 0)
return -1;
Expand Down Expand Up @@ -588,7 +588,7 @@ GdFillRect(PSD psd, COORD x1, COORD y1, COORD width, COORD height)
void
GdGetTextSize(PSD psd, char *str, int cc, COORD *pwidth, COORD *pheight)
{
psd->GetTextSize(psd, str, cc, pwidth, pheight, gr_font);
psd->GetTextSize(psd, (unsigned char *)str, cc, pwidth, pheight, gr_font);
}

/* Draw a text string at a specifed coordinates in the foreground color
Expand Down
1 change: 1 addition & 0 deletions elkscmd/nano-X/engine/devmouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Bradley D. LaRonde added absolute coordinates and z (pen pressure) Oct-1999
*/
#include "device.h"
#include <string.h>

static COORD xpos; /* current x position of mouse */
static COORD ypos; /* current y position of mouse */
Expand Down
Loading

0 comments on commit b849dd1

Please sign in to comment.