mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 09:12:44 +00:00
Resolve a couple of warnings and bump WARNS to 6.
This commit is contained in:
parent
67f8f14a6e
commit
2e96a4c68b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=131989
@ -2,6 +2,7 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
PROG= bcd
|
PROG= bcd
|
||||||
|
WARNS?= 6
|
||||||
MAN= bcd.6
|
MAN= bcd.6
|
||||||
MLINKS= bcd.6 ppt.6
|
MLINKS= bcd.6 ppt.6
|
||||||
|
|
||||||
|
@ -80,9 +80,11 @@ static const char rcsid[] =
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
u_short holes[256] = {
|
u_short holes[256] = {
|
||||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
@ -119,15 +121,15 @@ u_short holes[256] = {
|
|||||||
0x202, 0x201, 0x082, 0x806, 0x822, 0x600, 0x282, 0x0
|
0x202, 0x201, 0x082, 0x806, 0x822, 0x600, 0x282, 0x0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void printcard(char *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* i'th bit of w.
|
* i'th bit of w.
|
||||||
*/
|
*/
|
||||||
#define bit(w,i) ((w)&(1<<(i)))
|
#define bit(w,i) ((w)&(1<<(i)))
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
char cardline[80];
|
char cardline[80];
|
||||||
|
|
||||||
@ -150,16 +152,15 @@ main(argc, argv)
|
|||||||
|
|
||||||
#define COLUMNS 48
|
#define COLUMNS 48
|
||||||
|
|
||||||
printcard(str)
|
void
|
||||||
char *str;
|
printcard(char *str)
|
||||||
{
|
{
|
||||||
static char rowchars[] = " 123456789";
|
static char rowchars[] = " 123456789";
|
||||||
int i, row;
|
int i, row;
|
||||||
char *p;
|
char *p;
|
||||||
char *index();
|
|
||||||
|
|
||||||
/* ruthlessly remove newlines and truncate at 48 characters. */
|
/* ruthlessly remove newlines and truncate at 48 characters. */
|
||||||
if ((p = index(str, '\n')))
|
if ((p = strchr(str, '\n')))
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
if (strlen(str) > COLUMNS)
|
if (strlen(str) > COLUMNS)
|
||||||
@ -183,7 +184,7 @@ printcard(str)
|
|||||||
p = str;
|
p = str;
|
||||||
putchar('/');
|
putchar('/');
|
||||||
for (i = 1; *p; i++, p++)
|
for (i = 1; *p; i++, p++)
|
||||||
if (holes[*p])
|
if (holes[(unsigned char)*p])
|
||||||
putchar(*p);
|
putchar(*p);
|
||||||
else
|
else
|
||||||
putchar(' ');
|
putchar(' ');
|
||||||
@ -201,7 +202,7 @@ printcard(str)
|
|||||||
for (row = 0; row <= 11; ++row) {
|
for (row = 0; row <= 11; ++row) {
|
||||||
putchar('|');
|
putchar('|');
|
||||||
for (i = 0, p = str; *p; i++, p++) {
|
for (i = 0, p = str; *p; i++, p++) {
|
||||||
if (bit(holes[*p], 11 - row))
|
if (bit(holes[(unsigned char)*p], 11 - row))
|
||||||
putchar(']');
|
putchar(']');
|
||||||
else
|
else
|
||||||
putchar(rowchars[row]);
|
putchar(rowchars[row]);
|
||||||
|
Loading…
Reference in New Issue
Block a user