Fix compile warnings in userspace programs.
This commit is contained in:
parent
d855c6cec7
commit
46d02b784b
|
@ -25,7 +25,7 @@
|
|||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int /*argc*/, char* /*argv*/[])
|
||||
{
|
||||
pid_t slavepid = fork();
|
||||
if ( slavepid < 0 ) { perror("fork"); return 1; }
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int /*argc*/, char* /*argv*/[])
|
||||
{
|
||||
uintmax_t start;
|
||||
if ( uptime(&start) ) { perror("uptime"); return 1; }
|
||||
|
|
|
@ -165,7 +165,7 @@ void Update()
|
|||
Render();
|
||||
}
|
||||
|
||||
int usage(int argc, char* argv[])
|
||||
int usage(int /*argc*/, char* argv[])
|
||||
{
|
||||
printf("usage: %s [OPTIONS]\n", argv[0]);
|
||||
printf("Options:\n");
|
||||
|
|
|
@ -238,7 +238,7 @@ void ReadInput()
|
|||
}
|
||||
}
|
||||
|
||||
int usage(int argc, char* argv[])
|
||||
int usage(int /*argc*/, char* argv[])
|
||||
{
|
||||
printf("usage: %s [OPTIONS]\n", argv[0]);
|
||||
printf("Options:\n");
|
||||
|
@ -272,7 +272,7 @@ int main(int argc, char* argv[])
|
|||
Update();
|
||||
UpdateUI();
|
||||
FlushVGA();
|
||||
if ( soundleft < 0 ) { continue; }
|
||||
if ( /*soundleft < 0*/ false ) { continue; }
|
||||
if ( soundleft <= 50 )
|
||||
{
|
||||
System::Sound::SetFrequency(0);
|
||||
|
|
|
@ -41,7 +41,7 @@ int docat(const char* inputname, int fd)
|
|||
error(0, errno, "read: %s", inputname);
|
||||
return 1;
|
||||
}
|
||||
if ( writeall(1, buffer, bytesread) < bytesread )
|
||||
if ( (ssize_t) writeall(1, buffer, bytesread) < bytesread )
|
||||
{
|
||||
error(0, errno, "write: %s", inputname);
|
||||
return 1;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int /*argc*/, char* /*argv*/[])
|
||||
{
|
||||
printf("\e[H\e[2J");
|
||||
fflush(stdout);
|
||||
|
|
|
@ -67,7 +67,7 @@ int main(int argc, char* argv[])
|
|||
ssize_t bytesread = read(fromfd, buffer, BUFFER_SIZE);
|
||||
if ( bytesread < 0 ) { error(1, errno, "read: %s", frompath); return 1; }
|
||||
if ( bytesread == 0 ) { return 0; }
|
||||
if ( writeall(tofd, buffer, bytesread) < bytesread )
|
||||
if ( (ssize_t) writeall(tofd, buffer, bytesread) < bytesread )
|
||||
{
|
||||
error(1, errno, "write: %s", topath);
|
||||
return 1;
|
||||
|
|
|
@ -136,7 +136,7 @@ unsigned textmode()
|
|||
int oldcursory = -1;
|
||||
while ( true )
|
||||
{
|
||||
if ( oldcursorx != cursorx || oldcursory != cursory )
|
||||
if ( oldcursorx != (int) cursorx || oldcursory != (int) cursory )
|
||||
{
|
||||
cursorto(cursorx, cursory);
|
||||
oldcursorx = cursorx;
|
||||
|
@ -150,7 +150,7 @@ unsigned textmode()
|
|||
ssize_t numbytes = read(0, &codepoint, sizeof(codepoint));
|
||||
if ( !numbytes ) { break; }
|
||||
if ( numbytes < 0 ) { error(1, errno, "read stdin"); }
|
||||
if ( numbytes < sizeof(codepoint) ) {
|
||||
if ( numbytes < (ssize_t) sizeof(codepoint) ) {
|
||||
printf("unexpectedly got %zi bytes\n", numbytes);
|
||||
printf("bytes: %x\n", codepoint);
|
||||
|
||||
|
@ -274,7 +274,7 @@ unsigned confirmquit()
|
|||
ssize_t numbytes = read(0, &codepoint, sizeof(codepoint));
|
||||
if ( !numbytes ) { exit(0); }
|
||||
if ( numbytes < 0 ) { error(1, errno, "read stdin"); }
|
||||
if ( numbytes < sizeof(codepoint) ) { fprintf(stderr, "bad stdin data\n"); exit(1); }
|
||||
if ( numbytes < (ssize_t) sizeof(codepoint) ) { fprintf(stderr, "bad stdin data\n"); exit(1); }
|
||||
if ( !codepoint ) { continue; }
|
||||
|
||||
int kbkey = KBKEY_DECODE(codepoint);
|
||||
|
@ -412,7 +412,7 @@ void run()
|
|||
bufferchanged = false;
|
||||
|
||||
unsigned mode = MODE_TEXT;
|
||||
while ( mode != MODE_QUIT )
|
||||
while ( mode != (unsigned) MODE_QUIT )
|
||||
{
|
||||
switch ( mode )
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <error.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int /*argc*/, char* /*argv*/[])
|
||||
{
|
||||
printf("Please enter the name of one of the following programs:\n");
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ int runsystem()
|
|||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int /*argc*/, char* /*argv*/[])
|
||||
{
|
||||
if ( open("/dev/tty", O_RDONLY) != 0 ) { return 2; }
|
||||
if ( open("/dev/tty", O_WRONLY | O_APPEND) != 1 ) { return 2; }
|
||||
|
|
|
@ -35,34 +35,34 @@ void printbytes(unsigned long long bytes)
|
|||
const unsigned EXBI = 6;
|
||||
|
||||
unsigned unit = BYTES;
|
||||
if ( (bytes >> 10ULL) & 1023 ) { unit = KIBI; }
|
||||
if ( (bytes >> 20ULL) & 1023 ) { unit = MEBI; }
|
||||
if ( (bytes >> 30ULL) & 1023 ) { unit = GIBI; }
|
||||
if ( (bytes >> 40ULL) & 1023 ) { unit = TEBI; }
|
||||
if ( (bytes >> 50ULL) & 1023 ) { unit = PEBI; }
|
||||
if ( (bytes >> 60ULL) & 1023 ) { unit = EXBI; }
|
||||
if ( (bytes >> 10ULL) & 1023ULL ) { unit = KIBI; }
|
||||
if ( (bytes >> 20ULL) & 1023ULL ) { unit = MEBI; }
|
||||
if ( (bytes >> 30ULL) & 1023ULL ) { unit = GIBI; }
|
||||
if ( (bytes >> 40ULL) & 1023ULL ) { unit = TEBI; }
|
||||
if ( (bytes >> 50ULL) & 1023ULL ) { unit = PEBI; }
|
||||
if ( (bytes >> 60ULL) & 1023ULL ) { unit = EXBI; }
|
||||
|
||||
switch ( unit )
|
||||
{
|
||||
case EXBI:
|
||||
printf("%u ZiB ", (bytes >> 60ULL) & 1023);
|
||||
printf("%llu ZiB ", (bytes >> 60ULL) & 1023ULL);
|
||||
case PEBI:
|
||||
printf("%u PiB ", (bytes >> 50ULL) & 1023);
|
||||
printf("%llu PiB ", (bytes >> 50ULL) & 1023ULL);
|
||||
case TEBI:
|
||||
printf("%u TiB ", (bytes >> 40ULL) & 1023);
|
||||
printf("%llu TiB ", (bytes >> 40ULL) & 1023ULL);
|
||||
case GIBI:
|
||||
printf("%u GiB ", (bytes >> 30ULL) & 1023);
|
||||
printf("%llu GiB ", (bytes >> 30ULL) & 1023ULL);
|
||||
case MEBI:
|
||||
printf("%u MiB ", (bytes >> 20ULL) & 1023);
|
||||
printf("%llu MiB ", (bytes >> 20ULL) & 1023ULL);
|
||||
case KIBI:
|
||||
printf("%u KiB", (bytes >> 10ULL) & 1023);
|
||||
printf("%llu KiB", (bytes >> 10ULL) & 1023ULL);
|
||||
break;
|
||||
case BYTES:
|
||||
printf("%u B", (bytes >> 0ULL) & 1023);
|
||||
printf("%llu B", (bytes >> 0ULL) & 1023ULL);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int /*argc*/, char* /*argv*/[])
|
||||
{
|
||||
size_t memused = 0;
|
||||
size_t memtotal = 0;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
int status = 0;
|
||||
|
||||
void on_sigint(int signum)
|
||||
void on_sigint(int /*signum*/)
|
||||
{
|
||||
printf("^C\n");
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ readcmd:
|
|||
char* arg = *argp;
|
||||
if ( arg[0] != '$' ) { continue; }
|
||||
arg = getenv(arg+1);
|
||||
if ( !arg ) { arg = ""; }
|
||||
if ( !arg ) { arg = (char*) ""; }
|
||||
*argp = arg;
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,7 @@ void get_and_run_command()
|
|||
return;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int /*argc*/, char* argv[])
|
||||
{
|
||||
signal(SIGINT, on_sigint);
|
||||
char pidstr[32];
|
||||
|
|
|
@ -79,7 +79,6 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
for ( ssize_t i = 0; i < numbytes; i++ )
|
||||
{
|
||||
bool printed = false;
|
||||
char c = buffer[i];
|
||||
if ( c == '\n' ) { charleft = WIDTH; }
|
||||
bool eol = (c == '\n') || !charleft;
|
||||
|
@ -97,7 +96,7 @@ int main(int argc, char* argv[])
|
|||
ssize_t numbytes = read(0, &codepoint, sizeof(codepoint));
|
||||
if ( !numbytes ) { exit(0); }
|
||||
if ( numbytes < 0 ) { error(1, errno, "read(stdin)"); }
|
||||
if ( numbytes < sizeof(codepoint) ) { error(1, errno, "bad stdin"); }
|
||||
if ( numbytes < (ssize_t) sizeof(codepoint) ) { error(1, errno, "bad stdin"); }
|
||||
if ( !(kbkey = KBKEY_DECODE(codepoint)) ) { continue; }
|
||||
if ( kbkey == KBKEY_DOWN ) { break; }
|
||||
if ( kbkey == KBKEY_PGDOWN ) { linesleft = HEIGHT-1; break; }
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int /*argc*/, char* /*argv*/[])
|
||||
{
|
||||
const size_t WDSIZE = 4096;
|
||||
char wd[WDSIZE];
|
||||
|
|
|
@ -89,8 +89,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
if ( codepoint >= 0x80 ) { continue; }
|
||||
|
||||
char msg[2]; msg[0] = codepoint; msg[1] = '\0';
|
||||
printf(msg);
|
||||
putchar(codepoint & 0xFF);
|
||||
lastwasesc = false;
|
||||
fflush(stdout);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ void PrintElement(size_t num, const char* single, const char* multiple)
|
|||
prefix = ", ";
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int /*argc*/, char* /*argv*/[])
|
||||
{
|
||||
uintmax_t usecssinceboot;
|
||||
if ( uptime(&usecssinceboot) ) { perror("uptime"); return 1; }
|
||||
|
|
Loading…
Reference in New Issue