Const poision, deregister and use ANSI definitions.

This commit is contained in:
David Malone 2005-11-13 20:50:17 +00:00
parent 84032c0a6d
commit 93aa4a7665
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152396

View File

@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$");
#endif #endif
struct commands { struct commands {
char *c_name; const char *c_name;
int c_code; int c_code;
int c_ronly; int c_ronly;
int c_flags; int c_flags;
@ -119,7 +119,7 @@ struct commands {
}; };
const char *getblksiz(int); const char *getblksiz(int);
void printreg(const char *, u_int, char *); void printreg(const char *, u_int, const char *);
void status(struct mtget *); void status(struct mtget *);
void usage(void); void usage(void);
void st_status (struct mtget *); void st_status (struct mtget *);
@ -127,19 +127,17 @@ int stringtodens (const char *s);
const char *denstostring (int d); const char *denstostring (int d);
int denstobp(int d, int bpi); int denstobp(int d, int bpi);
u_int32_t stringtocomp(const char *s); u_int32_t stringtocomp(const char *s);
const char * comptostring(u_int32_t comp); const char *comptostring(u_int32_t comp);
void warn_eof(void); void warn_eof(void);
int int
main(argc, argv) main(int argc, char *argv[])
int argc;
char *argv[];
{ {
register struct commands *comp; struct commands *comp;
struct mtget mt_status; struct mtget mt_status;
struct mtop mt_com; struct mtop mt_com;
int ch, len, mtfd; int ch, len, mtfd;
char *p, *tape; const char *p, *tape;
if ((tape = getenv("TAPE")) == NULL) if ((tape = getenv("TAPE")) == NULL)
tape = DEFTAPE; tape = DEFTAPE;
@ -197,9 +195,12 @@ main(argc, argv)
errx(1, "%s: unknown compression", errx(1, "%s: unknown compression",
*argv); *argv);
p = ""; p = "";
} else } else {
char *q;
/* allow for hex numbers; useful for density */ /* allow for hex numbers; useful for density */
mt_com.mt_count = strtol(*argv, &p, 0); mt_com.mt_count = strtol(*argv, &q, 0);
p = q;
}
if ((mt_com.mt_count <= if ((mt_com.mt_count <=
((comp->c_flags & ZERO_ALLOWED)? -1: 0) ((comp->c_flags & ZERO_ALLOWED)? -1: 0)
&& ((comp->c_flags & IS_COMP) == 0) && ((comp->c_flags & IS_COMP) == 0)
@ -308,9 +309,9 @@ main(argc, argv)
struct tape_desc { struct tape_desc {
short t_type; /* type of magtape device */ short t_type; /* type of magtape device */
char *t_name; /* printing name */ const char *t_name; /* printing name */
char *t_dsbits; /* "drive status" register */ const char *t_dsbits; /* "drive status" register */
char *t_erbits; /* "error" register */ const char *t_erbits; /* "error" register */
} tapes[] = { } tapes[] = {
{ MT_ISAR, "SCSI tape drive", 0, 0 }, { MT_ISAR, "SCSI tape drive", 0, 0 },
{ 0, NULL, 0, 0 } { 0, NULL, 0, 0 }
@ -320,10 +321,9 @@ struct tape_desc {
* Interpret the status buffer returned * Interpret the status buffer returned
*/ */
void void
status(bp) status(struct mtget *bp)
register struct mtget *bp;
{ {
register struct tape_desc *mt; struct tape_desc *mt;
for (mt = tapes;; mt++) { for (mt = tapes;; mt++) {
if (mt->t_type == 0) { if (mt->t_type == 0) {
@ -349,13 +349,10 @@ status(bp)
* Print a register a la the %b format of the kernel's printf. * Print a register a la the %b format of the kernel's printf.
*/ */
void void
printreg(s, v, bits) printreg(const char *s, u_int v, const char *bits)
const char *s;
register u_int v;
register char *bits;
{ {
register int i, any = 0; int i, any = 0;
register char c; char c;
if (bits && *bits == 8) if (bits && *bits == 8)
printf("%s=%o", s, v); printf("%s=%o", s, v);
@ -382,7 +379,7 @@ printreg(s, v, bits)
} }
void void
usage() usage(void)
{ {
(void)fprintf(stderr, "usage: mt [-f device] command [count]\n"); (void)fprintf(stderr, "usage: mt [-f device] command [count]\n");
exit(1); exit(1);