-exprcmd(argc, argv) char **argv; {
+int exprcmd(argc, argv) int argc; char **argv; {
char **ap;
char *opname;
char c;
if (valsp->type == INTEGER) {
p = stalloc(32);
#ifdef SHELL
- fmtstr(p, 32, "%d", valsp->u.num);
+ fmtstr(p, 32, "%ld", valsp->u.num);
#else
sprintf(p, "%d", valsp->u.num);
#endif
int in_waitcmd = 0; /* are we in waitcmd()? */
int in_dowait = 0; /* are we in dowait()? */
volatile sig_atomic_t breakwaitcmd = 0; /* should wait be terminated? */
+#if JOBS
static int ttyfd = -1;
+#endif
#ifndef WCOREDUMP
#define WCOREDUMP(s) ((s) & 0x80)
{
char s[64];
struct procstat *ps;
+#if JOBS
struct job *j;
+#endif
int col, curr, i, jobno, prev, procno;
char c;
int i;
struct timeval tv;
char *tvptr;
+#ifndef __minix
#ifndef __minix_vmd
fd_set ifds;
#endif
struct termios told, tnew;
int tsaved;
+#endif
rflag = 0;
prompt = NULL;
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)output.c 8.1 (Berkeley) 5/31/93";
+#endif
#endif /* not lint */
/*
}
/* Both files are now open. Do the copying. */
- if (!rflag && strncmp((sp->namep + n - 2), ".Z", (size_t)2) ||
- rflag && !strncmp((sp->namep + n - 2), ".Z", (size_t)2)) {
+ if ((!rflag && strncmp((sp->namep + n - 2), ".Z", (size_t)2)) ||
+ (rflag && !strncmp((sp->namep + n - 2), ".Z", (size_t)2))) {
if (zflag && (rflag || (n <= (NAME_SIZE - 2)))) {
close(fd1);
close(fd2);
if (c1 != c2) {
if (!loud) {
if (!silent) {
- printf("%s %s differ: char %ld, line %ld\n",
+ printf("%s %s differ: char %d, line %d\n",
name1, name2, pos + i1, line);
}
return(1);
}
- printf("%10ld %3o %3o\n", pos + i1, c1 & 0xFF, c2 & 0xFF);
+ printf("%10d %3o %3o\n", pos + i1, c1 & 0xFF, c2 & 0xFF);
differ = 1;
}
if (c1 == '\n') line++;
if (unlink(ifname))
perror(ifname);
*/
- if(!quiet)
+ if(!quiet) {
if(do_decomp == 0)
fprintf(stderr, " -- compressed to %s", ofname);
else
fprintf(stderr, " -- decompressed to %s", ofname);
+ }
return; /* Successful return */
}
int main(int argc, char *argv []);
void getgeom(void);
-int getboot(char *buffer);
-int putboot(char *buffer);
+void getboot(char *buffer);
+void putboot(char *buffer);
void load_from_file(void);
void save_to_file(void);
-int dpl_partitions(int rawflag);
+void dpl_partitions(int rawflag);
int chk_table(void);
-int sec_to_hst(long logsec, unsigned char *hd, unsigned char *sec,
+void sec_to_hst(long logsec, unsigned char *hd, unsigned char *sec,
unsigned char *cyl);
-int mark_partition(struct part_entry *pe);
+void mark_partition(struct part_entry *pe);
void change_partition(struct part_entry *entry);
-int get_a_char(void);
-int print_menu(void);
+char get_a_char(void);
+void print_menu(void);
void adj_base(struct part_entry *pe);
void adj_size(struct part_entry *pe);
struct part_entry *ask_partition(void);
0000,0000,
};
-main(argc, argv)
-int argc;
-char *argv[];
+int main(int argc, char *argv[])
{
int argn;
char *argp;
#ifdef UNIX
-void getgeom()
+void getgeom(void)
{
struct partition geom;
int fd, r;
static int devfd;
-getboot(buffer)
-char *buffer;
+void getboot(char *buffer)
{
devfd = open(devname, 2);
if (devfd < 0) {
}
}
-putboot(buffer)
-char *buffer;
+void putboot(char *buffer)
{
if (lseek(devfd, 0L, 0) < 0) {
printf("Seek error during write\n");
#endif
-void load_from_file()
+void load_from_file(void)
{
/* Load buffer from file */
}
-void save_to_file()
+void save_to_file(void)
{
/* Save to file */
}
-dpl_partitions(rawflag)
-int rawflag;
+void dpl_partitions(int rawflag)
{
/* Display partition table */
devnum = 1;
for (i1 = 1, pe1 = (struct part_entry *) &secbuf[PART_TABLE_OFF];
i1 <= NR_PARTITIONS; ++i1, ++pe1)
- if (pe1->lowsec == 0 && pe->lowsec == 0 && pe1 < pe ||
- pe1->lowsec != 0 &&
- (pe->lowsec == 0 || pe->lowsec > pe1->lowsec))
+ if ((pe1->lowsec == 0 && pe->lowsec == 0 && pe1 < pe) ||
+ (pe1->lowsec != 0 &&
+ (pe->lowsec == 0 || pe->lowsec > pe1->lowsec)))
++devnum; /* pe1 contents < pe contents */
if (devnum != i) {
orderfootnote = '#';
}
-int chk_table()
+int chk_table(void)
{
/* Check partition table */
if (pe->size == 0) continue;
seenpart = 1;
for (i1 = i + 1, pe1 = pe + 1; i1 <= NR_PARTITIONS; ++i1, ++pe1) {
- if (pe->lowsec >= pe1->lowsec &&
- pe->lowsec < pe1->lowsec + pe1->size ||
- pe->lowsec + pe->size - 1 >= pe1->lowsec &&
- pe->lowsec + pe->size - 1 < pe1->lowsec + pe1->size)
+ if ((pe->lowsec >= pe1->lowsec &&
+ pe->lowsec < pe1->lowsec + pe1->size) ||
+ (pe->lowsec + pe->size - 1 >= pe1->lowsec &&
+ pe->lowsec + pe->size - 1 < pe1->lowsec + pe1->size))
{
printf("Overlap between partitions %d and %d\n",
i, i1);
return(status);
}
-sec_to_hst(logsec, hd, sec, cyl)
-long logsec;
-unsigned char *hd, *sec, *cyl;
+void sec_to_hst(long logsec, unsigned char *hd, unsigned char *sec,
+ unsigned char *cyl)
{
/* Convert a logical sector number to head / sector / cylinder */
*hd = (logsec % (nhead * nsec)) / nsec;
}
-mark_partition(pe)
-struct part_entry *pe;
+void mark_partition(struct part_entry *pe)
{
/* Mark a partition as being of type MINIX. */
}
}
-void change_partition(entry)
-struct part_entry *entry;
+void change_partition(struct part_entry *entry)
{
/* Get partition info : first & last cylinder */
}
}
-get_a_char()
+char get_a_char(void)
{
/* Read 1 character and discard rest of line */
char buf[80];
- int ch;
if (!mygets(buf, (int) sizeof buf)) return(0);
return(*buf);
}
-print_menu()
+void print_menu(void)
{
printf("Type a command letter, then a carriage return:\n");
printf(" + - explain any footnotes (+, -, #)\n");
struct SREGS sregs;
int drivenum;
-getboot(buffer)
-char *buffer;
+void getboot(char *buffer)
{
/* Read boot sector */
}
-putboot(buffer)
-char *buffer;
+void putboot(char *buffer)
{
/* Write boot sector */
#endif
-void adj_base(pe)
-struct part_entry *pe;
+void adj_base(struct part_entry *pe)
{
/* Adjust base sector of partition, usually to make it even. */
return;
if (pe->lowsec + adj < 1)
printf(
- "\t\tThat would make the base %d and too small\n", pe->lowsec + adj);
+ "\t\tThat would make the base %lu and too small\n", pe->lowsec + adj);
else if (pe->size - adj < 1)
printf(
- "\t\tThat would make the size %d and too small\n", pe->size - adj);
+ "\t\tThat would make the size %lu and too small\n", pe->size - adj);
else
break;
}
pe->lowsec, pe->size);
}
-void adj_size(pe)
-struct part_entry *pe;
+void adj_size(struct part_entry *pe)
{
/* Adjust size of partition by reducing high sector. */
if (!get_an_int("\tEnter adjustment to size (an integer): ", &adj))
return;
if (pe->size + adj >= 1) break;
- printf("\t\tThat would make the size %d and too small \n",
+ printf("\t\tThat would make the size %lu and too small \n",
pe->size + adj);
}
pe->size += adj;
return((struct part_entry *) &secbuf[PART_TABLE_OFF] + (num - 1));
}
-void footnotes()
+void footnotes(void)
{
/* Explain the footnotes. */
}
}
-int get_an_int(prompt, intptr)
-char *prompt;
-int *intptr;
+int get_an_int(char *prompt, int *intptr)
{
/* Read an int from the start of line of stdin, discard rest of line. */
}
}
-void list_part_types()
+void list_part_types(void)
{
/* Print all known partition types. */
if (column != 0) putchar('\n');
}
-void mark_npartition(pe)
-struct part_entry *pe;
+void mark_npartition(struct part_entry *pe)
{
/* Mark a partition with arbitrary type. */
printf("Partition type changed to 0x%02x (%s)\n", type, systype(type));
}
-int mygets(buf, length)
-char *buf;
-int length; /* as for fgets(), but must be >= 2 */
+int mygets(char *buf, int length)
{
/* Get a non-empty line of maximum length 'length'. */
}
}
-char *systype(type)
-int type;
+char *systype(int type)
{
/* Convert system indicator into system name. */
/* asw 01.03.95: added types based on info in kjb's part.c and output
}
}
-void toggle_active(pe)
-struct part_entry *pe;
+void toggle_active(struct part_entry *pe)
{
/* Toggle active flag of a partition. */
printf("Partition changed to %sactive\n", pe->bootind ? "" : "in");
}
-void usage()
+void usage(void)
{
/* Print usage message and exit. */
stat_display(struct xferstat *xs, int force)
{
struct timeval now;
+#if !defined(__minix)
int ctty_pgrp;
+#endif /* !defined(__minix) */
/* Minix returns "Not a typewriter error" */
#if defined(TIOCGPGRP) && !defined(__minix)
track_pos= (off_t) (cyl * NR_HEADS + head) * nr_sectors * SECTOR_SIZE;
if (lseek(ffd, track_pos, SEEK_SET) == -1) {
fprintf(stderr,
- "format: seeking to cyl %u, head %u (pos %ld) failed: %s\n",
+ "format: seeking to cyl %u, head %u (pos %d) failed: %s\n",
cyl, head, track_pos, strerror(errno));
exit(1);
}
track_pos= (off_t) (cyl * NR_HEADS + head) * nr_sectors * SECTOR_SIZE;
if (lseek(vfd, track_pos, SEEK_SET) == -1) {
fprintf(stderr,
- "format: seeking to cyl %u, head %u (pos %ld) failed: %s\n",
+ "format: seeking to cyl %u, head %u (pos %d) failed: %s\n",
cyl, head, track_pos, strerror(errno));
exit(1);
}
for (sector= 0; sector < nr_sectors; sector++) {
if (lseek(vfd, track_pos, SEEK_SET) == -1) {
fprintf(stderr,
- "format: seeking to cyl %u, head %u, sector %u (pos %ld) failed: %s\n",
+ "format: seeking to cyl %u, head %u, sector %u (pos %d) failed: %s\n",
cyl, head, sector, track_pos, strerror(errno));
exit(1);
}
switch (read(vfd, buf, SECTOR_SIZE)) {
case -1:
fprintf(stderr,
- "format: bad sector at cyl %u, head %u, sector %u (pos %ld)\n",
+ "format: bad sector at cyl %u, head %u, sector %u (pos %d)\n",
cyl, head, sector, track_pos);
bad_count++;
break;
/* Fine. */
break;
default:
- fprintf(stderr, "format: short read at pos %ld\n",
+ fprintf(stderr, "format: short read at pos %d\n",
track_pos);
bad_count++;
}
#define COOKIEJAR "/usr/lib/fortune.dat"
+#if 0
static char *Copyright = "\0Copyright (c) 1990 Bert Reuling";
+#endif
static unsigned long seed;
int main(int argc, char **argv);
/* Initialize the variables used by this program. */
void initvars()
{
- register level;
+ register int level;
nregular = ndirectory = nblkspec = ncharspec =
nbadinode = nsock = npipe = nsyml = 0;
void printname(s)
char *s;
{
- register n = MFS_NAME_MAX;
+ register int n = MFS_NAME_MAX;
int c;
do {
char ***argv, *type;
{
register char **list = *argv;
- register empty = 1;
+ register int empty = 1;
while (getnumber(**argv) != NO_BIT) {
(*argv)++;
/* Most of the following atol's enrage lint, for good reason. */
printf("ninodes = %u", sb.s_ninodes);
if (input(buf, 80)) sb.s_ninodes = atol(buf);
- printf("nzones = %ld", sb.s_zones);
+ printf("nzones = %d", sb.s_zones);
if (input(buf, 80)) sb.s_zones = atol(buf);
printf("imap_blocks = %u", sb.s_imap_blocks);
if (input(buf, 80)) sb.s_imap_blocks = atol(buf);
if (input(buf, 80)) sb.s_firstdatazone_old = atol(buf);
printf("log_zone_size = %u", sb.s_log_zone_size);
if (input(buf, 80)) sb.s_log_zone_size = atol(buf);
- printf("maxsize = %ld", sb.s_max_size);
+ printf("maxsize = %d", sb.s_max_size);
if (input(buf, 80)) sb.s_max_size = atol(buf);
- printf("block size = %ld", sb.s_block_size);
+ printf("block size = %d", sb.s_block_size);
if (input(buf, 80)) sb.s_block_size = atol(buf);
if (yes("ok now")) {
devwrite(0, OFFSET_SUPER_BLOCK, (char *) &sb, sizeof(sb));
fatal("first data zone too small");
if (sb.s_log_zone_size < 0) fatal("zone size < block size");
if (sb.s_max_size <= 0) {
- printf("warning: invalid max file size %ld\n", sb.s_max_size);
+ printf("warning: invalid max file size %d\n", sb.s_max_size);
sb.s_max_size = LONG_MAX;
}
}
/* Check the super block for reasonable contents. */
void chksuper()
{
- register n;
+ register int n;
register off_t maxsize;
n = bitmapsize((bit_t) sb.s_ninodes + 1, block_size);
if(maxsize <= 0)
maxsize = LONG_MAX;
if (sb.s_max_size != maxsize) {
- printf("warning: expected max size to be %ld ", maxsize);
- printf("instead of %ld\n", sb.s_max_size);
+ printf("warning: expected max size to be %d ", maxsize);
+ printf("instead of %d\n", sb.s_max_size);
}
if(sb.s_flags & MFSFLAG_MANDATORY_MASK) {
block_nr bno;
int nblk;
{
- register i;
+ register int i;
register bitchunk_t *p;
p = bitmap;
block_nr bno;
int nblk;
{
- register i;
+ register int i;
register bitchunk_t *p = bitmap;
for (i = 0; i < nblk; i++, bno++, p += WORDS_PER_BLOCK)
while ((bit = getnumber(*list++)) != NO_BIT)
if (bit < lwb || bit >= upb) {
if (bitmap == spec_imap)
- printf("inode number %ld ", bit);
+ printf("inode number %d ", bit);
else
- printf("zone number %ld ", bit);
+ printf("zone number %d ", bit);
printf("out of range (ignored)\n");
} else
setbit(bitmap, bit - lwb + 1);
if ((w1 ^ w2) & 1 && ++(*n) % MAXPRINT == 0 && *report &&
(!repair || automatic || yes("stop this listing")))
*report = 0;
- else if (*report)
+ else {
+ if (*report)
if ((w1 & 1) && !(w2 & 1))
- printf("%s %ld is missing\n", type, bit);
+ printf("%s %d is missing\n", type, bit);
else if (!(w1 & 1) && (w2 & 1))
- printf("%s %ld is not free\n", type, bit);
+ printf("%s %d is not free\n", type, bit);
+ }
}
/* Check if the given (correct) bitmap is identical with the one that is
case I_BLOCK_SPECIAL:
printf(" %2x,%2x ", major(ip->i_zone[0]), minor(ip->i_zone[0]));
break;
- default: printf("%7ld ", ip->i_size);
+ default: printf("%7d ", ip->i_size);
}
printpath(0, 1);
}
}
} else if (pos != (dp->mfs_d_name[1] ? DIR_ENTRY_SIZE : 0)) {
make_printable_name(printable_name, dp->mfs_d_name, sizeof(dp->mfs_d_name));
- printf("warning: %s has offset %ld in ", printable_name, pos);
+ printf("warning: %s has offset %d in ", printable_name, pos);
printpath(1, 0);
printf("%s is linked to %u)\n", printable_name, dp->d_inum);
setbit(spec_imap, (bit_nr) ino);
/* Check the name in a directory entry. */
int chkname(ino_t ino, dir_struct *dp)
{
- register n = MFS_NAME_MAX + 1;
+ register int n = MFS_NAME_MAX + 1;
register char *p = dp->mfs_d_name;
if (*p == '\0') {
{
dir_struct dirblk[CDIRECT];
register dir_struct *dp;
- register n, dirty;
+ register int n, dirty;
long block= ztob(zno);
register long offset = 0;
register off_t size = 0;
{
printf("%s zone in ", mess);
printpath(1, 0);
- printf("zno = %ld, type = ", zno);
+ printf("zno = %d, type = ", zno);
switch (level) {
case 0: printf("DATA"); break;
case 1: printf("SINGLE INDIRECT"); break;
case 2: printf("DOUBLE INDIRECT"); break;
default: printf("VERY INDIRECT");
}
- printf(", pos = %ld)\n", pos);
+ printf(", pos = %d)\n", pos);
}
/* Found the given zone in the given inode. Check it, and if ok, mark it
int chkindzone(ino_t ino, d_inode *ip, off_t *pos, zone_nr zno, int level)
{
zone_nr indirect[CINDIR];
- register n = NR_INDIRECTS / CINDIR;
+ register int n = NR_INDIRECTS / CINDIR;
long block= ztob(zno);
register long offset = 0;
int chkzones(ino_t ino, d_inode *ip, off_t *pos, zone_nr *zlist,
int len, int level)
{
- register ok = 1, i;
+ register int ok = 1, i;
/* The check on the position in the next loop is commented out, since FS
* now requires valid zone numbers in each level that is necessary and FS
/* Check a file or a directory. */
int chkfile(ino_t ino, d_inode *ip)
{
- register ok, i, level;
+ register int ok, i, level;
off_t pos = 0;
ok = chkzones(ino, ip, &pos, &ip->i_zone[0], NR_DZONE_NUM, 0);
/* Check a directory by checking the contents. Check if . and .. are present. */
int chkdirectory(ino_t ino, d_inode *ip)
{
- register ok;
+ register int ok;
setbit(dirmap, (bit_nr) ino);
ok = chkfile(ino, ip);
if (ip->i_size == 0)
printf("empty symbolic link ");
else
- printf("symbolic link too large (size %ld) ", ip->i_size);
+ printf("symbolic link too large (size %d) ", ip->i_size);
printpath(2, 1);
ok = 0;
}
ok = 1;
if ((dev_t) ip->i_zone[0] == NO_DEV) {
- printf("illegal device number %ld for special file ", ip->i_zone[0]);
+ printf("illegal device number %d for special file ", ip->i_zone[0]);
printpath(2, 1);
ok = 0;
}
*/
for (i = 1; i < NR_ZONE_NUMS; i++)
if (ip->i_zone[i] != NO_ZONE) {
- printf("nonzero zone number %ld for special file ",
+ printf("nonzero zone number %d for special file ",
ip->i_zone[i]);
printpath(2, 1);
ok = 0;
{
d_inode inode;
register ino_t ino = dp->d_inum;
- register visited;
+ register int visited;
struct stack stk;
stk.st_dir = dp;
void printtotal()
{
if(preen) {
- printf("%d files, %d directories, %d free inodes, %d free zones\n",
+ printf("%d files, %d directories, %d free inodes, %ld free zones\n",
nregular, ndirectory, nfreeinode, nfreezone);
return;
}
register char **clist = 0, **ilist = 0, **zlist = 0;
int badflag = 0;
- register devgiven = 0;
+ register int devgiven = 0;
register char *arg;
if ((1 << BITSHIFT) != 8 * sizeof(bitchunk_t)) {
{
char *file;
- if(cmdargc < 2)
+ if(cmdargc < 2) {
if(!linkopen) {
printf("You must \"OPEN\" a connection first.\n");
return(0);
- } else
+ } else {
return(DOcommand("STAT", ""));
-
+ }
+ }
if(DOcmdcheck())
return(0);
} else
filesize = lseek(fd, 0, SEEK_END);
- sprintf(restart, "%lu", filesize);
+ sprintf(restart, "%u", filesize);
s = DOcommand("REST", restart);
if((s / 100) != 2)
return(-1);
- sscanf(reply, "%*d %*s%u%lu", &ccrc, &csize);
+ sscanf(reply, "%*hu %*s%u%lu", &ccrc, &csize);
if(ss < 0) return(-1);
lcrc = crc(file);
if(size != csize || size != st.st_size || ccrc != lcrc)
} else
if((ss < 0) && (ft == 'b' || ft == 'c' || ft == 'p')) {
s = mknod(file, fmode, maj << 8 | min);
- printf("mknod %c %u %u\n", file, maj, min);
+ printf("mknod %s %lu %lu\n", file, maj, min);
} else
return(0);
}
return(-1);
if(st.st_uid != uid || st.st_gid != gid) {
s = chown(file, uid, gid);
- printf("chown %u:%u %s\n", uid, gid, file);
+ printf("chown %lu:%lu %s\n", uid, gid, file);
}
if(st.st_mode != fmode) {
s = chmod(file, fmode);
- printf("chmod %04o %s\n", fmode, file);
+ printf("chmod %04lo %s\n", fmode, file);
}
if(st.st_mtime != mtime) {
ut.actime = mtime;
return(0);
}
- sprintf(restart, "%lu", rmtsize);
+ sprintf(restart, "%u", rmtsize);
s = DOcommand("REST", restart);
int DOlcd()
{
char *path;
-int s;
path = cmdargv[1];
int DOlmkdir()
{
char *path;
-int s;
path = cmdargv[1];
int DOlrmdir()
{
char *path;
-int s;
path = cmdargv[1];
int fd;
int fdout;
{
-int s, len;
+int s;
char c;
char *p;
char *op, *ope;
int fd;
int fdin;
{
-int s, len;
+int s;
int gotcr;
char c;
char *p;
return(0);
}
-static binaryrecv(fd, fdin)
+static int binaryrecv(fd, fdin)
int fd;
int fdin;
{
int
main(c, v)
+ int c;
char **v;
{
char *domain;
#endif
register struct hostent *hp;
register char *s, *p;
- register inverse = 0;
- register waitmode = 0;
+ register int inverse = 0;
+ register int waitmode = 0;
u8_t *oldcname;
int ncnames;
int isaddr;
u8_t *eom, *bp, *cp;
querybuf_t buf, answer;
int n, n1, i, j, nmx, ancount, nscount, arcount, qdcount, buflen;
- u_short pref, class;
char host[2*MAXDNAME+2];
if (domain == NULL)
{
HEADER *hp;
u8_t *bp, *cp;
- int n, n1, i, j, nmx, ancount, nscount, arcount, qdcount, buflen;
- u_short pref, class;
+ int nmx, ancount, nscount, arcount, qdcount, buflen;
/*
* find first satisfactory answer
if (verbose)
fprintf(file,"%s\t%d%s\t%s",
name, ttl, pr_class(class), pr_type(type));
- else
+ else {
fprintf(file,"%s%s %s",name, pr_class(class), pr_type(type));
+ }
if (verbose)
punc = '\t';
else
break;
case T_HINFO:
- if (n = *cp++) {
+ if ((n = *cp++)) {
if (doprint)
fprintf(file,"%c%.*s", punc, n, cp);
cp += n;
}
- if (n = *cp++) {
+ if ((n = *cp++)) {
if (doprint)
fprintf(file,"%c%.*s", punc, n, cp);
cp += n;
if (doprint)
fprintf(file," %s", name);
if (doprint)
- fprintf(file,"(\n\t\t\t%ld\t;serial (version)", _getlong(cp));
+ fprintf(file,"(\n\t\t\t%d\t;serial (version)", _getlong(cp));
cp += sizeof(u_long);
if (doprint)
- fprintf(file,"\n\t\t\t%ld\t;refresh period", _getlong(cp));
+ fprintf(file,"\n\t\t\t%d\t;refresh period", _getlong(cp));
cp += sizeof(u_long);
if (doprint)
- fprintf(file,"\n\t\t\t%ld\t;retry refresh this often", _getlong(cp));
+ fprintf(file,"\n\t\t\t%d\t;retry refresh this often", _getlong(cp));
cp += sizeof(u_long);
if (doprint)
- fprintf(file,"\n\t\t\t%ld\t;expiration period", _getlong(cp));
+ fprintf(file,"\n\t\t\t%d\t;expiration period", _getlong(cp));
cp += sizeof(u_long);
if (doprint)
- fprintf(file,"\n\t\t\t%ld\t;minimum TTL\n\t\t\t)", _getlong(cp));
+ fprintf(file,"\n\t\t\t%d\t;minimum TTL\n\t\t\t)", _getlong(cp));
cp += sizeof(u_long);
break;
case T_MX:
- if (doprint)
+ if (doprint) {
if (verbose)
fprintf(file,"\t%d ",_getshort(cp));
else
fprintf(file," (pri=%d) by ",_getshort(cp));
+ }
cp += sizeof(u_short);
cp = pr_cdname(cp, msg, name, sizeof(name));
if (doprint)
/* Roy start */
case T_TXT:
- if (n = *cp++) {
+ if ((n = *cp++)) {
if (doprint)
fprintf(file,"%c%.*s", punc, n, cp);
cp += n;
void spoolerr(char *file)
{
- int e= errno;
-
unlink(jobX);
unlink(tmpX);
fatal(file);
count = 0;
}
-int put(int c)
+void put(int c)
/* Send characters to the output buffer to be printed and do so if the buffer
* is full. Track the position of the write-head in `column' and `line'.
*/
sort(&flist);
if (depth == SUBMERGED && (field & (L_BLOCKS | L_LONG))) {
- printf("total %ld\n", nblk2k(countblocks(flist)));
+ printf("total %d\n", nblk2k(countblocks(flist)));
}
if (state == SINKING || depth == SURFACE1) {
(long) mtget.mt_fileno,
(long) mtget.mt_blkno,
(long) mtget.mt_resid);
- printf(mtget.mt_blksize == 0 ? "variable\n" : "%ld\n",
+ printf(mtget.mt_blksize == 0 ? "variable\n" : "%d\n",
mtget.mt_blksize);
}
}
{
struct part_entry *pe, *exp;
long count;
- unsigned long base, size, oldbase;
+ unsigned long base, oldbase;
do {
exp= nil;
exit(1);
}
- if (fscanf(fp, " %c %d %255s %c %d %*d %lu %lu %*u %*u",
+ if (fscanf(fp, " %c %d %255s %c %d %*d %u %u %*u %*u",
&type, &ps->ps_endpt, name, &ps->ps_state,
&ps->ps_recv, &ps->ps_utime, &ps->ps_stime) != 7) {
return 1;
}
- fprintf(stderr, "size on %s set to %dkB\n", d, size/KFACTOR);
+ fprintf(stderr, "size on %s set to %ldkB\n", d, size/KFACTOR);
return 0;
}
if (nbytes > 0) {
off_t kBpts;
- fprintf(stderr, "%ld kB / %d.%d s = ",
+ fprintf(stderr, "%d kB / %ld.%ld s = ",
(nbytes + 512) / 1024,
tenthsec / 10, tenthsec % 10);
if (tenthsec < 5)
seconds = (tenthsec + 5) / 10;
kBpts= (nbytes + 512L * seconds)
/ (1024L * seconds);
- fprintf(stderr, "%ld kB/s\n", kBpts);
+ fprintf(stderr, "%d kB/s\n", kBpts);
} else {
kBpts= (100 * nbytes + 512L * tenthsec)
/ (1024L * tenthsec);
- fprintf(stderr, "%ld.%ld kB/s\n",
+ fprintf(stderr, "%d.%d kB/s\n",
kBpts/10, kBpts%10);
}
}
tenthms= (tenthsec * 1000 + nseeks/2) / nseeks;
fprintf(stderr,
- "%ld seeks / %d.%d s = %ld seeks/s = %ld.%ld ms/seek\n",
+ "%d seeks / %ld.%ld s = %ld seeks/s = %d.%d ms/seek\n",
nseeks, tenthsec / 10, tenthsec % 10,
(nseeks * 10 + tenthsec/2) / tenthsec,
tenthms / 10, tenthms % 10);
} else {
fprintf(stderr, ", ");
}
- fprintf(stderr, "%ld.%ld ms (%d rpm)",
+ fprintf(stderr, "%d.%d ms (%d rpm)",
(tenthms - rotms) / 10, (tenthms - rotms) % 10,
rpm);
}
#endif /* not lint */
#ifndef lint
+#if 0
static char sccsid[] = "@(#)rcp.c 1.1 87/12/21 SMI"; /* from UCB 5.3 6/8/85"*/
+#endif
#endif /* not lint */
/*
#define ga() (void) write(rem, "", 1)
-main(argc, argv)
+int main(argc, argv)
int argc;
char **argv;
{
* Make it compatible with possible future
* versions expecting microseconds.
*/
- (void) sprintf(buf, "T%ld 0 %ld 0\n",
+ (void) sprintf(buf, "T%d 0 %d 0\n",
stb.st_mtime, stb.st_atime);
(void) write(rem, buf, strlen(buf));
if (response() < 0) {
continue;
}
}
- (void) sprintf(buf, "C%04o %ld %s\n",
+ (void) sprintf(buf, "C%04o %lld %s\n",
stb.st_mode&07777, stb.st_size, last);
(void) write(rem, buf, strlen(buf));
if (response() < 0) {
else
last++;
if (pflag) {
- (void) sprintf(buf, "T%ld 0 %ld 0\n",
+ (void) sprintf(buf, "T%d 0 %d 0\n",
statp->st_mtime, statp->st_atime);
(void) write(rem, buf, strlen(buf));
if (response() < 0) {
closedir(d);
return;
}
- while (dp = readdir(d)) {
+ while ((dp = readdir(d))) {
if (dp->d_ino == 0)
continue;
if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
static pathname_t path;
static size_t *trunc;
static size_t trunc_len;
- static base_indent;
+ static int base_indent;
char *line;
char **argv;
size_t argc;
#define get_window_size(fd, wp) ioctl(fd, TIOCGWINSZ, wp)
extern int main( int argc, char **argv );
-static void usage( void );
+static void usage( void ) __attribute__((noreturn));
static u_char getescape( char *p );
static char *speeds2str( speed_t speed );
static void lostpeer( int sig );
one = 1;
host = user = NULL;
- if (p = rindex(argv[0], '/'))
+ if ((p = rindex(argv[0], '/')))
++p;
else
p = argv[0];
if (pid == 0)
return;
/* if the child (reader) dies, just quit */
- if (pid < 0 || pid == child && !WIFSTOPPED(status))
+ if (pid < 0 || ((pid == child) && (!WIFSTOPPED(status))))
done(WTERMSIG(status) | WEXITSTATUS(status));
}
/* NOTREACHED */
static int
reader()
{
- int pid = -getpid();
int n, remaining;
char *bufp = rcvbuf;
#endif /* not lint */
#ifndef lint
+#if 0
static char sccsid[] = "@(#)rsh.c 5.24 (Berkeley) 7/1/91";
+#endif
#endif /* not lint */
/*
host = user = NULL;
/* if called as something other than "rsh", use it as the host name */
- if (p = rindex(argv[0], '/'))
+ if ((p = rindex(argv[0], '/')))
++p;
else
p = argv[0];
{
register int cc, wc;
register char *bp;
+#if !_MINIX
int readfrom, ready, rembits;
+#endif
char buf[BUFSIZ];
#if _MINIX
int pid1;
int argc;
char *argv[];
{
- register seconds;
+ register int seconds;
register char c;
seconds = 0;
std_err("Usage: sleep time\n");
exit(1);
}
- while (c = *(argv[1])++) {
+ while ((c = *(argv[1])++)) {
if (c < '0' || c > '9') {
std_err("sleep: bad arg\n");
exit(1);
exit(1);
}
-main(argc, argv) int argc; char **argv;
+int main(argc, argv) int argc; char **argv;
{
char *s_mach, *s_dir;
char *m_mach, *m_dir;
{
struct filed *f;
int fac, prilev;
- int omask, msglen;
+ int /*omask,*/ msglen;
char *timestamp;
DEBUG(dprintf("logmsg: pri %o, flags %x, from %s, msg %s\n", pri, flags, from, msg);)
void printkline(char *hname, char *msg)
{
char line[MAXLINE + 1];
- char *p = msg, *q = line;
- int ch, pri = DEFUPRI;
/* Copies message to local buffer, adding source program tag */
snprintf(line, sizeof(line), "kernel: %s", msg);
*/
void init(int sig)
{
- int i;
FILE *cf;
struct filed *fLog, *next, **nextp;
char *p;
linebuf[len] = '\n';
linebuf[len + 1] = '\0';
p = linebuf;
- while(eol = strchr(p, '\n')) {
+ while((eol = strchr(p, '\n'))) {
*eol = '\0';
printkline(LocalHostName, p);
p = eol+1;
struct nwio_tcpopt tcpopt;
char *tcp_device;
struct servent *servent;
- int tcp_fd, client_fd, count, r;
+ int tcp_fd, client_fd, r;
int pfd[2];
unsigned stall= 0;
struct sigaction sa;
struct nwio_tcpopt tcpopt;
char *tcp_device;
struct servent *servent;
- int tcp_fd, client_fd, count, r;
+ int tcp_fd, client_fd, r;
int pfd[2];
unsigned stall= 0;
struct sigaction sa;
int fd, i, r;
char *query, *pval;
size_t len;
+#ifdef __minix_vmd
struct timeval uptime;
+#endif
clock_t now;
int fl;
int a_flag, n_flag, v_flag;
case TCS_CLOSED: printf("CLOSED");
if (tcp_conn->tc_senddis >= now)
{
- printf("(time wait %ld s)",
+ printf("(time wait %d s)",
(tcp_conn->tc_senddis-now)/system_hz);
}
no_verbose= 1;
tcp_conn->tc_state != TCS_LISTEN)
{
printf("\n\t");
- printf("RQ: %lu, SQ: %lu, RWnd: %u, SWnd: %lu, SWThresh: %lu",
+ printf("RQ: %u, SQ: %u, RWnd: %u, SWnd: %u, SWThresh: %u",
tcp_conn->tc_RCV_NXT - tcp_conn->tc_RCV_LO,
tcp_conn->tc_SND_NXT - tcp_conn->tc_SND_UNA,
tcp_conn->tc_rcv_wnd,
#endif
static char *prog_name;
-static tcp_fd;
+static int tcp_fd;
static char *term_env;
static int esc_char= '~';
static enum { LS_NORM, LS_BOL, LS_ESC } line_state= LS_BOL;
#include <net/gen/inet.h>
#include "telnetd.h"
+#if 0
static char *Version = "@(#) telnetd 1.00 (07/26/92)";
+#endif
int opt_d = 0; /* debugging output flag */
lineno = 0;
for (;;) {
if ((ttyp = getttyent()) == NULL) {
- sprintf(buff, "Can't find %s in the tty table\r\n");
+ sprintf(buff, "Can't find the tty entry in the tty table\r\n");
(void) write(1, buff, strlen(buff));
}
if (strcmp(ttyp->ty_name, tty_name+5) == 0) break;
(void) write(fdout, buf, len);
}
-int set_winsize(int fd, unsigned int cols, unsigned int rows)
+void set_winsize(int fd, unsigned int cols, unsigned int rows)
{
struct winsize w;
memset(&w, 0, sizeof(w));
ioctl(fd, TIOCSWINSZ, (char *) &w);
}
-int tel_in(fdout, telout, buffer, len)
+void tel_in(fdout, telout, buffer, len)
int fdout;
int telout;
char *buffer;
write(fdout, buffer, size);
}
-int tel_out(fdout, buf, size)
+void tel_out(fdout, buf, size)
int fdout;
char *buf;
int size;
void term_inout(int pty_fd);
void tel_init(void);
void telopt(int fdout, int what, int option);
-int tel_in(int fdout, int telout, char *buffer, int len);
-int tel_out(int fdout, char *buf, int size);
+void tel_in(int fdout, int telout, char *buffer, int len);
+void tel_out(int fdout, char *buf, int size);
{
char message[128];
- sprintf(message, "telnetd: %s: %s\r\n", strerror(errno));
+ sprintf(message, "telnetd: %i: %s\r\n", errno, strerror(errno));
(void) write(1, message, strlen(message));
}
int fd, i, r;
size_t psize;
char *pval, *param;
+#ifdef __minix_vmd
struct timeval uptime;
+#endif
clock_t now;
int fl;
int a_flag, n_flag;
cpt--;
}
cpt = buf;
- while (c = *cpt) {
+ while ((c = *cpt)) {
if (chtbl[c] != -1) {
format("uud: Duplicate char in translation table.\n");
Error(7);
/*
* Get the binary line length.
*/
- n = trtbl[*buf];
+ n = trtbl[(unsigned char)*buf];
if (n >= 0) goto decod;
/*
* end of uuencoded file ?
*/
if (debug) {
for (len = 0, bp = buf; len < rlen; len++) {
- if (trtbl[*bp] < 0) {
+ if (trtbl[(unsigned char)*bp] < 0) {
format(
"Non uuencoded char <%c>, line %d in file: %s\n", *bp, numl, ifname);
format("Bad line =%s\n",buf);
len = n;
bp = &buf[1];
while (n > 0) {
- *(ut++) = trtbl[*bp] << 2 | trtbl[bp[1]] >> 4;
+ *(ut++) = trtbl[(unsigned char)*bp] << 2 | trtbl[(unsigned char)bp[1]] >> 4;
n--;
if (n) {
- *(ut++) = (trtbl[bp[1]] << 4) |
- (trtbl[bp[2]] >> 2);
+ *(ut++) = (trtbl[(unsigned char)bp[1]] << 4) |
+ (trtbl[(unsigned char)bp[2]] >> 2);
n--;
}
if (n) {
- *(ut++) = trtbl[bp[2]] << 6 | trtbl[bp[3]];
+ *(ut++) = trtbl[(unsigned char)bp[2]] << 6 | trtbl[(unsigned char)bp[3]];
n--;
}
bp += 4;
if (lenofname > FILE_NAME) ofname[FILE_NAME] = '\0';
strcat(ofname, ".uue");
lenofname = strlen(ofname);
- if (!split && (filter || (argc > 2) && (argv[2][0] == '-'))) {
+ if (!split && (filter || ((argc > 2) && (argv[2][0] == '-')))) {
stdo = 1;
outp = stdout;
} else {
#include <stdio.h>
#include <paths.h>
+#if 0
static char *Version = "@(#) WRITE 1.6 (10/24/92)";
+#endif
int otty; /* file desc of callee's terminal */
short int cbreak = 0; /* are we in CBREAK (-c) mode? */
{
struct passwd *pw;
char buff[128];
- long now;
+ time_t now;
char *sp;
time(&now);
exit(1);
}
- fprintf(stderr, " * appended sector info: 0x%lx len 0x%x\n",
+ fprintf(stderr, " * appended sector info: 0x%x len 0x%x\n",
bap[0].sector, bap[0].length);
addr = buf;
#endif /* not lint */
#ifndef lint
+#if 0
static char sccsid[] = "@(#)xargs.c 5.11 (Berkeley) 6/19/91";
+#endif
#endif /* not lint */
#include <sys/types.h>
unsigned baudr;
int speedcode;
} speeds[] = {
- 110, B110,
- 300, B300,
+ {110, B110, },
+ {300, B300, },
#ifdef B600
- 600, B600,
+ {600, B600, },
#endif
- 1200, B1200,
- 2400, B2400,
- 4800, B4800,
- 9600, B9600,
+ {1200, B1200, },
+ {2400, B2400, },
+ {4800, B4800, },
+ {9600, B9600, },
#ifdef EXTA
- 19200, EXTA,
- 38400, EXTB,
+ {19200, EXTA, },
+ {38400, EXTB, },
#endif
- 0,
+ {0},
};
int Twostop; /* Use two stop bits */
getspeed(code)
int code;
{
- register n;
+ register int n;
for (n=0; speeds[n].baudr; ++n)
if (speeds[n].speedcode == code)
int mode(n)
int n;
{
- static did0 = FALSE;
+ static int did0 = FALSE;
vfile("mode:%d", n);
switch(n) {
char *argv[];
{
register char *cp;
- register npats;
+ register int npats;
char *virgin, **patts;
int exitcode = 0;
int argc;
char **argp;
{
- register c;
+ register int c;
if (Batch || argc==0) {
Crcflg=1;
if ( !Quiet)
fprintf(stderr, rbmsg, Progname, Nozmodem?"sb":"sz");
- if (c=tryz()) {
+ if ((c=tryz())) {
if (c == ZCOMPL)
return OK;
if (c == ERROR)
int wcrxpn(rpn)
char *rpn; /* receive a pathname */
{
- register c;
+ register int c;
#ifdef NFGVMIN
readline(1);
char *rxbuf;
int maxtime;
{
- register checksum, wcj, firstch;
+ register int checksum, wcj, firstch;
register unsigned short oldcrc;
register char *p;
int sectcurr;
int readline(timeout)
int timeout;
{
- register n;
+ register int n;
static char *cdq; /* pointer for removing chars from linbuf */
if (--Lleft >= 0) {
*/
int tryz()
{
- register c, n;
- register cmdzack1flg;
+ register int c, n;
+ register int cmdzack1flg;
if (Nozmodem) /* Check for "rb" program name */
return 0;
*/
int rzfiles()
{
- register c;
+ register int c;
for (;;) {
switch (c = rzfile()) {
*/
int rzfile()
{
- register c, n;
+ register int c, n;
long rxbytes;
Eofseen=FALSE;
void zmputs(s)
char *s;
{
- register c;
+ register int c;
while (*s) {
switch (c = *s++) {
*/
void ackbibi()
{
- register n;
+ register int n;
vfile("ackbibi:");
Readnum = 1;
char *argv[];
{
register char *cp;
- register npats;
+ register int npats;
int dm;
char **patts;
static char xXbuf[BUFSIZ];
int wcs(oname)
char *oname;
{
- register c;
+ register int c;
register char *p;
struct stat f;
char name[PATHLEN];
if (Modem2) {
if ((in!=stdin) && *name && fstat(fileno(in), &f)!= -1) {
- fprintf(stderr, "Sending %s, %ld blocks: ",
+ fprintf(stderr, "Sending %s, %lld blocks: ",
name, f.st_size>>7);
}
fprintf(stderr, "Give your local XMODEM receive command now.\r\n");
while (q < (txbuf + 1024))
*q++ = 0;
if (!Ascii && (in!=stdin) && *name && fstat(fileno(in), &f)!= -1)
- sprintf(p, "%lu %lo %o 0 %d %ld", f.st_size, f.st_mtime,
+ sprintf(p, "%llu %o %o 0 %d %ld", f.st_size, f.st_mtime,
f.st_mode, Filesleft, Totalleft);
Totalleft -= f.st_size;
if (--Filesleft <= 0)
int getnak()
{
- register firstch;
+ register int firstch;
Lastrx = 0;
for (;;) {
int sectnum;
int cseclen; /* data length of this sector to send */
{
- register checksum, wcj;
+ register int checksum, wcj;
register char *cp;
unsigned oldcrc;
int firstch;
register char *buf;
int count;
{
- register c, m;
+ register int c, m;
if ( !Ascii) {
m = read(fileno(in), buf, count);
*/
int getzrxinit()
{
- register n;
+ register int n;
struct stat f;
for (n=10; --n>=0; ) {
/* Send send-init information */
int sendzsinit()
{
- register c;
+ register int c;
if (Myattn[0] == '\0' && (!Zctlesc || (Rxflags & TESCCTL)))
return OK;
char *buf;
int blen;
{
- register c;
+ register int c;
register UNSL long crc;
for (;;) {
/* Send the data in the file */
int zsendfdata()
{
- register c, e, n;
+ register int c, e, n;
register int newcnt;
register long tcount = 0;
int junkcount; /* Counts garbage chars received by TX */
char *buf;
int blen;
{
- register c;
+ register int c;
long cmdnum;
cmdnum = getpid();
int argc;
register char **argv;
{
- register c;
+ register int c;
struct stat f;
for (Totalleft = 0, Filesleft = 0; --argc >=0; ++argv) {
}
}
if (Verbose>2)
- fprintf(stderr, " %ld", f.st_size);
+ fprintf(stderr, " %lld", f.st_size);
}
if (Verbose>2)
fprintf(stderr, "\ncountem: Total %d %ld\n",
int Znulls; /* Number of nulls to send at beginning of ZDATA hdr */
char Attn[ZATTNLEN+1]; /* Attention string rx sends to tx on err */
-static lastsent; /* Last char we sent */
-static Not8bit; /* Seven bits seen on header */
+static int lastsent; /* Last char we sent */
+static int Not8bit; /* Seven bits seen on header */
static char *frametypes[] = {
"Carrier Lost", /* -3 */
xsendline(ZPAD); xsendline(ZDLE);
- if (Crc32t=Txfcs32)
+ if ((Crc32t=Txfcs32))
zsbh32(hdr, type);
else {
xsendline(ZBIN); zsendline(type); crc = updcrc(type, 0);
case GOTCRCG:
case GOTCRCQ:
case GOTCRCW:
- crc = updcrc((d=c)&0377, crc);
+ crc = updcrc((((d=c))&0377), crc);
if ((c = zdlread()) & ~0377)
goto crcfoo;
crc = updcrc(c, crc);
#define ZCACK1 1 /* Acknowledge, then do command */
/* Globals used by ZMODEM functions */
-extern Rxframeind; /* ZBIN ZBIN32, or ZHEX type of frame received */
-extern Rxtype; /* Type of header received */
-extern Rxcount; /* Count of data bytes received */
-extern Zrwindow; /* RX window size (controls garbage count) */
-extern Rxtimeout; /* Tenths of seconds to wait for something */
+extern int Rxframeind; /* ZBIN ZBIN32, or ZHEX type of frame received */
+extern int Rxtype; /* Type of header received */
+extern int Rxcount; /* Count of data bytes received */
+extern int Zrwindow; /* RX window size (controls garbage count) */
+extern int Rxtimeout; /* Tenths of seconds to wait for something */
extern char Rxhdr[4]; /* Received header */
extern char Txhdr[4]; /* Transmitted header */
extern long Rxpos; /* Received file position */
extern long Txpos; /* Transmitted file position */
-extern Txfcs32; /* TURE means send binary frames with 32 bit FCS */
-extern Crc32t; /* Display flag indicating 32 bit CRC being sent */
-extern Crc32; /* Display flag indicating 32 bit CRC being received */
-extern Znulls; /* Number of nulls to send at beginning of ZDATA hdr */
+extern int Txfcs32; /* TURE means send binary frames with 32 bit FCS */
+extern int Crc32t; /* Display flag indicating 32 bit CRC being sent */
+extern int Crc32; /* Display flag indicating 32 bit CRC being received */
+extern int Znulls; /* Number of nulls to send at beginning of ZDATA hdr */
extern char Attn[ZATTNLEN+1]; /* Attention string rx sends to tx on err */
/* crctab.c */
__weak_alias(times, _times)
#endif
-clock_t times(buf)
-struct tms *buf;
+clock_t times(struct tms *buf)
{
message m;
return -1; \
name->string[sizeof(name->string)-1]= 0;
-int uname(name)
-struct utsname *name;
+int uname(struct utsname *name)
{
int hf, n, err;
char *nl;
__weak_alias(wait, _wait)
#endif
-pid_t wait(status)
-int * status;
+pid_t wait(int * status)
{
message m;
__weak_alias(waitpid, _waitpid)
#endif
-pid_t waitpid(pid, status, options)
-pid_t pid;
-int *status;
-int options;
+pid_t waitpid(pid_t pid, int *status, int options)
{
message m;
#define PUFFS_MAX_ARGS 20
int __real_main(int argc, char* argv[]);
+int __wrap_main(int argc, char* argv[]);
int __wrap_main(int argc, char *argv[])
{
int
rmtopen(const char *path, int oflag, ...)
{
- mode_t mode;
+ /* LSC: MINIX This works only for int mode flags, so use the expected type. */
+ uint32_t mode;
int fd;
va_list ap;
va_start(ap, oflag);
- mode = va_arg(ap, mode_t);
+ mode = va_arg(ap, uint32_t);
va_end(ap);
_DIAGASSERT(path != NULL);
const char *p;
size_t len, dlen;
struct diskentry *d;
+#ifndef __minix
char buf[MAXPATHLEN];
struct dkwedge_info dkw;
int fd;
-#ifndef __minix
if ((fd = opendisk(name, O_RDONLY, buf, sizeof(buf), 0)) != -1) {
if (ioctl(fd, DIOCGWEDGEINFO, &dkw) != -1)
name = dkw.dkw_parent;
static int findbit(int low, int startscan, int pages, int memflags, int *len)
{
- int run_length = 0, i, freerange_start;
+ int run_length = 0, i;
+ int freerange_start = startscan;
for(i = startscan; i >= low; i--) {
if(!page_isfree(i)) {
#define __static_cast(x,y) (x)y
#endif
-#if __GNUC_PREREQ__(4, 0)
+/* LSC: Clang/llvm also defines GNUC_PREREQ, but it actually does not
+ * Support those pragma. Make sure it is not used then.*/
+#if __GNUC_PREREQ__(4, 0) && !defined(__clang__)
# define __dso_public __attribute__((__visibility__("default")))
# define __dso_hidden __attribute__((__visibility__("hidden")))
# define __BEGIN_PUBLIC_DECLS \
#include <time.h>
#ifndef PRIdOFF
-#define PRIdOFF PRId64
+#define PRIdOFF PRId32
#endif
/* what type of file are we dealing with */
struct proc *proc = NULL, *prev_proc = NULL;
-void parse_file(pid_t pid)
+static void parse_file(pid_t pid)
{
char path[PATH_MAX], name[256], type, state;
int version, endpt, effuid;
p->p_endpoint = endpt;
p->p_pid = pid;
- if (fscanf(fp, " %255s %c %d %d %lu %*u %lu %lu",
+ if (fscanf(fp, " %255s %c %d %d %u %*u %lu %lu",
name, &state, &p->p_blocked, &p->p_priority,
&p->p_user_time, &cycles_hi, &cycles_lo) != 7) {
fclose(fp);
}
-void parse_dir(void)
+static void parse_dir(void)
{
DIR *p_dir;
struct dirent *p_ent;
closedir(p_dir);
}
-void get_procs(void)
+static void get_procs(void)
{
struct proc *p;
int i;
parse_dir();
}
-int print_memory(void)
+static int print_memory(void)
{
FILE *fp;
unsigned int pagesize;
return 1;
}
-int print_load(double *loads, int nloads)
+static int print_load(double *loads, int nloads)
{
int i;
printf("load averages: ");
return 1;
}
-int print_proc_summary(struct proc *proc)
+static int print_proc_summary(struct proc *proc)
{
int p, alive, running, sleeping;
u64_t ticks;
};
-int cmp_procs(const void *v1, const void *v2)
+static int cmp_procs(const void *v1, const void *v2)
{
struct tp *p1 = (struct tp *) v1, *p2 = (struct tp *) v2;
int p1blocked, p2blocked;
return (int) (p1->p - p2->p);
}
-struct tp *lookup(endpoint_t who, struct tp *tptab, int np)
+static struct tp *lookup(endpoint_t who, struct tp *tptab, int np)
{
int t;
double ktotal = 0;
-void print_proc(struct tp *tp, u64_t total_ticks)
+static void print_proc(struct tp *tp, u64_t total_ticks)
{
int euid = 0;
static struct passwd *who = NULL;
printf("%6.2f%% %s", 100.0 * tp->ticks / total_ticks, name);
}
-char *cputimemodename(int cputimemode)
+static char *cputimemodename(int cputimemode)
{
static char name[100];
int i;
return name;
}
-u64_t cputicks(struct proc *p1, struct proc *p2, int timemode)
+static u64_t cputicks(struct proc *p1, struct proc *p2, int timemode)
{
int i;
u64_t t = 0;
return t;
}
-char *ordername(int orderno)
+static char *ordername(int orderno)
{
switch(orderno) {
case ORDER_CPU: return "cpu";
return "invalid order";
}
-void print_procs(int maxlines,
+static void print_procs(int maxlines,
struct proc *proc1, struct proc *proc2, int cputimemode)
{
int p, nprocs;
}
}
-void showtop(int cputimemode, int r)
+static void showtop(int cputimemode, int r)
{
#define NLOADS 3
double loads[NLOADS];
fflush(NULL);
}
-void init(int *rows)
+static void init(int *rows)
{
char *term;
static char buffer[TC_BUFFER], strings[TC_STRINGS];
if(*rows < 1) *rows = 24;
}
-void sigwinch(int sig) { }
+static void sigwinch(int sig) { }
-void getkinfo(void)
+static void getkinfo(void)
{
FILE *fp;
{
ssize_t nr, nw;
int serrno;
+#ifndef __minix
u_char *p;
+#endif
u_char buf[MAXBSIZE];
MD5_CTX ctxMD5;
RMD160_CTX ctxRMD160;
int main(int argc, char **argv);
void descend(char *dirname);
-void display_attrib(char *name, struct stat *st);
+void display_attrib(const char *name, struct stat *st);
void usage(char *binname);
void open_outfile(void);
int argc;
char *argv[];
{
- char *dir;
+ char *dir = __UNCONST("");
struct stat st;
int op;
prot = DEF_PROT;
blocks = DEF_BLOCKS;
inodes = DEF_INODES;
- indentstr = DEF_INDENTSTR;
+ indentstr = __UNCONST(DEF_INDENTSTR);
inode_given = 0;
block_given = 0;
top = 0;
fprintf(outfile, "\n");
descend(temp);
for (i = 0; i < tabs; i++) {
- fprintf(outfile, indentstr);
+ fprintf(outfile, "%s", indentstr);
}
fprintf(outfile, "$\n");
continue;
void display_attrib(name, st)
-char *name;
+const char *name;
struct stat *st;
{
/* Output the specification for a single file */
if (same_gid) gid = st->st_gid;
if (same_prot)
prot = st->st_mode & 0777; /***** This one is a bit shady *****/
- for (i = 0; i < tabs; i++) fprintf(outfile, indentstr);
+ for (i = 0; i < tabs; i++) fprintf(outfile, "%s", indentstr);
fprintf(outfile, "%s%s%c%c%c%3o %d %d",
name,
*name == '\0' ? "" : indentstr, /* stop the tab for a null name */
}
#endif
-int
+static int
utimes(const char *path, const struct timeval times[2])
{
return -1;
int
compare(NODE *s, FTSENT *p)
{
+#if defined(__minix)
+ u_int32_t len, val;
+#else
u_int32_t len, val, flags;
+#endif /* defined(__minix) */
int fd, label;
const char *cp, *tab;
#if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2)
gid_t sgid;
uid_t suid;
mode_t smode;
+#if !defined(__minix)
u_long sflags = 0;
+#endif /* !defined(__minix) */
const char *name = NULL;
gid_t savegid;
uid_t saveuid;
int create;
char *tp;
const char *type;
+#if !defined(__minix)
u_int32_t flags;
+#endif /* !defined(__minix) */
for (; p; p = p->next) {
if (p->flags & F_OPT && !(p->flags & F_VISIT))