FD_ZERO(&ready);
FD_SET(s, &ready);
- found = select(FD_SETSIZE, &ready, (fd_set *)0, (fd_set *)0, &tout);
+ found = select(FD_SETSIZE, &ready, NULL, NULL, &tout);
length = sizeof(errn);
if (!getsockopt(s,
{ "locked memory", "kbytes", RLIMIT_MEMLOCK, 1024, 'l' },
#endif
#ifdef RLIMIT_NPROC
- { "max user processes", (char *)0, RLIMIT_NPROC, 1, 'u' },
+ { "max user processes", NULL, RLIMIT_NPROC, 1, 'u' },
#endif
#ifdef RLIMIT_NOFILE
- { "open files", (char *)0, RLIMIT_NOFILE, 1, 'n' },
+ { "open files", NULL, RLIMIT_NOFILE, 1, 'n' },
#endif
#ifdef RLIMIT_VMEM
{ "virtual mem size", "kbytes", RLIMIT_VMEM, 1024, 'v' },
{ "sbsize", "bytes", RLIMIT_SBSIZE, 1, 'b' },
#endif
#ifdef RLIMIT_POSIXLOCK
- { "posixlocks", (char *)0, RLIMIT_POSIXLOCK, 1, 'k' },
+ { "posixlocks", NULL, RLIMIT_POSIXLOCK, 1, 'k' },
#endif
- { (char *) 0, (char *)0, 0, 0, '\0' }
+ { NULL, NULL, 0, 0, '\0' }
};
int
{
struct sigaction sa;
- if (sigaction(signo, (struct sigaction *)0, &sa) == -1)
+ if (sigaction(signo, NULL, &sa) == -1)
return 0;
*sigact = (sig_t) sa.sa_handler;
return 1;
s = sigblock(sigmask(SIGINT));
- gettimeofday(&tv, (struct timezone *)0); /* can't call time */
+ gettimeofday(&tv, NULL); /* can't call time */
tvsec = (time_t) tv.tv_sec;
date = ctime(&tvsec);
date[24] = '\0';
continue;
}
if(index(quitchars,ilet))
- return((struct obj *)0);
+ return(NULL);
if(ilet == '-') {
return(allownone ? &zeroobj : (struct obj *) 0);
}
(!(Fast & ~INTRINSIC) && (!Fast || rn2(3)))) {
movemon();
if(!rn2(70))
- makemon((struct permonst *)0, 0, 0);
+ makemon(NULL, 0, 0);
}
if(Glib) glibr();
p_timeout();
case 0:
/* create a nasty monster from a deep level */
/* (for the moment, 'nasty' is not implemented) */
- makemon((struct permonst *)0, u.ux, u.uy);
+ makemon(NULL, u.ux, u.uy);
break;
case 1:
pline("\"Destroy the thief, my pets!\"");
cursors(); lwclose();
if (lcreat(diagfile) < 0) /* open the diagnostic file */
{
- lcreat((char*)0); lprcat("\ndiagnostic failure\n"); return(-1);
+ lcreat(NULL); lprcat("\ndiagnostic failure\n"); return(-1);
}
write(1,"\nDiagnosing . . .\n",18);
for (i=0; i<16; i++) { lprintf(" %5d",(long)rndcount[i]); if (i==7) lprc('\n'); }
lprcat("\n\n"); lwclose();
- lcreat((char*)0); lprcat("Done Diagnosing . . .");
+ lcreat(NULL); lprcat("Done Diagnosing . . .");
return(0);
}
/*
ointerest();
if (lcreat(fname) < 0)
{
- lcreat((char*)0); lprintf("\nCan't open file <%s> to save game\n",fname);
+ lcreat(NULL); lprintf("\nCan't open file <%s> to save game\n",fname);
nosignal=0; return(-1);
}
#ifndef VT100
setscroll();
#endif /* VT100 */
- lcreat((char*)0); nosignal=0;
+ lcreat(NULL); nosignal=0;
return(0);
}
cursors(); lprcat("\nRestoring . . ."); lflush();
if (lopen(fname) <= 0)
{
- lcreat((char*)0); lprintf("\nCan't open file <%s>to restore game\n",fname);
+ lcreat(NULL); lprintf("\nCan't open file <%s>to restore game\n",fname);
nap(2000); c[GOLD]=c[BANKACCOUNT]=0; died(-265); return;
}
if (strcmp(fname,ckpfile) == 0)
{
if (lappend(fname) < 0) fcheat(); else { lprc(' '); lwclose(); }
- lcreat((char*)0);
+ lcreat(NULL);
}
else if (unlink(fname) < 0) fcheat(); /* can't unlink save file */
/* for the greedy cheater checker */
long *p,*pe;
for (p=c,pe=c+100; p<pe; *p++ =0);
time(&initialtime); srandomdev();
- lcreat((char*)0); /* open buffering for output to terminal */
+ lcreat(NULL); /* open buffering for output to terminal */
}
/*
* lcreat(filename) Create a new file for write
* char *filename;
*
- * lcreat((char*)0); means to the terminal
+ * lcreat(NULL); means to the terminal
* Returns -1 if error, otherwise the file descriptor opened.
*/
int
inbuffer = malloc((5*MAXIBUF)>>2); /* output buffer */
if ((lpbuf==0) || (inbuffer==0)) died(-285); /* malloc() failure */
- lcreat((char*)0); newgame(); /* set the initial clock */ hard= -1;
+ lcreat(NULL); newgame(); /* set the initial clock */ hard= -1;
#ifdef VT100
/*
if (lopen(scorefile)<0)
{ lprcat("Can't read scoreboard\n"); lflush(); return(-1); }
lrfill((char*)sco,sizeof(sco)); lrfill((char*)winr,sizeof(winr));
- lrclose(); lcreat((char*)0); return(0);
+ lrclose(); lcreat(NULL); return(0);
}
/*
if (lcreat(scorefile)<0)
{ lprcat("Can't write scoreboard\n"); lflush(); return(-1); }
lwrite((char*)sco,sizeof(sco)); lwrite((char*)winr,sizeof(winr));
- lwclose(); lcreat((char*)0); return(0);
+ lwclose(); lcreat(NULL); return(0);
}
/*
showscores(void)
{
int i,j;
- lflush(); lcreat((char*)0); if (readboard()<0) return;
+ lflush(); lcreat(NULL); if (readboard()<0) return;
i=winshou(); j=shou(0);
if (i+j == 0) lprcat(esb); else lprc('\n');
lflush();
showallscores(void)
{
int i,j;
- lflush(); lcreat((char*)0); if (readboard()<0) return;
+ lflush(); lcreat(NULL); if (readboard()<0) return;
c[WEAR] = c[WIELD] = c[SHIELD] = -1; /* not wielding or wearing anything */
for (i=0; i<MAXPOTION; i++) potionname[i] = potionhide[i];
for (i=0; i<MAXSCROLL; i++) scrollname[i] = scrollhide[i];
{
if (lcreat(logfile)<0) /* and can't create new log file */
{
- lcreat((char*)0);
+ lcreat(NULL);
lprcat("\nCan't open record file: I can't post your score.\n");
sncbr(); resetscroll(); lflush(); exit(1);
}
int n;
char *p;
struct stat stbuf;
- lcreat((char*)0);
+ lcreat(NULL);
if (lopen(logfile)<0)
{
lprintf("Can't locate log file <%s>\n",logfile);
if (lappend(playerids) < 0) return(-1); /* can't open file for append */
lprintf("%d\n%s",(long)++high,name); /* new id # and name */
lwclose();
- lcreat((char*)0); /* re-open terminal channel */
+ lcreat(NULL); /* re-open terminal channel */
return(high);
}
#endif /* UIDSCORE */
tstop(void) /* control Y */
{
if (nosignal) return; /* nothing if inhibited */
- lcreat((char*)0); clearvt100(); lflush(); signal(SIGTSTP,SIG_DFL);
+ lcreat(NULL); clearvt100(); lflush(); signal(SIGTSTP,SIG_DFL);
#ifdef SIGVTALRM
/* looks like BSD4.2 or higher - must clr mask for signal to take effect*/
sigsetmask(sigblock(0)& ~BIT(SIGTSTP));
typedef struct obj object;
-#define INIT_AW (object*)0,(object*)0
-#define INIT_RINGS (object*)0,(object*)0
+#define INIT_AW NULL,NULL
+#define INIT_RINGS NULL,NULL
#define INIT_HP 12
#define INIT_STR 16,16
#define INIT_EXP 1,0
for (i = 0; i < 50; i++) {
mv_mons();
}
- killed_by((object *)0, HYPOTHERMIA);
+ killed_by(NULL, HYPOTHERMIA);
}
message(you_can_move_again, 1);
monster->m_flags &= (~FREEZING_ROGUE);
rigg[3] -= rhits;
}
if (rig && !rigg[2] && (!rigg[3] || rigg[3] == -1))
- makesignal(on, "dismasted!", (struct ship *)0);
+ makesignal(on, "dismasted!", NULL);
if (portside(from, on, 0)) {
guns = on->specs->gunR;
car = on->specs->carR;
message = "main topmast and mizzen mast shattered";
break;
}
- makesignal(on, message, (struct ship *)0);
+ makesignal(on, message, NULL);
} else if (roll == 6) {
switch (Hhit) {
case 0:
message = "shot holes below the water line";
break;
}
- makesignal(on, message, (struct ship *)0);
+ makesignal(on, message, NULL);
}
if (!hull)
strike(on, from);
foreachship(sq)
cleansnag(sp, sq, 1);
if (sink != 1) {
- makesignal(sp, "exploding!", (struct ship *)0);
+ makesignal(sp, "exploding!", NULL);
foreachship(sq) {
if (sp != sq && sq->file->dir && range(sp, sq) < 4)
table(RIGGING, L_EXPLODE, sp->specs->guns/13, sq, sp, 6);
}
} else
- makesignal(sp, "sinking!", (struct ship *)0);
+ makesignal(sp, "sinking!", NULL);
}
}
Write(isdefense ? W_DBP : W_OBP, from,
n, turn, to->file->index, sections);
if (isdefense)
- makesignal(from, "repelling boarders",
- (struct ship *)0);
+ makesignal(from, "repelling boarders", NULL);
else
makesignal(from, "boarding the %s (%c%c)", to);
}
sigset_t sigset; \
sigemptyset(&sigset); \
sigaddset(&sigset, SIGALRM); \
- sigprocmask(SIG_BLOCK, &sigset, (sigset_t *)0); \
+ sigprocmask(SIG_BLOCK, &sigset, NULL); \
} while (0)
#define unblockalarm() \
do { \
sigset_t sigset; \
sigemptyset(&sigset); \
sigaddset(&sigset, SIGALRM); \
- sigprocmask(SIG_UNBLOCK, &sigset, (sigset_t *)0); \
+ sigprocmask(SIG_UNBLOCK, &sigset, NULL); \
} while (0)
if (done_curses) {
Signal("It looks like you've had it!",
- (struct ship *)0);
+ NULL);
switch (conditions) {
case LEAVE_QUIT:
break;
case LEAVE_CAPTURED:
Signal("Your ship was captured.",
- (struct ship *)0);
+ NULL);
break;
case LEAVE_HURRICAN:
Signal("Hurricane! All ships destroyed.",
- (struct ship *)0);
+ NULL);
break;
case LEAVE_DRIVER:
- Signal("The driver died.", (struct ship *)0);
+ Signal("The driver died.", NULL);
break;
case LEAVE_SYNC:
- Signal("Synchronization error.", (struct ship *)0);
+ Signal("Synchronization error.", NULL);
break;
default:
Signal("A funny thing happened (%d).",
- (struct ship *)0, conditions);
+ NULL, conditions);
}
} else {
switch (conditions) {
write_log(ms);
if (conditions != LEAVE_SYNC) {
makesignal(ms, "Captain %s relinquishing.",
- (struct ship *)0, mf->captain);
+ NULL, mf->captain);
Write(W_END, ms, 0, 0, 0, 0);
Sync();
}
signal(SIGCHLD, SIG_IGN);
do {
- pid = wait3((int *)&status, WNOHANG, (struct rusage *)0);
+ pid = wait3((int *)&status, WNOHANG, NULL);
if (pid < 0 || (pid > 0 && !WIFSTOPPED(status)))
hasdriver = 0;
} while (pid > 0);
struct ship *sp;
for (;;) {
- switch (sgetch("~\b", (struct ship *)0, 0)) {
+ switch (sgetch("~\b", NULL, 0)) {
case 'm':
acceptmove();
break;
unfoulplayer();
break;
case 'v':
- Signal("%s", (struct ship *)0, version);
+ Signal("%s", NULL, version);
break;
case 'b':
acceptboard();
repair();
break;
case 'B':
- Signal("'Hands to stations!'", (struct ship *)0);
+ Signal("'Hands to stations!'", NULL);
unboard(ms, ms, 1); /* cancel DBP's */
unboard(ms, ms, 0); /* cancel offense */
break;
mf->loadR = L_EMPTY;
mf->readyL = R_EMPTY;
mf->readyR = R_EMPTY;
- Signal("Broadsides unloaded", (struct ship *)0);
+ Signal("Broadsides unloaded", NULL);
break;
case 'q':
- Signal("Type 'Q' to quit", (struct ship *)0);
+ Signal("Type 'Q' to quit", NULL);
break;
case 'Q':
leave(LEAVE_QUIT);
break;
case 'i':
if ((sp = closestenemy(ms, 0, 1)) == 0)
- Signal("No more ships left.", (struct ship *)0);
+ Signal("No more ships left.", NULL);
else
eyeball(sp);
break;
closest, r ? "right" : "left");
if (load > L_CHAIN && target < 6) {
switch (sgetch("Aim for hull or rigging? ",
- (struct ship *)0, 1)) {
+ NULL, 1)) {
case 'r':
shootat = RIGGING;
break;
default:
shootat = -1;
Signal("'Avast there! Hold your fire.'",
- (struct ship *)0);
+ NULL);
}
} else {
- if (sgetch("Fire? ", (struct ship *)0, 1) == 'n') {
+ if (sgetch("Fire? ", NULL, 1) == 'n') {
shootat = -1;
Signal("Belay that! Hold your fire.",
- (struct ship *)0);
+ NULL);
} else
shootat = RIGGING;
}
table(shootat, load, hit, closest, ms, roll);
}
Signal("Damage inflicted on the %s:",
- (struct ship *)0, closest->shipname);
+ NULL, closest->shipname);
Signal("\t%d HULL, %d GUNS, %d CREW, %d RIGGING",
- (struct ship *)0, hhits, ghits, chits, rhits);
+ NULL, hhits, ghits, chits, rhits);
if (!r) {
mf->loadL = L_EMPTY;
mf->readyL = R_EMPTY;
continue;
cant:
Signal("Unable to fire %s broadside",
- (struct ship *)0, r ? "right" : "left");
+ NULL, r ? "right" : "left");
}
blockalarm();
draw_stat();
|| ms->nationality == capship(sp)->nationality) {
Write(W_GRAP, ms, sp->file->index, 0, 0, 0);
Write(W_GRAP, sp, player, 0, 0, 0);
- Signal("Attempt succeeds!", (struct ship *)0);
+ Signal("Attempt succeeds!", NULL);
makesignal(ms, "grappled with %s (%c%c)", sp);
} else
- Signal("Attempt fails.", (struct ship *)0);
+ Signal("Attempt fails.", NULL);
break;
case 'u':
for (i = grappled2(ms, sp); --i >= 0;) {
|| die() < 3) {
cleangrapple(ms, sp, 0);
Signal("Attempt succeeds!",
- (struct ship *)0);
+ NULL);
makesignal(ms,
"ungrappling with %s (%c%c)",
sp);
} else
Signal("Attempt fails.",
- (struct ship *)0);
+ NULL);
}
break;
}
for (i = fouled2(ms, to); --i >= 0;) {
if (die() <= 2) {
cleanfoul(ms, to, 0);
- Signal("Attempt succeeds!", (struct ship *)0);
+ Signal("Attempt succeeds!", NULL);
makesignal(ms, "Unfouling %s (%c%c)", to);
} else
- Signal("Attempt fails.", (struct ship *)0);
+ Signal("Attempt fails.", NULL);
}
}
}
if (mc->crew3 && rig) {
if (!full) {
if (sgetch("Increase to Full sails? ",
- (struct ship *)0, 1) == 'y') {
+ NULL, 1) == 'y') {
changed = 1;
Write(W_FS, ms, 1, 0, 0, 0);
}
} else {
if (sgetch("Reduce to Battle sails? ",
- (struct ship *)0, 1) == 'y') {
+ NULL, 1) == 'y') {
Write(W_FS, ms, 0, 0, 0, 0);
changed = 1;
}
}
} else if (!rig)
- Signal("Sails rent to pieces", (struct ship *)0);
+ Signal("Sails rent to pieces", NULL);
}
void
if (ship->file->dir != 0) {
Signal("Sail ho! (range %d, %s)",
- (struct ship *)0, range(ms, ship), saywhat(ship, 0));
+ NULL, range(ms, ship), saywhat(ship, 0));
i = portside(ms, ship, 1) - mf->dir;
if (i <= 0)
i += 8;
char *p;
if (!mc->crew3 || snagged(ms) || !windspeed) {
- Signal("Unable to move", (struct ship *)0);
+ Signal("Unable to move", NULL);
return;
}
dir = 1;
if (last == 't') {
Signal("Ship can't turn that fast.",
- (struct ship *)0);
+ NULL);
*p-- = '\0';
}
last = 't';
case '5': case '6': case '7':
if (last == '0') {
Signal("Can't move that fast.",
- (struct ship *)0);
+ NULL);
*p-- = '\0';
}
last = '0';
break;
default:
if (!isspace(*p)) {
- Signal("Input error.", (struct ship *)0);
+ Signal("Input error.", NULL);
*p-- = '\0';
}
}
if ((ta < 0 && moved) || (vma < 0 && moved)
|| (af && turnfirst(buf) && moved)) {
- Signal("Movement error.", (struct ship *)0);
+ Signal("Movement error.", NULL);
if (ta < 0 && moved) {
if (mf->FS == 1) {
Write(W_FS, ms, 0, 0, 0, 0);
Signal("No hands to set full sails.",
- (struct ship *)0);
+ NULL);
}
} else if (ma >= 0)
buf[1] = '\0';
if (mf->FS == 1) {
Write(W_FS, ms, 0, 0, 0, 0);
Signal("No hands to set full sails.",
- (struct ship *)0);
+ NULL);
}
}
if (*buf)
else
strcpy(movebuf, "d");
Writestr(W_MOVE, ms, movebuf);
- Signal("Helm: %s.", (struct ship *)0, movebuf);
+ Signal("Helm: %s.", NULL, movebuf);
}
void
}
if (crew[2]) {
c = sgetch("How many sections to repel boarders? ",
- (struct ship *)0, 1);
+ NULL, 1);
parties(crew, ms, 1, c);
}
blockalarm();
}
if (buf > '0')
Signal("Sending all crew sections.",
- (struct ship *)0);
+ NULL);
Write(isdefense ? W_DBP : W_OBP, ms,
j, turn, to->file->index, men);
if (isdefense) {
wmove(slot_w, 2, 1 + k);
mvwaddstr(slot_w, 3, 0, "DBP");
makesignal(ms, "repelling boarders",
- (struct ship *)0);
+ NULL);
} else {
wmove(slot_w, 0, 0);
for (k=0; k < NBP; k++)
wrefresh(slot_w);
unblockalarm();
} else
- Signal("Sending no crew sections.", (struct ship *)0);
+ Signal("Sending no crew sections.", NULL);
}
}
? (ptr->x += count, count = 0) : (count -= m - ptr->x, ptr->x = m))
if (repaired || loaded || fired || changed || turned()) {
- Signal("No hands free to repair", (struct ship *)0);
+ Signal("No hands free to repair", NULL);
return;
}
- c = sgetch("Repair (hull, guns, rigging)? ", (struct ship *)0, 1);
+ c = sgetch("Repair (hull, guns, rigging)? ", NULL, 1);
switch (c) {
case 'h':
repairs = &mf->RH;
repairs = &mf->RR;
break;
default:
- Signal("Avast heaving!", (struct ship *)0);
+ Signal("Avast heaving!", NULL);
return;
}
if (++*repairs >= 3) {
break;
}
if (count == 2) {
- Signal("Repairs completed.", (struct ship *)0);
+ Signal("Repairs completed.", NULL);
*repairs = 2;
} else {
*repairs = 0;
int loadL, loadR, ready, load;
if (!mc->crew3) {
- Signal("Out of crew", (struct ship *)0);
+ Signal("Out of crew", NULL);
return;
}
loadL = mf->loadL;
loadR = mf->loadR;
if (!loadL && !loadR) {
c = sgetch("Load which broadside (left or right)? ",
- (struct ship *)0, 1);
+ NULL, 1);
if (c == 'r')
loadL = 1;
else
}
if ((!loadL && loadR) || (loadL && !loadR)) {
c = sgetch("Reload with (round, double, chain, grape)? ",
- (struct ship *)0, 1);
+ NULL, 1);
switch (c) {
case 'r':
load = L_ROUND;
break;
default:
Signal("Broadside not loaded.",
- (struct ship *)0);
+ NULL);
return;
}
if (!loadR) {
int c;
char *p = buf;
- prompt(pr, (struct ship *)0);
+ prompt(pr, NULL);
sc_buf = buf;
for (;;) {
*p = 0;
exit(1);
}
initialize();
- Signal("Aye aye, Sir", (struct ship *)0);
+ Signal("Aye aye, Sir", NULL);
play();
return 0; /* for lint, play() never returns */
}
* IP address is in dotted decimal format
*/
if ((sin.sin_addr.s_addr = inet_addr(p)) == -1) {
- return((struct sockaddr_in *)0);
+ return(NULL);
}
} else {
/*
ip_host = gethostbyname(p);
if (!ip_host ||
ip_host->h_addrtype != AF_INET) {
- return((struct sockaddr_in *)0);
+ return(NULL);
}
sin.sin_addr.s_addr = *(u_long *)ip_host->h_addr_list[0];
}
timeval.it_interval.tv_usec = 0;
if (setitimer(ITIMER_REAL, &timeval,
- (struct itimerval *)0) == -1) {
+ NULL) == -1) {
rc = errno;
(void)signal(SIGALRM, SIG_DFL);
}
len = (size_t)(p - tmp);
if (n < len) {
if (result)
- *result = (char *)0;
+ *result = NULL;
*nresult = (size_t)-1;
return E2BIG;
}
verrc(int eval, int code, const char *fmt, va_list ap)
{
if (err_file == 0)
- err_set_file((FILE *)0);
+ err_set_file(NULL);
fprintf(err_file, "%s: ", _getprogname());
if (fmt != NULL) {
vfprintf(err_file, fmt, ap);
verrx(int eval, const char *fmt, va_list ap)
{
if (err_file == 0)
- err_set_file((FILE *)0);
+ err_set_file(NULL);
fprintf(err_file, "%s: ", _getprogname());
if (fmt != NULL)
vfprintf(err_file, fmt, ap);
vwarnc(int code, const char *fmt, va_list ap)
{
if (err_file == 0)
- err_set_file((FILE *)0);
+ err_set_file(NULL);
fprintf(err_file, "%s: ", _getprogname());
if (fmt != NULL) {
vfprintf(err_file, fmt, ap);
vwarnx(const char *fmt, va_list ap)
{
if (err_file == 0)
- err_set_file((FILE *)0);
+ err_set_file(NULL);
fprintf(err_file, "%s: ", _getprogname());
if (fmt != NULL)
vfprintf(err_file, fmt, ap);
NULL,
NULL,
};
-static FILE *netf = (FILE *)0;
+static FILE *netf = NULL;
static int parse_netgrp(const char *);
static struct linelist *read_for_group(const char *);
if (group == NULL || !strlen(group))
return;
- if (grouphead.gr == (struct netgrp *)0 ||
+ if (grouphead.gr == NULL ||
strcmp(group, grouphead.grname)) {
endnetgrent();
#ifdef YP
free(olp->l_line);
free((char *)olp);
}
- linehead = (struct linelist *)0;
+ linehead = NULL;
if (grouphead.grname) {
free(grouphead.grname);
- grouphead.grname = (char *)0;
+ grouphead.grname = NULL;
}
gp = grouphead.gr;
while (gp) {
free(ogp->ng_str[NG_DOM]);
free((char *)ogp);
}
- grouphead.gr = (struct netgrp *)0;
- nextgrp = (struct netgrp *)0;
+ grouphead.gr = NULL;
+ nextgrp = NULL;
#ifdef YP
_netgr_yp_enabled = 0;
#endif
break;
lp = lp->l_next;
}
- if (lp == (struct linelist *)0 &&
- (lp = read_for_group(group)) == (struct linelist *)0)
+ if (lp == NULL &&
+ (lp = read_for_group(group)) == NULL)
return (1);
if (lp->l_parsed) {
#ifdef DEBUG
strlen(group), &result, &resultlen)) {
free(result);
if (_use_only_yp)
- return ((struct linelist *)0);
+ return (NULL);
else {
_netgr_yp_enabled = 0;
continue;
name[1] = VFS_GENERIC;
name[2] = VFS_MAXTYPENUM;
buflen = sizeof(maxtypenum);
- if (sysctl(name, 3, &maxtypenum, &buflen, (void *)0, (size_t)0) < 0)
+ if (sysctl(name, 3, &maxtypenum, &buflen, NULL, (size_t)0) < 0)
return (-1);
name[2] = VFS_CONF;
buflen = sizeof(*vfcp);
for (cnt = 0; cnt < maxtypenum; cnt++) {
name[3] = cnt;
- if (sysctl(name, 4, vfcp, &buflen, (void *)0, (size_t)0) < 0) {
+ if (sysctl(name, 4, vfcp, &buflen, NULL, (size_t)0) < 0) {
if (errno == EOPNOTSUPP)
continue;
return (-1);
size_t size = 0;
int rv;
- rv = sysctl(mib, 2, (void *)0, &size, (void *)0, (size_t)0);
+ rv = sysctl(mib, 2, NULL, &size, NULL, (size_t)0);
if(rv < 0)
return 0;
if(!_vfslist)
return 0;
- rv = sysctl(mib, 2, _vfslist, &size, (void *)0, (size_t)0);
+ rv = sysctl(mib, 2, _vfslist, &size, NULL, (size_t)0);
if(rv < 0) {
free(_vfslist);
_vfslist = 0;
fclose(iop);
do {
- pid = _wait4(cur->pid, &pstat, 0, (struct rusage *)0);
+ pid = _wait4(cur->pid, &pstat, 0, NULL);
} while (pid == -1 && errno == EINTR);
free(cur);
struct sigaction sa;
int ret;
- if ((ret = _sigaction(sig, (struct sigaction *)0, &sa)) < 0)
+ if ((ret = _sigaction(sig, NULL, &sa)) < 0)
return (ret);
if (flag) {
sigaddset(&_sigintr, sig);
sigdelset(&_sigintr, sig);
sa.sa_flags |= SA_RESTART;
}
- return (_sigaction(sig, &sa, (struct sigaction *)0));
+ return (_sigaction(sig, &sa, NULL));
}
struct timeval tt;
time_t retval;
- if (gettimeofday(&tt, (struct timezone *)0) < 0)
+ if (gettimeofday(&tt, NULL) < 0)
retval = -1;
else
retval = tt.tv_sec;
pid_t
__wait(int *istat)
{
- return (_wait4(WAIT_ANY, istat, 0, (struct rusage *)0));
+ return (_wait4(WAIT_ANY, istat, 0, NULL));
}
__weak_reference(__wait, wait);
pid_t
__waitpid(pid_t pid, int *istat, int options)
{
- return (_wait4(pid, istat, options, (struct rusage *)0));
+ return (_wait4(pid, istat, options, NULL));
}
__weak_reference(__waitpid, waitpid);
p->state = GMON_PROF_ON;
} else {
/* stop */
- profil((char *)0, 0, 0, 0);
+ profil(NULL, 0, 0, 0);
p->state = GMON_PROF_OFF;
}
}
/* Macro for mmap */
#define MMAP(size) \
- mmap((void *)0, (size), PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, \
+ mmap(NULL, (size), PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, \
-1, (off_t)0)
/*
default: /* parent */
savedpid = pid;
do {
- pid = _wait4(savedpid, &pstat, 0, (struct rusage *)0);
+ pid = _wait4(savedpid, &pstat, 0, NULL);
} while (pid == -1 && errno == EINTR);
break;
}
blkoff = fp->f_off % ISO_DEFAULT_BLOCK_SIZE;
if (blkno != fp->f_buf_blkno) {
- if (fp->f_buf == (char *)0)
+ if (fp->f_buf == NULL)
fp->f_buf = malloc(ISO_DEFAULT_BLOCK_SIZE);
twiddle();
}
if (fp->f_blkno[level] != ind_block_num) {
- if (fp->f_blk[level] == (char *)0)
+ if (fp->f_blk[level] == NULL)
fp->f_blk[level] =
malloc(fs->fs_bsize);
twiddle();
if (error)
goto done;
- if (fp->f_buf == (char *)0)
+ if (fp->f_buf == NULL)
fp->f_buf = malloc(fs->fs_bsize);
if (disk_block == 0) {
struct file *fp = (struct file *)f->f_fsdata;
int level;
- f->f_fsdata = (void *)0;
- if (fp == (struct file *)0)
+ f->f_fsdata = NULL;
+ if (fp == NULL)
return (0);
for (level = 0; level < NIADDR; level++) {
#define IP_ANYADDR 0
n_long addr = 0, n;
- if (p == (char *)0 || *p == '\0')
+ if (p == NULL || *p == '\0')
return IP_ANYADDR;
p = number(p, &n);
addr |= (n << 24) & 0xff000000;
/* find a free socket */
for (fd = 0, s = sockets; fd < SOPEN_MAX; fd++, s++)
- if (s->io_netif == (struct netif *)0)
+ if (s->io_netif == NULL)
goto fnd;
errno = EMFILE;
return (-1);
return(-1);
}
netif_detach(sockets[sock].io_netif);
- sockets[sock].io_netif = (struct netif *)0;
+ sockets[sock].io_netif = NULL;
return(0);
}
f = &files[fd];
f->f_flags = mode + 1;
- f->f_dev = (struct devsw *)0;
- f->f_ops = (struct fs_ops *)0;
+ f->f_dev = NULL;
+ f->f_ops = NULL;
f->f_offset = 0;
f->f_devdata = NULL;
f->f_fsdata = NULL;
file = NULL;
error = devopen(f, fname, &file);
if (error ||
- (((f->f_flags & F_NODEV) == 0) && f->f_dev == (struct devsw *)0))
+ (((f->f_flags & F_NODEV) == 0) && f->f_dev == NULL))
goto err;
/* see if we opened a raw device; otherwise, 'file' is the file name. */
}
if (fp->f_blkno[level] != ind_block_num) {
- if (fp->f_blk[level] == (char *)0)
+ if (fp->f_blk[level] == NULL)
fp->f_blk[level] =
malloc(fs->fs_bsize);
twiddle();
if (rc)
return (rc);
- if (fp->f_buf == (char *)0)
+ if (fp->f_buf == NULL)
fp->f_buf = malloc(fs->fs_bsize);
if (disk_block == 0) {
VGLEnd();
return -9;
}
- VGLTextSetFontFile((byte*)0);
+ VGLTextSetFontFile(NULL);
VGLClear(VGLDisplay, 0);
return 0;
}
free(VGLTextFont);
}
- if ((VGLTextFont=(VGLText*)malloc(sizeof(VGLText))) == (VGLText*)0)
+ if ((VGLTextFont=(VGLText*)malloc(sizeof(VGLText))) == NULL)
return 1;
if (filename==NULL) {
VGLTextFont->BitmapArray = VGLFont;
}
else {
- if ((fd=fopen(filename, "r"))==(FILE*)0)
+ if ((fd=fopen(filename, "r"))==NULL)
return 1;
fread(&VGLTextFont->Width, 1 , 1, fd);
fread(&VGLTextFont->Height, 1 , 1, fd);
exit(1);
}
signal(SIGINT, SIG_DFL);
- for (i = 0; environ[i] != (char *)0; i++)
+ for (i = 0; environ[i] != NULL; i++)
env[i] = environ[i];
makeenv(&env[i]);
if (*p)
*ep++ = p;
}
- *ep = (char *)0;
+ *ep = NULL;
}
/*
RMPCONN *rtmp;
struct timeval now;
- (void) gettimeofday(&now, (struct timezone *)0);
+ (void) gettimeofday(&now, NULL);
/*
* For each active connection, if RMP_TIMEOUT seconds have passed
/*
* Last time this connection was active.
*/
- (void) gettimeofday(&rconn->tstamp, (struct timezone *)0);
+ (void) gettimeofday(&rconn->tstamp, NULL);
if (DbgFp != NULL) /* display packet */
DispPkt(rconn,DIR_SENT);
#define NG_USER 1 /* User name */
#define NG_DOM 2 /* and Domain name */
-static struct linelist *linehead = (struct linelist *)0;
-static struct netgrp *nextgrp = (struct netgrp *)0;
+static struct linelist *linehead = NULL;
+static struct netgrp *nextgrp = NULL;
static struct {
struct netgrp *gr;
char *grname;
} grouphead = {
- (struct netgrp *)0,
- (char *)0,
+ NULL,
+ NULL,
};
static int parse_netgrp(char *);
static struct linelist *read_for_group(char *);
if (group == NULL || !strlen(group))
return;
- if (grouphead.gr == (struct netgrp *)0 ||
+ if (grouphead.gr == NULL ||
strcmp(group, grouphead.grname)) {
__endnetgrent();
if (parse_netgrp(group))
free(olp->l_line);
free((char *)olp);
}
- linehead = (struct linelist *)0;
+ linehead = NULL;
if (grouphead.grname) {
free(grouphead.grname);
- grouphead.grname = (char *)0;
+ grouphead.grname = NULL;
}
gp = grouphead.gr;
while (gp) {
free(ogp->ng_str[NG_DOM]);
free((char *)ogp);
}
- grouphead.gr = (struct netgrp *)0;
+ grouphead.gr = NULL;
}
/*
break;
lp = lp->l_next;
}
- if (lp == (struct linelist *)0 &&
- (lp = read_for_group(group)) == (struct linelist *)0)
+ if (lp == NULL &&
+ (lp = read_for_group(group)) == NULL)
return (1);
if (lp->l_parsed) {
#ifdef DEBUG
#endif
return (lp);
}
- return ((struct linelist *)0);
+ return (NULL);
}
break;
} else
#endif
- if (select(nfd, &ready, (fd_set *)0,
- (fd_set *)0, (struct timeval *)0) < 0)
+ if (select(nfd, &ready, NULL,
+ NULL, NULL) < 0)
break;
if (FD_ISSET(s, &ready)) {
int ret;
}
info->dli_fname = obj->path;
info->dli_fbase = obj->mapbase;
- info->dli_saddr = (void *)0;
+ info->dli_saddr = NULL;
info->dli_sname = NULL;
/*
case LEAVE_INVITE:
ptr = find_request(mp);
- if (ptr != (CTL_MSG *)0) {
+ if (ptr != NULL) {
rp->id_num = htonl(ptr->id_num);
rp->answer = SUCCESS;
} else
case LOOK_UP:
ptr = find_match(mp);
- if (ptr != (CTL_MSG *)0) {
+ if (ptr != NULL) {
rp->id_num = htonl(ptr->id_num);
rp->addr = ptr->addr;
rp->addr.sa_family = htons(ptr->addr.sa_family);
#define satosin(sa) ((struct sockaddr_in *)(sa))
hp = gethostbyaddr(&satosin(&mp->ctl_addr)->sin_addr,
sizeof (struct in_addr), AF_INET);
- if (hp == (struct hostent *)0) {
+ if (hp == NULL) {
rp->answer = MACHINE_UNKNOWN;
return;
}
#define MAX_ID 16000 /* << 2^15 so I don't have sign troubles */
-#define NIL ((TABLE_ENTRY *)0)
-
extern int debug;
struct timeval tp;
struct timezone txp;
TABLE_ENTRY *last;
};
-TABLE_ENTRY *table = NIL;
+TABLE_ENTRY *table = NULL;
void delete (TABLE_ENTRY *);
CTL_MSG *find_request();
current_time = tp.tv_sec;
if (debug)
print_request("find_match", request);
- for (ptr = table; ptr != NIL; ptr = ptr->next) {
+ for (ptr = table; ptr != NULL; ptr = ptr->next) {
if ((ptr->time - current_time) > MAX_LIFE) {
/* the entry is too old */
if (debug)
ptr->request.type == LEAVE_INVITE)
return (&ptr->request);
}
- return ((CTL_MSG *)0);
+ return (NULL);
}
/*
*/
if (debug)
print_request("find_request", request);
- for (ptr = table; ptr != NIL; ptr = ptr->next) {
+ for (ptr = table; ptr != NULL; ptr = ptr->next) {
if ((ptr->time - current_time) > MAX_LIFE) {
/* the entry is too old */
if (debug)
return (&ptr->request);
}
}
- return ((CTL_MSG *)0);
+ return (NULL);
}
void
response->id_num = htonl(request->id_num);
/* insert a new entry into the top of the list */
ptr = (TABLE_ENTRY *)malloc(sizeof(TABLE_ENTRY));
- if (ptr == NIL) {
+ if (ptr == NULL) {
syslog(LOG_ERR, "insert_table: Out of memory");
_exit(1);
}
ptr->time = current_time;
ptr->request = *request;
ptr->next = table;
- if (ptr->next != NIL)
+ if (ptr->next != NULL)
ptr->next->last = ptr;
- ptr->last = NIL;
+ ptr->last = NULL;
table = ptr;
}
ptr = table;
if (debug)
syslog(LOG_DEBUG, "delete_invite(%d)", id_num);
- for (ptr = table; ptr != NIL; ptr = ptr->next) {
+ for (ptr = table; ptr != NULL; ptr = ptr->next) {
if (ptr->request.id_num == id_num)
break;
if (debug)
print_request("", &ptr->request);
}
- if (ptr != NIL) {
+ if (ptr != NULL) {
delete(ptr);
return (SUCCESS);
}
print_request("delete", &ptr->request);
if (table == ptr)
table = ptr->next;
- else if (ptr->last != NIL)
+ else if (ptr->last != NULL)
ptr->last->next = ptr->next;
- if (ptr->next != NIL)
+ if (ptr->next != NULL)
ptr->next->last = ptr->last;
free((char *)ptr);
}
/*
* local variables
*/
-static unsigned char *def_slcbuf = (unsigned char *)0;
+static unsigned char *def_slcbuf = NULL;
static int def_slclen = 0;
static int slcchange; /* change to slc is requested */
static unsigned char *slcptr; /* pointer into slc buffer */
* save this slc buffer if it is the first, otherwise dump
* it.
*/
- if (def_slcbuf == (unsigned char *)0) {
+ if (def_slcbuf == NULL) {
def_slclen = len;
def_slcbuf = (unsigned char *)malloc((unsigned)len);
- if (def_slcbuf == (unsigned char *)0)
+ if (def_slcbuf == NULL)
return; /* too bad */
memmove(def_slcbuf, ptr, len);
}
do_opt_slc(def_slcbuf, def_slclen);
(void) end_slc(0);
free(def_slcbuf);
- def_slcbuf = (unsigned char *)0;
+ def_slcbuf = NULL;
def_slclen = 0;
}
case SLC_AYT:
case SLC_EOR:
*valp = (cc_t)0;
- *valpp = (cc_t *)0;
+ *valpp = NULL;
return(SLC_DEFAULT);
default:
*valp = (cc_t)0;
- *valpp = (cc_t *)0;
+ *valpp = NULL;
return(SLC_NOSUPPORT);
}
}
#define setval(a, b) *valp = termbuf.c_cc[a]; \
*valpp = &termbuf.c_cc[a]; \
return(b);
-#define defval(a) *valp = ((cc_t)a); *valpp = (cc_t *)0; return(SLC_DEFAULT);
+#define defval(a) *valp = ((cc_t)a); *valpp = NULL; return(SLC_DEFAULT);
int
spcset(int func, cc_t *valp, cc_t **valpp)
# ifdef TIOCNOTTY
t = open(_PATH_TTY, O_RDWR);
if (t >= 0) {
- (void) ioctl(t, TIOCNOTTY, (char *)0);
+ (void) ioctl(t, TIOCNOTTY, NULL);
(void) close(t);
}
# endif
if (argv == NULL)
return(NULL);
*argv++ = (char *)10;
- *argv = (char *)0;
+ *argv = NULL;
}
for (cpp = argv; *cpp; cpp++)
;
int t;
t = open(_PATH_TTY, O_RDWR);
if (t >= 0) {
- (void) ioctl(t, TIOCNOTTY, (char *)0);
+ (void) ioctl(t, TIOCNOTTY, NULL);
(void) close(t);
}
}
if (!SYNCHing) {
FD_SET(f, &xbits);
}
- if ((c = select(nfd, &ibits, &obits, &xbits,
- (struct timeval *)0)) < 1) {
+ if ((c = select(nfd, &ibits, &obits, &xbits, NULL)) < 1) {
if (c == -1) {
if (errno == EINTR) {
continue;
FD_ZERO(&excepts);
FD_SET(s, &excepts);
memset((char *)&timeout, 0, sizeof timeout);
- value = select(s+1, (fd_set *)0, (fd_set *)0, &excepts, &timeout);
+ value = select(s+1, NULL, NULL, &excepts, &timeout);
} while ((value == -1) && (errno == EINTR));
if (value < 0) {
show_ip_vcc(int argc, char **argv, __unused const struct cmd *cmdp)
{
int buf_len, ip_info_len, rc;
- char *if_name = (char *)0;
+ char *if_name = NULL;
struct atminfreq air;
struct air_ip_vcc_rsp *ip_info, *ip_info_base;
struct sockaddr_in *sin;
sigsetmask(omask);
setgid(getgid());
setuid(getuid());
- if ((ed = getenv("EDITOR")) == (char *)0)
+ if ((ed = getenv("EDITOR")) == NULL)
ed = DEFEDITOR;
- execlp(ed, ed, tmpfil, (char *)0);
+ execlp(ed, ed, tmpfil, NULL);
err(1, "%s", ed);
}
while ((xpid = wait(&status)) >= 0)
sigsetmask(omask);
setgid(getgid());
setuid(getuid());
- if ((ed = getenv("EDITOR")) == (char *)0)
+ if ((ed = getenv("EDITOR")) == NULL)
ed = DEFEDITOR;
- execlp(ed, ed, tmpfil, (char *)0);
+ execlp(ed, ed, tmpfil, NULL);
err(1, "%s", ed);
}
while ((xpid = wait(&status)) >= 0)
msg("%s", "");
#ifdef KERBEROS
if (dokerberos)
- rmtape = krcmd(&rmtpeer, sp->s_port, tuser, rmt, &errfd,
- (char *)0);
+ rmtape = krcmd(&rmtpeer, sp->s_port, tuser, rmt, &errfd, NULL);
else
#endif
rmtape = rcmd(&rmtpeer, (u_short)sp->s_port, pwd->pw_name,
mib[0] = CTL_KERN;
mib[1] = KERN_DUMPDEV;
- rv = sysctl(mib, 2, (void *)0, (size_t *)0, &stab.st_rdev,
- sizeof stab.st_rdev);
+ rv = sysctl(mib, 2, NULL, NULL, &stab.st_rdev, sizeof stab.st_rdev);
if (rv) {
err(EX_OSERR, "sysctl: kern.dumpdev");
}
return (inp);
}
errx(EEXIT, "cannot find inode %d", inumber);
- return ((struct inoinfo *)0);
+ return (NULL);
}
/*
printf("\n");
}
}
- zlnhead = (struct zlncnt *)0;
- duplist = (struct dups *)0;
- muldup = (struct dups *)0;
+ zlnhead = NULL;
+ duplist = NULL;
+ muldup = NULL;
inocleanup();
if (fsmodified) {
sblock.fs_time = time(NULL);
long bufcnt, i;
char *bufp;
- pbp = pdirbp = (struct bufarea *)0;
+ pbp = pdirbp = NULL;
bufp = malloc((unsigned int)sblock.fs_bsize);
if (bufp == 0)
errx(EEXIT, "cannot allocate buffer pool");
}
if (bufhead.b_size != cnt)
errx(EEXIT, "panic: lost %d buffers", bufhead.b_size - cnt);
- pbp = pdirbp = (struct bufarea *)0;
+ pbp = pdirbp = NULL;
if (sblock.fs_clean != markclean) {
sblock.fs_clean = markclean;
sbdirty();
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = SIG_IGN;
- sigaction(SIGTTIN, &sa, (struct sigaction *)0);
- sigaction(SIGTTOU, &sa, (struct sigaction *)0);
+ sigaction(SIGTTIN, &sa, NULL);
+ sigaction(SIGTTOU, &sa, NULL);
/*
* Paranoia.
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = SIG_IGN;
- sigaction(SIGTSTP, &sa, (struct sigaction *)0);
- sigaction(SIGHUP, &sa, (struct sigaction *)0);
+ sigaction(SIGTSTP, &sa, NULL);
+ sigaction(SIGHUP, &sa, NULL);
setctty(_PATH_CONSOLE);
clang = 0;
alarm(DEATH_WATCH);
do
- if ((pid = waitpid(-1, (int *)0, 0)) != -1)
+ if ((pid = waitpid(-1, NULL, 0)) != -1)
collect_child(pid);
while (clang == 0 && errno != ECHILD);
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = SIG_IGN;
- sigaction(SIGTSTP, &sa, (struct sigaction *)0);
- sigaction(SIGHUP, &sa, (struct sigaction *)0);
+ sigaction(SIGTSTP, &sa, NULL);
+ sigaction(SIGHUP, &sa, NULL);
if ((fd = open(_PATH_CONSOLE, O_RDWR)) == -1)
warning("can't open %s: %m", _PATH_CONSOLE);
struct nfs_args nfsdefargs = {
NFS_ARGSVERSION,
- (struct sockaddr *)0,
+ NULL,
sizeof (struct sockaddr_in),
SOCK_DGRAM,
0,
- (u_char *)0,
+ NULL,
0,
NFSMNT_RESVPORT,
NFS_WSIZE,
NFS_DEFRAHEAD,
0,
NFS_DEADTHRESH,
- (char *)0,
+ NULL,
/* args version 4 */
NFS_MINATTRTIMO,
NFS_MAXATTRTIMO,
*/
if (kret == KSUCCESS &&
ktick.kt.length <= (RPCAUTH_MAXSIZ-3*NFSX_UNSIGNED)
- && gettimeofday(&ktv, (struct timezone *)0) == 0) {
+ && gettimeofday(&ktv, NULL) == 0) {
ncd.ncd_authtype = RPCAUTH_KERB4;
ncd.ncd_authstr = (u_char *)&ktick;
ncd.ncd_authlen = nfsm_rndup(ktick.kt.length) +
sain.sin_addr.s_addr = INADDR_ANY;
if (bind(so, (struct sockaddr *) &sain, sizeof(sain)) == 0) {
listen(so, 1);
- if ((sock = accept(so, (struct sockaddr *)0, (int *)0)) == -1) {
+ if ((sock = accept(so, NULL, NULL)) == -1) {
syslog(LOG_ERR, "accept: %m");
close(so);
return (errno);
sain.sin_addr = *ipp[0];
if (bind(so, (struct sockaddr *) &sain, sizeof(sain)) == 0) {
listen(so, 1);
- if ((sock = accept(so, (struct sockaddr *)0, (int *)0)) == -1) {
+ if ((sock = accept(so, NULL, NULL)) == -1) {
syslog(LOG_ERR, "accept: %m");
close(so);
return (errno);
continue;
if (qnp->flags & HASGRP) {
fup = addid((u_long)dp->di_gid, GRPQUOTA,
- (char *)0);
+ NULL);
fup->fu_curinodes++;
if (mode == IFREG || mode == IFDIR ||
mode == IFLNK)
}
if (qnp->flags & HASUSR) {
fup = addid((u_long)dp->di_uid, USRQUOTA,
- (char *)0);
+ NULL);
fup->fu_curinodes++;
if (mode == IFREG || mode == IFDIR ||
mode == IFLNK)
* This is a level zero dump tape.
*/
vprintf(stdout, "Begin level 0 restore\n");
- initsymtable((char *)0);
+ initsymtable(NULL);
extractdirs(1);
vprintf(stdout, "Calculate extraction list.\n");
treescan(".", ROOTINO, nodeupdates);
case 't':
setup();
extractdirs(0);
- initsymtable((char *)0);
+ initsymtable(NULL);
while (argc--) {
canon(*argv++, name, sizeof(name));
ino = dirlookup(name);
case 'x':
setup();
extractdirs(1);
- initsymtable((char *)0);
+ initsymtable(NULL);
while (argc--) {
canon(*argv++, name, sizeof(name));
ino = dirlookup(name);
static void usage(void);
int fd = -1;
-char *dev = (char *)0; /* path name of the tty (e.g. /dev/tty01) */
+char *dev = NULL; /* path name of the tty (e.g. /dev/tty01) */
char *dvname; /* basename of dev */
int locked = 0; /* uucp lock active */
int flow_control = 0; /* non-zero to enable hardware flow control. */
warnx("too many args, first='%s'", argv[optind]);
if (optind > (argc - 1))
warnx("not enough args");
- if (dev == (char *)0) {
+ if (dev == NULL) {
usage();
exit_handler(2);
}
len = sizeof(*ifmd);
- return sysctl(name, 6, ifmd, &len, (void *)0, 0);
+ return sysctl(name, 6, ifmd, &len, NULL, 0);
}
.Ed
.Pp
.Fn write ,
one substitutes:
.Pp
-.Dl "sendto(sock, buf, len, MSG_EOF, (struct sockaddr *)0, 0)"
+.Dl "sendto(sock, buf, len, MSG_EOF, NULL, 0)"
.Pp
In this case, the reply is sent immediately, but as in the client
case, the socket is no longer useful for anything and should be
},
{ 0x10, 0x2, { 0x0, 0x0, 0x83, 0x68, 0x30, 0x12, } },
{
- (struct sockaddr *)0, SOCK_DGRAM, 0, (nfsv2fh_t *)0,
- 0, 8192, 8192, 10, 100, (char *)0,
+ NULL, SOCK_DGRAM, 0, NULL,
+ 0, 8192, 8192, 10, 100, NULL,
},
{
0xf,
{ 0x10, 0x2, { 0x8, 0x1, 0x83, 0x68, 0x30, 0x5, } },
"happy",
{
- (struct sockaddr *)0, SOCK_DGRAM, 0, (nfsv2fh_t *)0,
- 0, 8192, 8192, 10, 100, (char *)0,
+ NULL, SOCK_DGRAM, 0, NULL,
+ 0, 8192, 8192, 10, 100, NULL,
},
{
0x0,
*/
+#include <sys/param.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/systm.h>
/*** SHA-256: *********************************************************/
void SHA256_Init(SHA256_CTX* context) {
- if (context == (SHA256_CTX*)0) {
+ if (context == NULL) {
return;
}
bcopy(sha256_initial_hash_value, context->state, SHA256_DIGEST_LENGTH);
}
/* Sanity check: */
- assert(context != (SHA256_CTX*)0 && data != (sha2_byte*)0);
+ assert(context != NULL && data != NULL);
usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
if (usedspace > 0) {
unsigned int usedspace;
/* Sanity check: */
- assert(context != (SHA256_CTX*)0);
+ assert(context != NULL);
/* If no digest buffer is passed, we don't bother doing this: */
- if (digest != (sha2_byte*)0) {
+ if (digest != NULL) {
usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
#if BYTE_ORDER == LITTLE_ENDIAN
/* Convert FROM host byte order */
int i;
/* Sanity check: */
- assert(context != (SHA256_CTX*)0);
+ assert(context != NULL);
- if (buffer != (char*)0) {
+ if (buffer != NULL) {
SHA256_Final(digest, context);
for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
/*** SHA-512: *********************************************************/
void SHA512_Init(SHA512_CTX* context) {
- if (context == (SHA512_CTX*)0) {
+ if (context == NULL) {
return;
}
bcopy(sha512_initial_hash_value, context->state, SHA512_DIGEST_LENGTH);
}
/* Sanity check: */
- assert(context != (SHA512_CTX*)0 && data != (sha2_byte*)0);
+ assert(context != NULL && data != NULL);
usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
if (usedspace > 0) {
sha2_word64 *d = (sha2_word64*)digest;
/* Sanity check: */
- assert(context != (SHA512_CTX*)0);
+ assert(context != NULL);
/* If no digest buffer is passed, we don't bother doing this: */
- if (digest != (sha2_byte*)0) {
+ if (digest != NULL) {
SHA512_Last(context);
/* Save the hash data for output: */
int i;
/* Sanity check: */
- assert(context != (SHA512_CTX*)0);
+ assert(context != NULL);
- if (buffer != (char*)0) {
+ if (buffer != NULL) {
SHA512_Final(digest, context);
for (i = 0; i < SHA512_DIGEST_LENGTH; i++) {
/*** SHA-384: *********************************************************/
void SHA384_Init(SHA384_CTX* context) {
- if (context == (SHA384_CTX*)0) {
+ if (context == NULL) {
return;
}
bcopy(sha384_initial_hash_value, context->state, SHA512_DIGEST_LENGTH);
sha2_word64 *d = (sha2_word64*)digest;
/* Sanity check: */
- assert(context != (SHA384_CTX*)0);
+ assert(context != NULL);
/* If no digest buffer is passed, we don't bother doing this: */
- if (digest != (sha2_byte*)0) {
+ if (digest != NULL) {
SHA512_Last((SHA512_CTX*)context);
/* Save the hash data for output: */
int i;
/* Sanity check: */
- assert(context != (SHA384_CTX*)0);
+ assert(context != NULL);
- if (buffer != (char*)0) {
+ if (buffer != NULL) {
SHA384_Final(digest, context);
for (i = 0; i < SHA384_DIGEST_LENGTH; i++) {
modif[0] = '\0';
}
else if (t == tEXCL) {
- db_fncall((db_expr_t)0, (boolean_t)0, (db_expr_t)0, (char *)0);
+ db_fncall((db_expr_t)0, (boolean_t)0, (db_expr_t)0, NULL);
return;
}
else if (t != tIDENT) {
{ "threads", db_show_all_threads, 0, 0 },
#endif
{ "procs", db_ps, 0, 0 },
- { (char *)0 }
+ { NULL }
};
static struct command db_show_cmds[] = {
#if 0
{ "port", ipc_port_print, 0, 0 },
#endif
- { (char *)0, }
+ { NULL, }
};
static struct command db_command_table[] = {
{ "ps", db_ps, 0, 0 },
{ "gdb", db_gdb, 0, 0 },
{ "reset", db_reset, 0, 0 },
- { (char *)0, }
+ { NULL, }
};
static struct command *db_last_command = 0;
return;
case CTRL('c'):
- db_error((char *)0);
+ db_error(NULL);
/*NOTREACHED*/
case CTRL('s'):
do {
c = cnmaygetc();
if (c == CTRL('c'))
- db_error((char *)0);
+ db_error(NULL);
} while (c != CTRL('q'));
break;
#endif
static struct db_variable db_vars[] = {
- { "radix", &db_radix, FCN_NULL },
- { "maxoff", &db_maxoff, FCN_NULL },
- { "maxwidth", &db_max_width, FCN_NULL },
- { "tabstops", &db_tab_stop_width, FCN_NULL },
+ { "radix", &db_radix, NULL },
+ { "maxoff", &db_maxoff, NULL },
+ { "maxwidth", &db_max_width, NULL },
+ { "tabstops", &db_tab_stop_width, NULL },
};
static struct db_variable *db_evars =
db_vars + sizeof(db_vars)/sizeof(db_vars[0]);
{
db_varfcn_t *func = vp->fcn;
- if (func == FCN_NULL)
+ if (func == NULL)
*valuep = *(vp->valuep);
else
(*func)(vp, valuep, DB_VAR_GET);
{
db_varfcn_t *func = vp->fcn;
- if (func == FCN_NULL)
+ if (func == NULL)
*(vp->valuep) = *valuep;
else
(*func)(vp, valuep, DB_VAR_SET);
#define DB_VAR_GET 0
#define DB_VAR_SET 1
-#define FCN_NULL ((db_varfcn_t *)0)
-
#ifdef _KERNEL
extern struct db_variable db_regs[]; /* machine registers */
int disk, error;
error = 0;
- bp->bio_driver_info = (void *)0;
+ bp->bio_driver_info = NULL;
for (disk = 0; disk < rdp->total_disks; disk++) {
if ((dev = rdp->disks[disk].dev) != NULL)
for (card = 0; card < NSR; card++) {
hc = &sr_hardc[card];
- if (hc->sc == (void *)0)
+ if (hc->sc == NULL)
continue;
Card[cards++] = hc;
if (!(bytes_in_mbuf -= bytes)) {
MGET(tm->m_next, MB_DONTWAIT, MT_DATA);
tm = tm->m_next;
- if (tm == (struct mbuf *)0) {
+ if (tm == NULL) {
m_freem(m);
if_printf(ifp, "read(): No mbuf nth\n");
if (wlhwrst(sc) != TRUE) {
outw(PIOR0(base), tbd_p); /* address of act_count */
outw(PIOP0(base), inw(PIOP0(base)) + count);
xmtdata_p += len;
- if ((tm_p = tm_p->m_next) == (struct mbuf *)0)
+ if ((tm_p = tm_p->m_next) == NULL)
break;
if (count & 1) {
/* go to the next descriptor */
continue;
}
}
- } else if ((tm_p = tm_p->m_next) == (struct mbuf *)0)
+ } else if ((tm_p = tm_p->m_next) == NULL)
break;
count = tm_p->m_len;
mb_p = mtod(tm_p, u_char *);
count += tm_p->m_len;
if (tm_p->m_len & 1)
break;
- } while ((tm_p = tm_p->m_next) != (struct mbuf *)0);
- if ( (tm_p == (struct mbuf *)0) ||
+ } while ((tm_p = tm_p->m_next) != NULL);
+ if ( (tm_p == NULL) ||
count > HDW_THRESHOLD) {
*countp = (*tm_pp)->m_len;
*mb_pp = mtod((*tm_pp), u_char *);
if (count > HDW_THRESHOLD)
break;
cp += len;
- if (tm_p->m_next == (struct mbuf *)0)
+ if (tm_p->m_next == NULL)
break;
tm_p = tm_p->m_next;
}
bcopy(mtod(tm_p, u_char *), cp, len = tm_p->m_len);
count += len;
cp += len;
- if (tm_p->m_next == (struct mbuf *)0)
+ if (tm_p->m_next == NULL)
break;
tm_p = tm_p->m_next;
}
#define NULLDEV -1 /* identifies non-existant device */
#define NULLCTL -1 /* identifies non-existant controller */
-#define NULLCTLPTR (CONTROLLER_T *)0 /* identifies non-existant controller */
#define NULLAIOP -1 /* identifies non-existant AIOP */
#define NULLCHAN -1 /* identifies non-existant channel */
*/
#define sInitChanDefaults(ChP) \
{ \
- (ChP)->CtlP = NULLCTLPTR; \
+ (ChP)->CtlP = NULL; \
(ChP)->AiopNum = NULLAIOP; \
(ChP)->ChanID = AIOPID_NULL; \
(ChP)->ChanNum = NULLCHAN; \
static void stlpciintr(void *arg)
{
- stlintr((void *)0);
+ stlintr(NULL);
}
#endif
case SAA7116_PHILIPS_ID: /* meteor */
return("Philips SAA 7116");
};
- return ((char *)0);
+ return (NULL);
}
/* interrupt handling routine
mtr->frames_captured = 0;
mtr->even_fields_captured = 0;
mtr->odd_fields_captured = 0;
- mtr->proc = (struct proc *)0;
+ mtr->proc = NULL;
set_fps(mtr, 30);
#ifdef METEOR_TEST_VIDEO
mtr->video.addr = 0;
*/
mtr->base->cap_cntl = 0x8ff0;
mtr->flags &= ~(METEOR_CAP_MASK|METEOR_WANT_MASK);
- mtr->proc = (struct proc *)0;
+ mtr->proc = NULL;
#ifdef METEOR_DEALLOC_PAGES
if (mtr->bigbuf != NULL) {
if (mtr->signal) {
mtr->proc = curproc; /* might be NULL */
} else {
- mtr->proc = (struct proc *)0;
+ mtr->proc = NULL;
}
break;
case METEORGSIGNAL:
*/
return (vn_rdwr(UIO_WRITE, vp, (caddr_t)&acct, sizeof (acct),
(off_t)0, UIO_SYSSPACE, IO_APPEND|IO_UNIT, p->p_ucred,
- (int *)0));
+ NULL));
}
/*
if ((error = priv_check_cred(p->p_ucred, PRIV_ROOT, PRISON_ROOT)))
return (error);
error = copyinstr((caddr_t) uap->namebuf, (caddr_t) logintmp,
- sizeof(logintmp), (size_t *)0);
+ sizeof(logintmp), NULL);
if (error == ENAMETOOLONG)
error = EINVAL;
else if (!error)
count = 0;
for (;;) {
count += m->m_len;
- if (m->m_next == (struct mbuf *)0)
+ if (m->m_next == NULL)
break;
m = m->m_next;
}
top == NULL ? M_PKTHDR : 0, &mlen);
if (top == NULL) {
m->m_pkthdr.len = 0;
- m->m_pkthdr.rcvif = (struct ifnet *)0;
+ m->m_pkthdr.rcvif = NULL;
}
len = min(min(mlen, resid), space);
if (resid < MINCLSIZE) {
struct pru_attach_info ai;
if (head->so_qlen > 3 * head->so_qlimit / 2)
- return ((struct socket *)0);
+ return (NULL);
so = soalloc(1);
if (so == NULL)
return (NULL);
/* Directly call function since we're already at protocol level. */
(*so->so_proto->pr_usrreqs->pru_attach)(so, 0, &ai)) {
sodealloc(so);
- return ((struct socket *)0);
+ return (NULL);
}
if (connstatus) {
TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes) {
if (vn_islocked(vp))
- vprint((char *)0, vp);
+ vprint(NULL, vp);
}
return(0);
}
MALLOC(nfs_pub.np_index, char *, namelen, M_TEMP,
M_WAITOK);
error = copyinstr(argp->ex_indexfile, nfs_pub.np_index,
- namelen, (size_t *)0);
+ namelen, NULL);
if (!error) {
/*
* Check for illegal filenames.
*
* last edit-date: [Tue Jan 1 10:43:58 2002]
*
- *---------------------------------------------------------------------------*/
+ *---------------------------------------------------------------------------*/
#include "use_i4bing.h"
struct ifqueue sc_fastq; /* interactive traffic */
int sc_dialresp; /* dialresponse */
int sc_lastdialresp;/* last dialresponse */
-
+
#if I4BINGACCT
struct callout sc_timeout;
int sc_iinb; /* isdn driver # of inbytes */
int sc_linb; /* last # of bytes rx'd */
int sc_loutb; /* last # of bytes tx'd */
int sc_fn; /* flag, first null acct */
-#endif
+#endif
int sc_inpkt; /* incoming packets */
- int sc_outpkt; /* outgoing packets */
+ int sc_outpkt; /* outgoing packets */
struct ifqueue xmitq_hipri; /* hi-priority transmit queue */
struct ifqueue xmitq; /* transmit queue */
-
+
node_p node; /* back pointer to node */
char nodename[NG_NODESIZ]; /* store our node name */
hook_p debughook;
- hook_p hook;
+ hook_p hook;
u_int packets_in; /* packets in from downstream */
u_int packets_out; /* packets out towards downstream */
int ret;
kprintf("i4bing: %d i4b NetGraph ISDN B-channel device(s) attached\n", NI4BING);
-
+
for(i=0; i < NI4BING; sc++, i++)
{
sc->sc_unit = i;
-
+
ing_init_linktab(i);
NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
sc->sc_state = ST_IDLE;
-
+
sc->sc_fastq.ifq_maxlen = I4BINGMAXQLEN;
-
+
#if I4BINGACCT
callout_init(&sc->sc_timeout);
sc->sc_iinb = 0;
#endif
sc->sc_inpkt = 0;
- sc->sc_outpkt = 0;
+ sc->sc_outpkt = 0;
sc->sc_updown = SOFT_ENA; /* soft enabled */
sc->sc_dialresp = DSTAT_NONE; /* no response */
sc->sc_lastdialresp = DSTAT_NONE;
-
+
/* setup a netgraph node */
if ((ret = ng_make_node_common(&typestruct, &sc->node)))
sc->xmitq.ifq_maxlen = IFQ_MAXLEN;
sc->xmitq_hipri.ifq_maxlen = IFQ_MAXLEN;
-
+
/* name the netgraph node */
ksprintf(sc->nodename, "%s%d", NG_ING_NODE_TYPE, sc->sc_unit);
bchan_statistics_t bs;
int unit = sc->sc_unit;
- /* get # of bytes in and out from the HSCX driver */
-
+ /* get # of bytes in and out from the HSCX driver */
+
(*isdn_linktab[unit]->bch_stat)
(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs);
sc->sc_ioutb += bs.outbytes;
sc->sc_iinb += bs.inbytes;
-
- if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn)
+
+ if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn)
{
int ri = (sc->sc_iinb - sc->sc_linb)/I4BINGACCTINTVL;
int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BINGACCTINTVL;
sc->sc_fn = 0;
else
sc->sc_fn = 1;
-
+
sc->sc_linb = sc->sc_iinb;
sc->sc_loutb = sc->sc_ioutb;
{
int x;
struct mbuf *m;
-
+
for(;;)
{
crit_enter();
else
break;
}
-}
+}
#endif
/*===========================================================================*
NDBGL4(L4_DIALST, "ing%d: setting dial state to ST_CONNECTED", unit);
sc->sc_dialresp = DSTAT_NONE;
- sc->sc_lastdialresp = DSTAT_NONE;
-
+ sc->sc_lastdialresp = DSTAT_NONE;
+
#if I4BINGACCT
sc->sc_iinb = 0;
sc->sc_ioutb = 0;
#endif
sc->sc_state = ST_CONNECTED;
-
+
crit_exit();
}
-
+
/*---------------------------------------------------------------------------*
* this routine is called from L4 handler at disconnect time
*---------------------------------------------------------------------------*/
i4b_l4_accounting(BDRV_ING, cd->driver_unit, ACCT_FINAL,
sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb);
-
- sc->sc_cdp = (call_desc_t *)0;
+
+ sc->sc_cdp = NULL;
NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
sc->sc_dialresp = DSTAT_NONE;
- sc->sc_lastdialresp = DSTAT_NONE;
+ sc->sc_lastdialresp = DSTAT_NONE;
sc->sc_state = ST_IDLE;
}
/* ingclearqueues(sc); */
}
}
-
+
/*---------------------------------------------------------------------------*
* interface soft up/down
*---------------------------------------------------------------------------*/
struct ing_softc *sc = &ing_softc[unit];
sc->sc_updown = updown;
}
-
+
/*---------------------------------------------------------------------------*
* this routine is called from the HSCX interrupt handler
* when a new frame (mbuf) has been received and was put on
{
struct ing_softc *sc = &ing_softc[unit];
struct mbuf *m;
-
+
if((m = *isdn_linktab[unit]->rx_mbuf) == NULL)
return;
m->m_pkthdr.rcvif = NULL;
sc->sc_inpkt++;
-
+
ng_queue_data(sc->hook, m, NULL);
}
if(sc->sc_state != ST_CONNECTED)
return;
-
+
for(;;)
{
IF_DEQUEUE(&sc->xmitq_hipri, m);
if(m == NULL)
break;
}
-
+
#if I4BINGACCT
sc->sc_outb += m->m_pkthdr.len;
#endif
ing_drvr_linktab[unit].line_connected = ing_connect;
ing_drvr_linktab[unit].line_disconnected = ing_disconnect;
ing_drvr_linktab[unit].dial_response = ing_dialresponse;
- ing_drvr_linktab[unit].updown_ind = ing_updown;
+ ing_drvr_linktab[unit].updown_ind = ing_updown;
}
/*===========================================================================*
char *p;
int pos = 0;
- NG_MKRESPONSE(resp, msg,
+ NG_MKRESPONSE(resp, msg,
sizeof(struct ng_mesg) + NG_TEXTRESPONSE,
M_INTWAIT | M_NULLOK);
pos = ksprintf(arg, "state = %s (%d)\n", p, sc->sc_state);
#if I4BINGACCT
pos += ksprintf(arg + pos, "%d bytes in, %d bytes out\n", sc->sc_inb, sc->sc_outb);
-#endif
+#endif
pos += ksprintf(arg + pos, "%d pkts in, %d pkts out\n", sc->sc_inpkt, sc->sc_outpkt);
resp->header.arglen = pos + 1;
{
struct ngingstat *stats;
- NG_MKRESPONSE(resp, msg, sizeof(*stats),
+ NG_MKRESPONSE(resp, msg, sizeof(*stats),
M_INTWAIT | M_NULLOK);
if (!resp)
{
struct ing_softc *sc = hook->node->private;
struct ifqueue *xmitq_p;
-
+
if(hook->private == NULL)
{
NG_FREE_DATA(m, meta);
return(ENETDOWN);
}
-
+
if(sc->sc_state == ST_IDLE || sc->sc_state == ST_DIALING)
{
i4b_l4_dialout(BDRV_ING, sc->sc_unit);
}
sc->sc_outpkt++;
-
+
/*
* Now queue the data for when it can be sent
*/
ng_ing_disconnect(hook_p hook)
{
struct ing_softc *sc = hook->node->private;
-
+
if(hook->private == NULL) {
sc->debughook = NULL;
}
* sc->sc_inb # of incoming bytes after decompression
* sc->sc_outb # of outgoing bytes before compression
*
- *---------------------------------------------------------------------------*/
+ *---------------------------------------------------------------------------*/
#include "use_i4bipr.h"
#include <netinet/ip.h>
#ifdef IPR_VJ
-#include <net/slcompress.h>
+#include <net/slcompress.h>
#define IPR_COMPRESS IFF_LINK0 /* compress TCP traffic */
#define IPR_AUTOCOMP IFF_LINK1 /* auto-enable TCP compression */
* CAUTION: i have re-defined IPR_VJ_USEBUFFER because it makes problems
* with 2 i4b's back to back running cvs over ssh, cvs simply
* aborts because it gets bad data. Everything else (telnet/ftp?etc)
- * functions fine.
+ * functions fine.
*---------------------------------------------------------------------------*/
#define IPR_VJ_USEBUFFER /* define to use an allocated separate buffer*/
/* undef to uncompress in the mbuf itself */
struct ifqueue sc_fastq; /* interactive traffic */
int sc_dialresp; /* dialresponse */
int sc_lastdialresp;/* last dialresponse */
-
+
#if I4BIPRACCT
int sc_iinb; /* isdn driver # of inbytes */
int sc_ioutb; /* isdn driver # of outbytes */
int sc_linb; /* last # of bytes rx'd */
int sc_loutb; /* last # of bytes tx'd */
int sc_fn; /* flag, first null acct */
-#endif
+#endif
struct callout sc_timeout;
#else
kprintf("i4bipr: %d IP over raw HDLC ISDN device(s) attached\n", NI4BIPR);
#endif
-
+
for(i=0; i < NI4BIPR; sc++, i++)
{
ipr_init_linktab(i);
NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
sc->sc_state = ST_IDLE;
-
+
if_initname(&(sc->sc_if), "ipr", i);
#ifdef IPR_VJ
sc->sc_if.if_noproto = 0;
#if I4BIPRACCT
- sc->sc_if.if_timer = 0;
- sc->sc_if.if_watchdog = iprwatchdog;
+ sc->sc_if.if_timer = 0;
+ sc->sc_if.if_watchdog = iprwatchdog;
sc->sc_iinb = 0;
sc->sc_ioutb = 0;
sc->sc_inb = 0;
sc->sc_updown = SOFT_ENA; /* soft enabled */
sc->sc_dialresp = DSTAT_NONE; /* no response */
sc->sc_lastdialresp = DSTAT_NONE;
-
+
if_attach(&sc->sc_if, NULL);
bpfattach(&sc->sc_if, DLT_NULL, sizeof(u_int));
}
struct ipr_softc *sc;
int unit;
struct ip *ip;
-
+
crit_enter();
sc = ifp->if_softc;
unit = sc->sc_unit;
/* check for IP */
-
+
if(dst->sa_family != AF_INET)
{
kprintf(IPR_FMT "af%d not supported\n", IPR_ARG(sc), dst->sa_family);
}
/* check interface state = UP */
-
+
if(!(ifp->if_flags & IFF_UP))
{
NDBGL4(L4_IPRDBG, "ipr%d: interface is DOWN!", unit);
}
/* dial if necessary */
-
+
if(sc->sc_state == ST_IDLE || sc->sc_state == ST_DIALING)
{
sc->sc_dialresp = DSTAT_NONE;
crit_exit();
sc->sc_if.if_oerrors++;
- return(EHOSTUNREACH);
+ return(EHOSTUNREACH);
break;
case DSTAT_INONLY: /* no dialout allowed*/
sc->sc_dialresp = DSTAT_NONE;
crit_exit();
sc->sc_if.if_oerrors++;
- return(EHOSTUNREACH);
+ return(EHOSTUNREACH);
break;
}
#endif
#endif
/* update access time */
-
+
microtime(&sc->sc_if.if_lastchange);
/*
*/
ip = mtod(m, struct ip *); /* get ptr to ip header */
-
+
/* check for space in choosen send queue */
-
+
if (netisr_queue(NETISR_IP, m))
{
NDBGL4(L4_IPRDBG, "ipr%d: send queue full!", unit);
sc->sc_if.if_oerrors++;
return(ENOBUFS);
}
-
+
NDBGL4(L4_IPRDBG, "ipr%d: add packet to send queue!", unit);
-
+
ipr_tx_queue_empty(unit);
crit_exit();
int error = 0;
crit_enter();
-
+
switch (cmd)
{
case SIOCAIFADDR: /* add interface address */
{
/* enable debug messages */
}
-
+
microtime(&sc->sc_if.if_lastchange);
break;
#if 0
/* not needed for FreeBSD, done in sl_compress_init() (-hm) */
-
+
/* need to add an ioctl: set VJ max slot ID
* #define IPRIOCSMAXCID _IOW('I', XXX, int)
*/
break;
}
}
-
+
#if I4BIPRACCT
/*---------------------------------------------------------------------------*
* watchdog routine
struct ipr_softc *sc = ifp->if_softc;
int unit = sc->sc_unit;
bchan_statistics_t bs;
-
- /* get # of bytes in and out from the HSCX driver */
-
+
+ /* get # of bytes in and out from the HSCX driver */
+
(*isdn_linktab[unit]->bch_stat)
(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs);
sc->sc_ioutb += bs.outbytes;
sc->sc_iinb += bs.inbytes;
-
- if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn)
+
+ if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn)
{
int ri = (sc->sc_iinb - sc->sc_linb)/I4BIPRACCTINTVL;
int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BIPRACCTINTVL;
sc->sc_fn = 0;
else
sc->sc_fn = 1;
-
+
sc->sc_linb = sc->sc_iinb;
sc->sc_loutb = sc->sc_ioutb;
i4b_l4_accounting(BDRV_IPR, unit, ACCT_DURING,
sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb);
}
- sc->sc_if.if_timer = I4BIPRACCTINTVL;
+ sc->sc_if.if_timer = I4BIPRACCTINTVL;
}
#endif /* I4BIPRACCT */
i4bipr_connect_startio(struct ipr_softc *sc)
{
crit_enter();
-
+
if(sc->sc_state == ST_CONNECTED_W)
{
sc->sc_state = ST_CONNECTED_A;
crit_exit();
}
-
+
/*---------------------------------------------------------------------------*
* this routine is called from L4 handler at connect time
*---------------------------------------------------------------------------*/
sc->sc_state = ST_CONNECTED_W;
sc->sc_dialresp = DSTAT_NONE;
- sc->sc_lastdialresp = DSTAT_NONE;
-
+ sc->sc_lastdialresp = DSTAT_NONE;
+
#if I4BIPRACCT
sc->sc_iinb = 0;
sc->sc_ioutb = 0;
/* we don't need any negotiation - pass event back right now */
i4b_l4_negcomplete(sc->sc_cdp);
}
-
+
/*---------------------------------------------------------------------------*
* this routine is called from L4 handler at disconnect time
*---------------------------------------------------------------------------*/
i4b_l4_accounting(BDRV_IPR, cd->driver_unit, ACCT_FINAL,
sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb);
-
- sc->sc_cdp = (call_desc_t *)0;
+
+ sc->sc_cdp = NULL;
NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
sc->sc_dialresp = DSTAT_NONE;
- sc->sc_lastdialresp = DSTAT_NONE;
+ sc->sc_lastdialresp = DSTAT_NONE;
sc->sc_if.if_flags &= ~IFF_RUNNING;
sc->sc_state = ST_IDLE;
iprclearqueues(sc);
}
}
-
+
/*---------------------------------------------------------------------------*
* interface soft up/down
*---------------------------------------------------------------------------*/
struct ipr_softc *sc = &ipr_softc[unit];
sc->sc_updown = updown;
}
-
+
/*---------------------------------------------------------------------------*
* this routine is called from the HSCX interrupt handler
* when a new frame (mbuf) has been received and was put on
#ifdef IPR_VJ
#ifdef IPR_VJ_USEBUFFER
u_char *cp = sc->sc_cbuf;
-#endif
+#endif
int len, c;
#endif
static const uint32_t af = AF_INET;
-
+
if((m = *isdn_linktab[unit]->rx_mbuf) == NULL)
return;
{
unsigned char *mp = m->m_data;
int i;
-
+
sc->sc_first_pkt = 0;
for(i = 0; i < m->m_len; i++, mp++)
((*mp & 0x0f) >= 0x05) )
{
m->m_data = mp;
- m->m_pkthdr.len -= i;
+ m->m_pkthdr.len -= i;
break;
}
}
}
#endif
-
+
sc->sc_if.if_ipackets++;
sc->sc_if.if_ibytes += m->m_pkthdr.len;
#ifdef IPR_VJ_USEBUFFER
/* XXX */ m_copydata(m, 0, len, cp);
#endif
-
+
if(c & 0x80)
{
c = TYPE_COMPRESSED_TCP;
#ifdef IPR_VJ_USEBUFFER
*cp &= 0x4f; /* XXX */
#else
- *(mtod(m, u_char *)) &= 0x4f;
-#endif
+ *(mtod(m, u_char *)) &= 0x4f;
+#endif
}
/*
#else
len = sl_uncompress_tcp((u_char **)&m->m_data, len,
(u_int)c, &sc->sc_compr);
-#endif
+#endif
if(len <= 0)
{
if (netisr_queue(NETISR_IP, m)) {
NDBGL4(L4_IPRDBG, "ipr%d: ipintrq full!", unit);
sc->sc_if.if_ierrors++;
- sc->sc_if.if_iqdrops++;
+ sc->sc_if.if_iqdrops++;
}
}
static const uint32_t af = AF_INET;
struct ipr_softc *sc = &ipr_softc[unit];
struct mbuf *m;
-#ifdef IPR_VJ
- struct ip *ip;
+#ifdef IPR_VJ
+ struct ip *ip;
#endif
int x = 0;
if(sc->sc_state != ST_CONNECTED_A)
return;
-
+
for(;;)
{
IF_DEQUEUE(&sc->sc_fastq, m);
if (sc->sc_if.if_bpf)
bpf_ptap(sc->sc_if.if_bpf, m, &af, sizeof(af));
-
+
#if I4BIPRACCT
sc->sc_outb += m->m_pkthdr.len; /* size before compression */
#endif
-#ifdef IPR_VJ
+#ifdef IPR_VJ
if((ip = mtod(m, struct ip *))->ip_p == IPPROTO_TCP)
{
if(sc->sc_if.if_flags & IPR_COMPRESS)
ipr_drvr_linktab[unit].line_connected = ipr_connect;
ipr_drvr_linktab[unit].line_disconnected = ipr_disconnect;
ipr_drvr_linktab[unit].dial_response = ipr_dialresponse;
- ipr_drvr_linktab[unit].updown_ind = ipr_updown;
+ ipr_drvr_linktab[unit].updown_ind = ipr_updown;
}
/*===========================================================================*/
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
#include <net/sppp/if_sppp.h>
-#include "use_bpf.h"
+#include "use_bpf.h"
#include <sys/time.h>
#include <net/bpf.h>
#define ISPPP_FMT "%s: "
#define ISPPP_ARG(sc) ((sc)->sc_if.if_xname)
#define IFP2UNIT(ifp) ((struct i4bisppp_softc *)ifp->if_softc)->sc_unit
-
+
# define IOCTL_CMD_T u_long
PDEVSTATIC void i4bispppattach(void *);
#define I4BISPPPACCT 1 /* enable accounting messages */
#define I4BISPPPACCTINTVL 2 /* accounting msg interval in secs */
-#define I4BISPPPDISCDEBUG 1
+#define I4BISPPPDISCDEBUG 1
#define PPP_HDRLEN 4 /* 4 octetts PPP header length */
for(i = 0; i < NI4BISPPP; sc++, i++) {
i4bisppp_init_linktab(i);
-
+
sc->sc_if.if_softc = sc;
if_initname(&(sc->sc_if), "isp", i);
sc->sc_if.if_noproto = 0;
#if I4BISPPPACCT
- sc->sc_if.if_timer = 0;
- sc->sc_if.if_watchdog = i4bisppp_watchdog;
+ sc->sc_if.if_timer = 0;
+ sc->sc_if.if_watchdog = i4bisppp_watchdog;
sc->sc_iinb = 0;
sc->sc_ioutb = 0;
sc->sc_inb = 0;
struct i4bisppp_softc *sc = ifp->if_softc;
int unit = IFP2UNIT(ifp);
bchan_statistics_t bs;
-
+
(*isdn_linktab[unit]->bch_stat)
(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs);
sc->sc_ioutb += bs.outbytes;
sc->sc_iinb += bs.inbytes;
-
+
if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn)
{
int ri = (sc->sc_iinb - sc->sc_linb)/I4BISPPPACCTINTVL;
sc->sc_fn = 0;
else
sc->sc_fn = 1;
-
+
sc->sc_linb = sc->sc_iinb;
sc->sc_loutb = sc->sc_ioutb;
i4b_l4_accounting(BDRV_ISPPP, unit, ACCT_DURING,
sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb);
}
- sc->sc_if.if_timer = I4BISPPPACCTINTVL;
+ sc->sc_if.if_timer = I4BISPPPACCTINTVL;
#if 0 /* old stuff, keep it around */
kprintf(ISPPP_FMT "transmit timeout\n", ISPPP_ARG(sc));
{
struct i4bisppp_softc *sc = (struct i4bisppp_softc *)sp;
/* call_desc_t *cd = sc->sc_cdp; */
- struct ifnet *ifp = (struct ifnet *)sp;
-
+ struct ifnet *ifp = (struct ifnet *)sp;
+
if(sc->sc_state != ST_CONNECTED)
return;
i4bisppp_state_changed(struct sppp *sp, int new_state)
{
struct i4bisppp_softc *sc = (struct i4bisppp_softc *)sp;
-
+
i4b_l4_ifstate_changed(sc->sc_cdp, new_state);
}
i4bisppp_negotiation_complete(struct sppp *sp)
{
struct i4bisppp_softc *sc = (struct i4bisppp_softc *)sp;
-
+
i4b_l4_negcomplete(sc->sc_cdp);
}
sc->sc_loutb = 0;
sc->sc_if.if_timer = I4BISPPPACCTINTVL;
#endif
-
+
#if 0 /* never used ??? */
callout_stop(&sc->sc_timeout);
#endif
i4b_l4_accounting(BDRV_ISPPP, unit, ACCT_FINAL,
sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_outb, sc->sc_inb);
-
+
if (sc->sc_state == ST_CONNECTED)
{
#if 0 /* never used ??? */
callout_stop(&sc->sc_timeout);
#endif
- sc->sc_cdp = (call_desc_t *)0;
+ sc->sc_cdp = NULL;
/* do this here because pp_down calls i4bisppp_tlf */
sc->sc_state = ST_IDLE;
sp->pp_down(sp); /* tell PPP we have hung up */
if(status != DSTAT_NONE)
{
struct mbuf *m;
-
+
NDBGL4(L4_ISPDBG, "isp%d: clearing queues", unit);
if(!(sppp_isempty(&sc->sc_if)))
m_freem(m);
}
- sc->sc_cdp = (call_desc_t *)0;
+ sc->sc_cdp = NULL;
/* do this here because pp_down calls i4bisppp_tlf */
sc->sc_state = ST_IDLE;
/*
sp->pp_down(sp);
}
}
-
+
/*---------------------------------------------------------------------------*
* interface up/down
*---------------------------------------------------------------------------*/
{
/* could probably do something useful here */
}
-
+
/*---------------------------------------------------------------------------*
* this routine is called from the HSCX interrupt handler
* when a new frame (mbuf) has been received and was put on
{
struct i4bisppp_softc *sc = &i4bisppp_softc[unit];
struct mbuf *m;
-
+
if((m = *isdn_linktab[unit]->rx_mbuf) == NULL)
return;
#if I4BISPPPACCT
sc->sc_inb += m->m_pkthdr.len;
#endif
-
+
#ifdef I4BISPPPDEBUG
kprintf("i4bisppp_rx_data_ready: received packet!\n");
#endif
static void
i4bisppp_tx_queue_empty(int unit)
{
- i4bisppp_start(&i4bisppp_softc[unit].sc_if);
+ i4bisppp_start(&i4bisppp_softc[unit].sc_if);
}
/*---------------------------------------------------------------------------*
i4bisppp_drvr_linktab[unit].bch_activity = i4bisppp_activity;
i4bisppp_drvr_linktab[unit].line_connected = i4bisppp_connect;
i4bisppp_drvr_linktab[unit].line_disconnected = i4bisppp_disconnect;
- i4bisppp_drvr_linktab[unit].dial_response = i4bisppp_dialresponse;
- i4bisppp_drvr_linktab[unit].updown_ind = i4bisppp_updown;
+ i4bisppp_drvr_linktab[unit].dial_response = i4bisppp_dialresponse;
+ i4bisppp_drvr_linktab[unit].updown_ind = i4bisppp_updown;
}
/*===========================================================================*/
if(status == STI_ATTACH)
{
- if (l1mux_func_p == (struct i4b_l1mux_func *)0)
+ if (l1mux_func_p == NULL)
panic("i4b_l1_mph_status_ind: i4b_l1mux_func pointer is NULL\n");
if(numl1units < MAXL1UNITS)
#define if_lastchange if_data.ifi_lastchange
#define if_recvquota if_data.ifi_recvquota
#define if_xmitquota if_data.ifi_xmitquota
-#define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)0)
+#define if_rawoutput(if, m, sa) if_output(if, m, sa, NULL)
/* for compatibility with other BSDs */
#define if_list if_link
m0->m_len -= PPP_HDRLEN;
/* call the upper layer to "transmit" it... */
- error = pppoutput(&sc->sc_if, m0, &dst, (struct rtentry *)0);
+ error = pppoutput(&sc->sc_if, m0, &dst, NULL);
crit_exit();
return (error);
}
n = m_copypacket(m, MB_DONTWAIT);
if (n != NULL) {
if (ssb_appendaddr(&last->so_rcv, src, n,
- (struct mbuf *)0) == 0) {
+ NULL) == 0) {
/* should notify about lost packet */
m_freem(n);
} else {
last = rp->rcb_socket;
}
if (last) {
- if (ssb_appendaddr(&last->so_rcv, src, m, (struct mbuf *)0) == 0)
+ if (ssb_appendaddr(&last->so_rcv, src, m, NULL) == 0)
m_freem(m);
else
sorwakeup(last);
but not a zero length. */
_tr_stored_type_only(s);
} else { /* FULL_FLUSH or SYNC_FLUSH */
- _tr_stored_block(s, (char*)0, 0L, 0);
+ _tr_stored_block(s, NULL, 0L, 0);
/* For a full flush, this empty block will be recognized
* as a special marker by inflate_sync().
*/
{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
local static_tree_desc static_bl_desc =
-{(ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
+{NULL, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
/* ===========================================================================
* Local (static) routines in this file.
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
} else {
- Assert(buf != (char*)0, "lost buf");
+ Assert(buf != NULL, "lost buf");
opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
}
if (stored_len <= opt_lenb && eof && s->compressed_len==0L && seekable()) {
# endif
/* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
- if (buf == (charf*)0) error ("block vanished");
+ if (buf == NULL) error ("block vanished");
copy_block(s, buf, (unsigned)stored_len, 0); /* without header */
s->compressed_len = stored_len << 3;
#endif /* STORED_FILE_OK */
#ifdef FORCE_STORED
- if (buf != (char*)0) { /* force stored block */
+ if (buf != NULL) { /* force stored block */
#else
- if (stored_len+4 <= opt_lenb && buf != (char*)0) {
+ if (stored_len+4 <= opt_lenb && buf != NULL) {
/* 4: two words for the lengths */
#endif
/* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
/* Try to get next packet from socket */
if ((error = soreceive(so, (so->so_state & SS_ISCONNECTED) ?
- NULL : &sa, &auio, &m, (struct mbuf **)0, &flags)) != 0)
+ NULL : &sa, &auio, &m, NULL, &flags)) != 0)
break;
/* See if we got anything */
icmpsrc.sin_addr = icp->icmp_ip.ip_dst;
rtredirect((struct sockaddr *)&icmpsrc,
(struct sockaddr *)&icmpdst,
- (struct sockaddr *)0, RTF_GATEWAY | RTF_HOST,
+ NULL, RTF_GATEWAY | RTF_HOST,
(struct sockaddr *)&icmpgw);
kpfctlinput(PRC_REDIRECT_HOST, (struct sockaddr *)&icmpsrc);
#ifdef IPSEC
icp->icmp_cksum = in_cksum(m, ip->ip_len - hlen);
m->m_data -= hlen;
m->m_len += hlen;
- m->m_pkthdr.rcvif = (struct ifnet *)0;
+ m->m_pkthdr.rcvif = NULL;
#ifdef ICMPPRINTFS
if (icmpprintfs) {
char buf[sizeof "aaa.bbb.ccc.ddd"];
m->m_data += max_linkhdr;
m->m_len = hdrlen;
}
- m->m_pkthdr.rcvif = (struct ifnet *)0;
+ m->m_pkthdr.rcvif = NULL;
if (isipv6) {
ip6 = mtod(m, struct ip6_hdr *);
th = (struct tcphdr *)(ip6 + 1);
inp->inp_vflag |= INP_IPV4;
else
inp->inp_vflag &= ~INP_IPV4;
- error = in6_pcbbind(inp, (struct sockaddr *)0, td);
+ error = in6_pcbbind(inp, NULL, td);
}
if (error == 0)
tp->t_state = TCPS_LISTEN;
int error;
if (inp->inp_lport == 0) {
- error = in6_pcbbind(inp, (struct sockaddr *)0, td);
+ error = in6_pcbbind(inp, NULL, td);
if (error)
return error;
}
(struct sockaddr *)&ia->ia_addr,
(struct sockaddr *)&ia->ia_addr,
(struct sockaddr *)&ia->ia_prefixmask,
- rtflags, (struct rtentry **)0);
+ rtflags, NULL);
}
/* remove from the linked list */
}
if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) {
if (inp->inp_lport == 0) {
- error = in6_pcbbind(inp, (struct sockaddr *)0, td);
+ error = in6_pcbbind(inp, NULL, td);
if (error)
return (error);
}
if (s) {
if (ssb_appendaddr(&s->so_rcv,
(struct sockaddr *)src,
- mm, (struct mbuf *)0) != 0) {
+ mm, NULL) != 0) {
sorwakeup(s);
return 0;
}
}
m_cat(m, m_frgpart);
m->m_pkthdr.len = len + hlen + sizeof(*ip6f);
- m->m_pkthdr.rcvif = (struct ifnet *)0;
+ m->m_pkthdr.rcvif = NULL;
ip6f->ip6f_reserved = 0;
ip6f->ip6f_ident = id;
ip6f->ip6f_nxt = nextproto;
* caches, and disable the route entry not to be used in already
* cached routes.
*/
- rtrequest(RTM_DELETE, rt_key(rt), (struct sockaddr *)0,
- rt_mask(rt), 0, (struct rtentry **)0);
+ rtrequest(RTM_DELETE, rt_key(rt), NULL, rt_mask(rt), 0, NULL);
return (next);
}
&& ( satosat(&forwro.ro_dst)->sat_addr.s_net != to.sat_addr.s_net
|| satosat(&forwro.ro_dst)->sat_addr.s_node != to.sat_addr.s_node )) {
RTFREE( forwro.ro_rt );
- forwro.ro_rt = (struct rtentry *)0;
+ forwro.ro_rt = NULL;
}
/*
* Then get a new route.
* XXX this could cause a 'route leak'. check this!
*/
- if ( forwro.ro_rt == (struct rtentry *)0
- || forwro.ro_rt->rt_ifp == (struct ifnet *)0 ) {
+ if ( forwro.ro_rt == NULL
+ || forwro.ro_rt->rt_ifp == NULL ) {
forwro.ro_dst.sa_len = sizeof( struct sockaddr_at );
forwro.ro_dst.sa_family = AF_APPLETALK;
satosat(&forwro.ro_dst)->sat_addr.s_net = to.sat_addr.s_net;
* If we found one, deliver th epacket to the socket
*/
if (ssb_appendaddr( &ddp->ddp_socket->so_rcv, (struct sockaddr *)&from,
- m, (struct mbuf *)0 ) == 0 ) {
+ m, NULL ) == 0 ) {
/*
* If the socket is full (or similar error) dump the packet.
*/
satosat( &ro->ro_dst )->sat_addr.s_node !=
sat->sat_addr.s_node )) {
RTFREE( ro->ro_rt );
- ro->ro_rt = (struct rtentry *)0;
+ ro->ro_rt = NULL;
}
}
/*
* If we've got no route for this interface, try to find one.
*/
- if ( ro->ro_rt == (struct rtentry *)0 ||
- ro->ro_rt->rt_ifp == (struct ifnet *)0 ) {
+ if ( ro->ro_rt == NULL ||
+ ro->ro_rt->rt_ifp == NULL ) {
ro->ro_dst.sa_len = sizeof( struct sockaddr_at );
ro->ro_dst.sa_family = AF_APPLETALK;
if ( hintnet ) {
ddp->ddp_fsat = *sat;
if ( ddp->ddp_lsat.sat_port == ATADDR_ANYPORT ) {
- return(at_pcbsetaddr(ddp, (struct sockaddr *)0, td));
+ return(at_pcbsetaddr(ddp, NULL, td));
}
return( 0 );
}
* Break down name
*/
if (atm_ifparse(name, n, sizeof(n), &unit))
- return ((struct atm_pif *)0);
+ return (NULL);
/*
* Look for the physical interface
* Break down name
*/
if (atm_ifparse(name, n, sizeof(n), &unit))
- return ((struct atm_nif *)0);
+ return (NULL);
/*
* Search thru each physical interface
*/
DEQUEUE(svp, struct spans_vccb, sv_sigelem,
spp->sp_vccq);
- cvp->cvc_vcc = (struct vccb *)0;
+ cvp->cvc_vcc = NULL;
atm_free((caddr_t)svp);
return(err);
} else {
* Pass the detach event to the signalling manager
* state machine
*/
- err = unisig_sigmgr_state(usp, UNISIG_SIGMGR_DETACH,
- (KBuffer *)0);
+ err = unisig_sigmgr_state(usp, UNISIG_SIGMGR_DETACH, NULL);
/*
* Log the fact that we've detached
/*
* Try to establish an SSCF session.
*/
- err = atm_cm_saal_ctl(SSCF_UNI_ESTABLISH_REQ,
- usp->us_conn,
- (void *)0);
+ err = atm_cm_saal_ctl(SSCF_UNI_ESTABLISH_REQ, usp->us_conn, NULL);
if (err)
panic("unisig_sigmgr_act04: SSCF_UNI_ESTABLISH_REQ");
/*
* Establish the SSCF session
*/
- err = atm_cm_saal_ctl(SSCF_UNI_ESTABLISH_REQ,
- usp->us_conn,
- (void *)0);
+ err = atm_cm_saal_ctl(SSCF_UNI_ESTABLISH_REQ, usp->us_conn, NULL);
if (err)
panic("unisig_sigmgr_act13: SSCF_UNI_ESTABLISH_REQ");
/*
* Locate the signalling channel's VCCB
*/
- sig_vccb = (struct unisig_vccb *)0;
+ sig_vccb = NULL;
if (usp->us_conn && usp->us_conn->co_connvc)
sig_vccb = (struct unisig_vccb *)
usp->us_conn->co_connvc->cvc_vcc;
/*
* Resend the RELEASE message
*/
- rc = unisig_send_release(usp, uvp,
- (struct unisig_msg *)0, T_ATM_ABSENT);
+ rc = unisig_send_release(usp, uvp, NULL, T_ATM_ABSENT);
if (rc)
return(rc);
conn->flags &= ~(NCPFL_SOCONN | NCPFL_ATTACHED | NCPFL_LOGGED);
if (conn->ncp_so) {
so = conn->ncp_so;
- conn->ncp_so = (struct socket *)0;
+ conn->ncp_so = NULL;
soshutdown(so, SHUT_RDWR);
soclose(so, FNONBLOCK);
}
if (conn->wdg_so) {
so = conn->wdg_so;
- conn->wdg_so = (struct socket *)0;
+ conn->wdg_so = NULL;
soshutdown(so, SHUT_RDWR);
soclose(so, FNONBLOCK);
}
m->m_data += sizeof (struct idp);
}
if (ssb_appendaddr(&nsp->nsp_socket->so_rcv, (struct sockaddr *)&idp_ns,
- m, (struct mbuf *)0) == 0)
+ m, NULL) == 0)
goto bad;
sorwakeup(nsp->nsp_socket);
return;
* Output datagram.
*/
if (so->so_options & SO_DONTROUTE)
- return (ns_output(m, (struct route *)0,
+ return (ns_output(m, NULL,
(so->so_options & SO_BROADCAST) | NS_ROUTETOIF));
/*
* Use cached route for previous datagram if
} else {
re_route:
RTFREE(ro->ro_rt);
- ro->ro_rt = (struct rtentry *)0;
+ ro->ro_rt = NULL;
}
}
nsp->nsp_lastdst = idp->idp_dna;
switch (cmd) {
case SIOCGIFADDR:
- if (ia == (struct ns_ifaddr *)0)
+ if (ia == NULL)
return (EADDRNOTAVAIL);
*(struct sockaddr_ns *)&ifr->ifr_addr = ia->ia_addr;
return (0);
case SIOCGIFBRDADDR:
- if (ia == (struct ns_ifaddr *)0)
+ if (ia == NULL)
return (EADDRNOTAVAIL);
if ((ifp->if_flags & IFF_BROADCAST) == 0)
return (EINVAL);
return (0);
case SIOCGIFDSTADDR:
- if (ia == (struct ns_ifaddr *)0)
+ if (ia == NULL)
return (EADDRNOTAVAIL);
if ((ifp->if_flags & IFF_POINTOPOINT) == 0)
return (EINVAL);
case SIOCSIFADDR:
case SIOCSIFDSTADDR:
- if (ia == (struct ns_ifaddr *)0) {
+ if (ia == NULL) {
oia = ifa_create(sizeof(*ia), M_WAITOK);
if ((ia = ns_ifaddr) != NULL) {
for ( ; ia->ia_next; ia = ia->ia_next)
nip->idp_sum = ns_cksum(m, sizeof(*ep));
} else
nip->idp_sum = 0xffff;
- ns_output(m, (struct route *)0, 0);
+ ns_output(m, NULL, 0);
freeit:
m_freem(om);
idp->idp_sum = ns_cksum(m,
(int)(((ntohs(idp->idp_len) - 1)|1)+1));
}
- ns_output(m, (struct route *)0, NS_FORWARDING);
+ ns_output(m, NULL, NS_FORWARDING);
return(0);
}
/*
* Output final datagram.
*/
- error = (ip_output(m, (struct mbuf *)0, ro, SO_BROADCAST, NULL));
+ error = (ip_output(m, NULL, ro, SO_BROADCAST, NULL));
if (error) {
ifn->ifen_ifnet.if_oerrors++;
ifn->ifen_ifnet.if_ierrors = error;
*/
ifr.ifr_name[4] = '0' + nsipif_units - 1;
ifr.ifr_dstaddr = * (struct sockaddr *) ns_dst;
- ns_control((struct socket *)0, (int)SIOCSIFDSTADDR, (caddr_t)&ifr,
+ ns_control(NULL, (int)SIOCSIFDSTADDR, (caddr_t)&ifr,
(struct ifnet *)ifn, NULL);
satons_addr(ifr.ifr_addr).x_host = ns_thishost;
- return (ns_control((struct socket *)0, (int)SIOCSIFADDR, (caddr_t)&ifr,
+ return (ns_control(NULL, (int)SIOCSIFADDR, (caddr_t)&ifr,
(struct ifnet *)ifn, NULL));
}
flush:
if (ro->ro_rt)
RTFREE(ro->ro_rt);
- ro->ro_rt = (struct rtentry *)0;
+ ro->ro_rt = NULL;
nsp->nsp_laddr.x_net = ns_zeronet;
}
}/* else cached route is ok; do nothing */
nsp->nsp_lastdst = sns->sns_addr;
if ((nsp->nsp_socket->so_options & SO_DONTROUTE) == 0 && /*XXX*/
- (ro->ro_rt == (struct rtentry *)0 ||
- ro->ro_rt->rt_ifp == (struct ifnet *)0)) {
+ (ro->ro_rt == NULL ||
+ ro->ro_rt->rt_ifp == NULL)) {
/* No route yet, so try to acquire one */
ro->ro_dst.sa_family = AF_NS;
ro->ro_dst.sa_len = sizeof(ro->ro_dst);
* our src addr is taken from the i/f, else punt.
*/
- ia = (struct ns_ifaddr *)0;
+ ia = NULL;
/*
* If we found a route, use the address
* corresponding to the outgoing interface
m_freem(m);
}
if (cb->s_force || (cb->s_flags & (SF_ACKNOW|SF_WIN|SF_RXT)))
- spp_output(cb, (struct mbuf *)0);
+ spp_output(cb, NULL);
cb->s_flags &= ~(SF_WIN|SF_RXT);
return;
cb->s_snxt = si->si_ack;
cb->s_cwnd = CUNIT;
cb->s_force = 1 + SPPT_REXMT;
- spp_output(cb, (struct mbuf *)0);
+ spp_output(cb, NULL);
cb->s_timer[SPPT_REXMT] = cb->s_rxtcur;
cb->s_rtt = 0;
if (cwnd >= 4 * CUNIT)
spp_trace(SA_OUTPUT, cb->s_state, cb, si, 0);
if (so->so_options & SO_DONTROUTE)
- error = ns_output(m, (struct route *)0, NS_ROUTETOIF);
+ error = ns_output(m, NULL, NS_ROUTETOIF);
else
error = ns_output(m, &cb->s_nspcb->nsp_route, 0);
}
soisdisconnected(so);
ns_pcbdetach(nsp);
sppstat.spps_closed++;
- return ((struct sppcb *)0);
+ return (NULL);
}
/*
* Someday we may do level 3 handshaking
* Machine register set.
*/
struct db_variable db_regs[] = {
- { "cs", &ddb_regs.tf_cs, FCN_NULL },
- { "ds", &ddb_regs.tf_ds, FCN_NULL },
- { "es", &ddb_regs.tf_es, FCN_NULL },
- { "fs", &ddb_regs.tf_fs, FCN_NULL },
- { "gs", &ddb_regs.tf_gs, FCN_NULL },
- { "ss", &ddb_regs.tf_ss, FCN_NULL },
- { "eax", &ddb_regs.tf_eax, FCN_NULL },
- { "ecx", &ddb_regs.tf_ecx, FCN_NULL },
- { "edx", &ddb_regs.tf_edx, FCN_NULL },
- { "ebx", &ddb_regs.tf_ebx, FCN_NULL },
- { "esp", &ddb_regs.tf_esp, FCN_NULL },
- { "ebp", &ddb_regs.tf_ebp, FCN_NULL },
- { "esi", &ddb_regs.tf_esi, FCN_NULL },
- { "edi", &ddb_regs.tf_edi, FCN_NULL },
- { "eip", &ddb_regs.tf_eip, FCN_NULL },
- { "efl", &ddb_regs.tf_eflags, FCN_NULL },
+ { "cs", &ddb_regs.tf_cs, NULL },
+ { "ds", &ddb_regs.tf_ds, NULL },
+ { "es", &ddb_regs.tf_es, NULL },
+ { "fs", &ddb_regs.tf_fs, NULL },
+ { "gs", &ddb_regs.tf_gs, NULL },
+ { "ss", &ddb_regs.tf_ss, NULL },
+ { "eax", &ddb_regs.tf_eax, NULL },
+ { "ecx", &ddb_regs.tf_ecx, NULL },
+ { "edx", &ddb_regs.tf_edx, NULL },
+ { "ebx", &ddb_regs.tf_ebx, NULL },
+ { "esp", &ddb_regs.tf_esp, NULL },
+ { "ebp", &ddb_regs.tf_ebp, NULL },
+ { "esi", &ddb_regs.tf_esi, NULL },
+ { "edi", &ddb_regs.tf_edi, NULL },
+ { "eip", &ddb_regs.tf_eip, NULL },
+ { "efl", &ddb_regs.tf_eflags, NULL },
{ "dr0", NULL, db_dr0 },
{ "dr1", NULL, db_dr1 },
{ "dr2", NULL, db_dr2 },
* Machine register set.
*/
struct db_variable db_regs[] = {
- { "cs", &ddb_regs.tf_cs, FCN_NULL },
-/* { "ds", &ddb_regs.tf_ds, FCN_NULL },
- { "es", &ddb_regs.tf_es, FCN_NULL },
- { "fs", &ddb_regs.tf_fs, FCN_NULL },
- { "gs", &ddb_regs.tf_gs, FCN_NULL }, */
- { "ss", &ddb_regs.tf_ss, FCN_NULL },
- { "rax", &ddb_regs.tf_rax, FCN_NULL },
- { "rcx", &ddb_regs.tf_rcx, FCN_NULL },
- { "rdx", &ddb_regs.tf_rdx, FCN_NULL },
- { "rbx", &ddb_regs.tf_rbx, FCN_NULL },
- { "rsp", &ddb_regs.tf_rsp, FCN_NULL },
- { "rbp", &ddb_regs.tf_rbp, FCN_NULL },
- { "rsi", &ddb_regs.tf_rsi, FCN_NULL },
- { "rdi", &ddb_regs.tf_rdi, FCN_NULL },
- { "rip", &ddb_regs.tf_rip, FCN_NULL },
- { "rfl", &ddb_regs.tf_rflags, FCN_NULL },
- { "r8", &ddb_regs.tf_r8, FCN_NULL },
- { "r9", &ddb_regs.tf_r9, FCN_NULL },
- { "r10", &ddb_regs.tf_r10, FCN_NULL },
- { "r11", &ddb_regs.tf_r11, FCN_NULL },
- { "r12", &ddb_regs.tf_r12, FCN_NULL },
- { "r13", &ddb_regs.tf_r13, FCN_NULL },
- { "r14", &ddb_regs.tf_r14, FCN_NULL },
- { "r15", &ddb_regs.tf_r15, FCN_NULL },
+ { "cs", &ddb_regs.tf_cs, NULL },
+/* { "ds", &ddb_regs.tf_ds, NULL },
+ { "es", &ddb_regs.tf_es, NULL },
+ { "fs", &ddb_regs.tf_fs, NULL },
+ { "gs", &ddb_regs.tf_gs, NULL }, */
+ { "ss", &ddb_regs.tf_ss, NULL },
+ { "rax", &ddb_regs.tf_rax, NULL },
+ { "rcx", &ddb_regs.tf_rcx, NULL },
+ { "rdx", &ddb_regs.tf_rdx, NULL },
+ { "rbx", &ddb_regs.tf_rbx, NULL },
+ { "rsp", &ddb_regs.tf_rsp, NULL },
+ { "rbp", &ddb_regs.tf_rbp, NULL },
+ { "rsi", &ddb_regs.tf_rsi, NULL },
+ { "rdi", &ddb_regs.tf_rdi, NULL },
+ { "rip", &ddb_regs.tf_rip, NULL },
+ { "rfl", &ddb_regs.tf_rflags, NULL },
+ { "r8", &ddb_regs.tf_r8, NULL },
+ { "r9", &ddb_regs.tf_r9, NULL },
+ { "r10", &ddb_regs.tf_r10, NULL },
+ { "r11", &ddb_regs.tf_r11, NULL },
+ { "r12", &ddb_regs.tf_r12, NULL },
+ { "r13", &ddb_regs.tf_r13, NULL },
+ { "r14", &ddb_regs.tf_r14, NULL },
+ { "r15", &ddb_regs.tf_r15, NULL },
{ "dr0", NULL, db_dr0 },
{ "dr1", NULL, db_dr1 },
{ "dr2", NULL, db_dr2 },
* Machine register set.
*/
struct db_variable db_regs[] = {
- { "cs", &ddb_regs.tf_cs, FCN_NULL },
- { "ds", &ddb_regs.tf_ds, FCN_NULL },
- { "es", &ddb_regs.tf_es, FCN_NULL },
- { "fs", &ddb_regs.tf_fs, FCN_NULL },
- { "gs", &ddb_regs.tf_gs, FCN_NULL },
- { "ss", &ddb_regs.tf_ss, FCN_NULL },
- { "eax", &ddb_regs.tf_eax, FCN_NULL },
- { "ecx", &ddb_regs.tf_ecx, FCN_NULL },
- { "edx", &ddb_regs.tf_edx, FCN_NULL },
- { "ebx", &ddb_regs.tf_ebx, FCN_NULL },
- { "esp", &ddb_regs.tf_esp, FCN_NULL },
- { "ebp", &ddb_regs.tf_ebp, FCN_NULL },
- { "esi", &ddb_regs.tf_esi, FCN_NULL },
- { "edi", &ddb_regs.tf_edi, FCN_NULL },
- { "eip", &ddb_regs.tf_eip, FCN_NULL },
- { "efl", &ddb_regs.tf_eflags, FCN_NULL },
+ { "cs", &ddb_regs.tf_cs, NULL },
+ { "ds", &ddb_regs.tf_ds, NULL },
+ { "es", &ddb_regs.tf_es, NULL },
+ { "fs", &ddb_regs.tf_fs, NULL },
+ { "gs", &ddb_regs.tf_gs, NULL },
+ { "ss", &ddb_regs.tf_ss, NULL },
+ { "eax", &ddb_regs.tf_eax, NULL },
+ { "ecx", &ddb_regs.tf_ecx, NULL },
+ { "edx", &ddb_regs.tf_edx, NULL },
+ { "ebx", &ddb_regs.tf_ebx, NULL },
+ { "esp", &ddb_regs.tf_esp, NULL },
+ { "ebp", &ddb_regs.tf_ebp, NULL },
+ { "esi", &ddb_regs.tf_esi, NULL },
+ { "edi", &ddb_regs.tf_edi, NULL },
+ { "eip", &ddb_regs.tf_eip, NULL },
+ { "efl", &ddb_regs.tf_eflags, NULL },
{ "dr0", NULL, db_dr },
{ "dr1", NULL, db_dr },
{ "dr2", NULL, db_dr },
struct sem;
typedef struct sem *sem_t;
-#define SEM_FAILED ((sem_t *)0)
+#define SEM_FAILED (NULL)
#define SEM_VALUE_MAX UINT_MAX
#ifndef _KERNEL
else
flags = 0;
vn_unlock(ap->a_vp);
- error = sosend(wso, (struct sockaddr *)0, ap->a_uio, 0,
- (struct mbuf *)0, flags, td);
+ error = sosend(wso, NULL, ap->a_uio, 0, NULL, flags, td);
vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY);
return (error);
}
nb = ip->i_ib[indirs[0].in_off];
if (nb == 0) {
#if 0
- pref = ext2_blkpref(ip, lbn, 0, (daddr_t *)0, 0);
+ pref = ext2_blkpref(ip, lbn, 0, NULL, 0);
#else
/* see the comment by ext2_blkpref. What we do here is
to pretend that it'd be good for a block holding indirect
pref = ext2_blkpref(ip, lbn, indirs[i].in_off, bap,
lblkno(fs, bp->b_loffset));
#else
- pref = ext2_blkpref(ip, lbn, 0, (daddr_t *)0, 0);
+ pref = ext2_blkpref(ip, lbn, 0, NULL, 0);
#endif
if ((error =
ext2_alloc(ip, lbn, pref, (int)fs->s_blocksize, cred, &newb)) != 0) {
}
error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf,
sizeof (struct dirtemplate), (off_t)0,
- UIO_SYSSPACE, IO_NODELOCKED, cred, (int *)0);
+ UIO_SYSSPACE, IO_NODELOCKED, cred, NULL);
if (error != 0)
break;
namlen = dirbuf.dotdot_type; /* like ufs little-endian */
if (dq->dq_cnt)
panic("dqflush: stray dquot");
LIST_REMOVE(dq, dq_hash);
- dq->dq_ump = (struct ext2mount *)0;
+ dq->dq_ump = NULL;
}
}
}
error = vn_rdwr(UIO_READ, fvp, (caddr_t)&dirbuf,
sizeof (struct dirtemplate), (off_t)0,
UIO_SYSSPACE, IO_NODELOCKED,
- tcnp->cn_cred, (int *)0);
+ tcnp->cn_cred, NULL);
if (error == 0) {
/* Like ext2 little-endian: */
namlen = dirbuf.dotdot_type;
sizeof (struct dirtemplate),
(off_t)0, UIO_SYSSPACE,
IO_NODELOCKED|IO_SYNC,
- tcnp->cn_cred, (int *)0);
+ tcnp->cn_cred, NULL);
}
}
}
dirtemplate.dotdot_reclen = DIRBLKSIZ - 12;
error = vn_rdwr(UIO_WRITE, tvp, (caddr_t)&dirtemplate,
sizeof (dirtemplate), (off_t)0, UIO_SYSSPACE,
- IO_NODELOCKED|IO_SYNC, cnp->cn_cred, (int *)0);
+ IO_NODELOCKED|IO_SYNC, cnp->cn_cred, NULL);
if (error) {
dp->i_nlink--;
dp->i_flag |= IN_CHANGE;
error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0,
UIO_SYSSPACE, IO_NODELOCKED,
- ap->a_cnp->cn_cred, (int *)0);
+ ap->a_cnp->cn_cred, NULL);
if (error)
vput(vp);
#else
0,
#endif
- (struct iso_directory_record *)0));
+ NULL));
}
int
bcopy(toname, ip->de_Name, 11); /* update denode */
dp->de_fndoffset = to_diroffset;
dp->de_fndcnt = to_count;
- error = createde(ip, dp, (struct denode **)0, tcnp);
+ error = createde(ip, dp, NULL, tcnp);
if (error) {
bcopy(oldname, ip->de_Name, 11);
goto done;
if (nmp->nm_flag & NFSMNT_INT) {
bp = getblk(vp, loffset, size, GETBLK_PCATCH, 0);
while (bp == NULL) {
- if (nfs_sigintr(nmp, (struct nfsreq *)0, td))
+ if (nfs_sigintr(nmp, NULL, td))
return (NULL);
bp = getblk(vp, loffset, size, 0, 2 * hz);
}
(nfsd->nd_flag & ND_KERBAUTH), TRUE);
if (error) {
nfsm_reply(NFSX_UNSIGNED);
- nfsm_srvpostop_attr(1, (struct vattr *)0);
+ nfsm_srvpostop_attr(1, NULL);
error = 0;
goto nfsmout;
}
nfsdbprintf(("%s %d\n", __FILE__, __LINE__));
#ifndef nolint
- mp2 = (struct mbuf *)0;
+ mp2 = NULL;
#endif
mp3 = NULL;
fhp = &nfh.fh_generic;
&rdonly, (nfsd->nd_flag & ND_KERBAUTH), TRUE);
if (error) {
nfsm_reply(2 * NFSX_UNSIGNED);
- nfsm_srvpostop_attr(1, (struct vattr *)0);
+ nfsm_srvpostop_attr(1, NULL);
error = 0;
goto nfsmout;
}
if (error) {
vp = NULL;
nfsm_reply(2 * NFSX_UNSIGNED);
- nfsm_srvpostop_attr(1, (struct vattr *)0);
+ nfsm_srvpostop_attr(1, NULL);
error = 0;
goto nfsmout;
}
nfsdbprintf(("%s %d\n", __FILE__, __LINE__));
#ifndef nolint
- fvp = (struct vnode *)0;
+ fvp = NULL;
#endif
ffhp = &fnfh.fh_generic;
tfhp = &tnfh.fh_generic;
u_int32_t *tl;
int32_t t1;
struct nfsv2_sattr *sp;
- char *bpos, *pathcp = (char *)0, *cp2;
+ char *bpos, *pathcp = NULL, *cp2;
struct uio io;
struct iovec iv;
int error = 0, len, len2, dirfor_ret = 1, diraft_ret = 1;
struct sockaddr_in *sin;
struct thread *td = &thread0; /* only used for socreate and sobind */
- nmp->nm_so = (struct socket *)0;
+ nmp->nm_so = NULL;
saddr = nmp->nm_nam;
error = socreate(saddr->sa_family, &nmp->nm_so, nmp->nm_sotype,
nmp->nm_soproto, td);
if (nmp->nm_so) {
so = nmp->nm_so;
- nmp->nm_so = (struct socket *)0;
+ nmp->nm_so = NULL;
soshutdown(so, SHUT_RDWR);
soclose(so, FNONBLOCK);
}
} else
soflags = so->so_proto->pr_flags;
if ((soflags & PR_CONNREQUIRED) || (so->so_state & SS_ISCONNECTED))
- sendnam = (struct sockaddr *)0;
+ sendnam = NULL;
else
sendnam = nam;
if (so->so_type == SOCK_SEQPACKET)
* Get the RPC header with authorization.
*/
kerbauth:
- verf_str = auth_str = (char *)0;
+ verf_str = auth_str = NULL;
if (nmp->nm_flag & NFSMNT_KERB) {
verf_str = nickv;
verf_len = sizeof (nickv);
else if ((nmp->nm_flag & NFSMNT_KERB) && *tl++ == rpc_autherr) {
if (!failed_auth) {
failed_auth++;
- mheadend->m_next = (struct mbuf *)0;
+ mheadend->m_next = NULL;
m_freem(mrep);
m_freem(rep->r_mreq);
goto kerbauth;
nmp->nm_sent < nmp->nm_cwnd) &&
(m = m_copym(rep->r_mreq, 0, M_COPYALL, MB_DONTWAIT))){
if ((nmp->nm_flag & NFSMNT_NOCONN) == 0)
- error = so_pru_send(so, 0, m, (struct sockaddr *)0,
- (struct mbuf *)0, td);
+ error = so_pru_send(so, 0, m, NULL, NULL, td);
else
error = so_pru_send(so, 0, m, nmp->nm_nam,
- (struct mbuf *)0, td);
+ NULL, td);
if (error) {
if (NFSIGNORE_SOERROR(nmp->nm_soflags, error))
so->so_error = 0;
recm = NULL;
if (slp->ns_cc == slp->ns_reclen) {
recm = slp->ns_raw;
- slp->ns_raw = slp->ns_rawend = (struct mbuf *)0;
+ slp->ns_raw = slp->ns_rawend = NULL;
slp->ns_cc = slp->ns_reclen = 0;
} else if (slp->ns_cc > slp->ns_reclen) {
len = 0;
m = slp->ns_raw;
- om = (struct mbuf *)0;
+ om = NULL;
while (len < slp->ns_reclen) {
if ((len + m->m_len) > slp->ns_reclen) {
len += m->m_len;
m = m->m_next;
recm = slp->ns_raw;
- om->m_next = (struct mbuf *)0;
+ om->m_next = NULL;
} else {
om = m;
len += m->m_len;
m_freem(slp->ns_frag);
} else {
nfs_realign(&slp->ns_frag, 10 * NFSX_UNSIGNED);
- rec->nr_address = (struct sockaddr *)0;
+ rec->nr_address = NULL;
rec->nr_packet = slp->ns_frag;
STAILQ_INSERT_TAIL(&slp->ns_rec, rec, nr_link);
++slp->ns_numrec;
++*countp;
}
- slp->ns_frag = (struct mbuf *)0;
+ slp->ns_frag = NULL;
}
}
}
}
mb->m_next = mrest;
mreq->m_pkthdr.len = authsiz + 10 * NFSX_UNSIGNED + mrest_len;
- mreq->m_pkthdr.rcvif = (struct ifnet *)0;
+ mreq->m_pkthdr.rcvif = NULL;
*mbp = mb;
return (mreq);
}
/* Ensure async daemons disabled */
for (i = 0; i < NFS_MAXASYNCDAEMON; i++) {
nfs_iodwant[i] = NULL;
- nfs_iodmount[i] = (struct nfsmount *)0;
+ nfs_iodmount[i] = NULL;
}
nfs_nhinit(); /* Init the nfsnode table */
#ifndef NFS_NOSERVER
m = mp;
for (;;) {
count += m->m_len;
- if (m->m_next == (struct mbuf *)0)
+ if (m->m_next == NULL)
break;
m = m->m_next;
}
dp->ndm_eocookie = 0;
LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list);
} else
- return ((nfsuint64 *)0);
+ return (NULL);
}
while (pos >= NFSNUMCOOKIES) {
pos -= NFSNUMCOOKIES;
if (dp->ndm_list.le_next) {
if (!add && dp->ndm_eocookie < NFSNUMCOOKIES &&
pos >= dp->ndm_eocookie)
- return ((nfsuint64 *)0);
+ return (NULL);
dp = dp->ndm_list.le_next;
} else if (add) {
MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap),
LIST_INSERT_AFTER(dp, dp2, ndm_list);
dp = dp2;
} else
- return ((nfsuint64 *)0);
+ return (NULL);
}
if (pos >= dp->ndm_eocookie) {
if (add)
dp->ndm_eocookie = pos + 1;
else
- return ((nfsuint64 *)0);
+ return (NULL);
}
return (&dp->ndm_cookies[pos]);
}
* Get the client address for connected sockets.
*/
if (nfsdarg.name == NULL || nfsdarg.namelen == 0)
- nam = (struct sockaddr *)0;
+ nam = NULL;
else {
error = getsockaddr(&nam, nfsdarg.name,
nfsdarg.namelen);
kmalloc(sizeof (struct nfsuid), M_NFSUID,
M_WAITOK);
} else
- nuidp = (struct nfsuid *)0;
+ nuidp = NULL;
if ((slp->ns_flag & SLP_VALID) == 0) {
if (nuidp)
kfree((caddr_t)nuidp, M_NFSUID);
} else {
- if (nuidp == (struct nfsuid *)0) {
+ if (nuidp == NULL) {
nuidp = TAILQ_FIRST(&slp->ns_uidlruhead);
LIST_REMOVE(nuidp, nu_hash);
TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp,
so = (struct socket *)fp->f_data;
#if 0
- tslp = (struct nfssvc_sock *)0;
+ tslp = NULL;
/*
* Add it to the list, as required.
*/
cacherep = RC_DOIT;
writes_todo = 0;
#endif
- if (nfsd == (struct nfsd *)0) {
+ if (nfsd == NULL) {
nsd->nsd_nfsd = nfsd = (struct nfsd *)
kmalloc(sizeof (struct nfsd), M_NFSD, M_WAITOK|M_ZERO);
crit_enter();
if (slp == 0)
nfsd_head_flag &= ~NFSD_CHECKSLP;
}
- if ((slp = nfsd->nfsd_slp) == (struct nfssvc_sock *)0)
+ if ((slp = nfsd->nfsd_slp) == NULL)
continue;
if (slp->ns_flag & SLP_VALID) {
if (slp->ns_flag & SLP_DISCONN)
kfree((caddr_t)nd, M_NFSRVDESC);
nd = NULL;
}
- nfsd->nfsd_slp = (struct nfssvc_sock *)0;
+ nfsd->nfsd_slp = NULL;
nfsd->nfsd_flag &= ~NFSD_REQINPROG;
nfsrv_slpderef(slp);
continue;
}
nfsstats.srvrpccnt[nd->nd_procnum]++;
nfsrv_updatecache(nd, TRUE, mreq);
- nd->nd_mrep = (struct mbuf *)0;
+ nd->nd_mrep = NULL;
case RC_REPLY:
m = mreq;
siz = 0;
}
m = mreq;
m->m_pkthdr.len = siz;
- m->m_pkthdr.rcvif = (struct ifnet *)0;
+ m->m_pkthdr.rcvif = NULL;
/*
* For stream protocols, prepend a Sun RPC
* Record Mark.
TAILQ_REMOVE(&nfsd_head, nfsd, nfsd_chain);
crit_exit();
kfree((caddr_t)nfsd, M_NFSD);
- nsd->nsd_nfsd = (struct nfsd *)0;
+ nsd->nsd_nfsd = NULL;
if (--nfs_numnfsd == 0)
nfsrv_init(TRUE); /* Reinitialize everything */
return (error);
slp->ns_flag &= ~SLP_ALLFLAGS;
fp = slp->ns_fp;
if (fp) {
- slp->ns_fp = (struct file *)0;
+ slp->ns_fp = NULL;
so = slp->ns_so;
so->so_rcv.ssb_flags &= ~SSB_UPCALL;
so->so_upcall = NULL;
u_quad_t tquad;
#ifndef nolint
- sfp = (struct nfs_statfs *)0;
+ sfp = NULL;
#endif
error = nfs_nget(mp, (nfsfh_t *)nmp->nm_fh, nmp->nm_fhsize, &np);
if (error)
if (nmp->nm_so && adjsock) {
nfs_safedisconnect(nmp);
if (nmp->nm_sotype == SOCK_DGRAM)
- while (nfs_connect(nmp, (struct nfsreq *)0)) {
+ while (nfs_connect(nmp, NULL)) {
kprintf("nfs_args: retrying connect\n");
(void) tsleep((caddr_t)&lbolt, 0, "nfscon", 0);
}
* the first request, in case the server is not responding.
*/
if (nmp->nm_sotype == SOCK_DGRAM &&
- (error = nfs_connect(nmp, (struct nfsreq *)0)))
+ (error = nfs_connect(nmp, NULL)))
goto bad;
/*
np->n_modestamp = 0;
nfsm_wcc_data(vp, wccflag);
} else
- nfsm_loadattr(vp, (struct vattr *)0);
+ nfsm_loadattr(vp, NULL);
m_freem(mrep);
nfsmout:
return (error);
nfsm_postop_attr(newvp, attrflag, NFS_LATTR_NOSHRINK);
nfsm_postop_attr(dvp, attrflag, NFS_LATTR_NOSHRINK);
} else
- nfsm_loadattr(newvp, (struct vattr *)0);
+ nfsm_loadattr(newvp, NULL);
*vpp = newvp;
m_freem(mrep);
if (!lockparent) {
nfsm_postop_attr(newvp, attrflag, NFS_LATTR_NOSHRINK);
nfsm_postop_attr(dvp, attrflag, NFS_LATTR_NOSHRINK);
} else
- nfsm_loadattr(newvp, (struct vattr *)0);
+ nfsm_loadattr(newvp, NULL);
#if 0
/* XXX MOVE TO nfs_nremove() */
if ((cnp->cn_flags & CNP_MAKEENTRY) &&
nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
eof = fxdr_unsigned(int, *(tl + 1));
} else
- nfsm_loadattr(vp, (struct vattr *)0);
+ nfsm_loadattr(vp, NULL);
nfsm_strsiz(retlen, nmp->nm_rsize);
nfsm_mtouio(uiop, retlen);
m_freem(mrep);
}
}
} else {
- nfsm_loadattr(vp, (struct vattr *)0);
+ nfsm_loadattr(vp, NULL);
}
m_freem(mrep);
if (error)
u_int32_t *tl;
caddr_t cp;
int32_t t1, t2;
- struct vnode *newvp = (struct vnode *)0;
- struct nfsnode *np = (struct nfsnode *)0;
+ struct vnode *newvp = NULL;
+ struct nfsnode *np = NULL;
struct vattr vattr;
char *cp2;
caddr_t bpos, dpos;
if (!gotvp) {
if (newvp) {
vput(newvp);
- newvp = (struct vnode *)0;
+ newvp = NULL;
}
error = nfs_lookitup(dvp, cnp->cn_nameptr,
cnp->cn_namelen, cnp->cn_cred, cnp->cn_td, &np);
u_int32_t *tl;
caddr_t cp;
int32_t t1, t2;
- struct nfsnode *np = (struct nfsnode *)0;
- struct vnode *newvp = (struct vnode *)0;
+ struct nfsnode *np = NULL;
+ struct vnode *newvp = NULL;
caddr_t bpos, dpos, cp2;
int error = 0, wccflag = NFSV3_WCCRATTR, gotvp = 0, fmode = 0;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
if (!gotvp) {
if (newvp) {
vput(newvp);
- newvp = (struct vnode *)0;
+ newvp = NULL;
}
error = nfs_lookitup(dvp, cnp->cn_nameptr,
cnp->cn_namelen, cnp->cn_cred, cnp->cn_td, &np);
caddr_t bpos, dpos, cp2;
int slen, error = 0, wccflag = NFSV3_WCCRATTR, gotvp;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
- struct vnode *newvp = (struct vnode *)0;
+ struct vnode *newvp = NULL;
int v3 = NFS_ISV3(dvp);
nfsstats.rpccnt[NFSPROC_SYMLINK]++;
caddr_t cp;
int32_t t1, t2;
int len;
- struct nfsnode *np = (struct nfsnode *)0;
- struct vnode *newvp = (struct vnode *)0;
+ struct nfsnode *np = NULL;
+ struct vnode *newvp = NULL;
caddr_t bpos, dpos, cp2;
int error = 0, wccflag = NFSV3_WCCRATTR;
int gotvp = 0;
if (error == EEXIST || (!error && !gotvp)) {
if (newvp) {
vrele(newvp);
- newvp = (struct vnode *)0;
+ newvp = NULL;
}
error = nfs_lookitup(dvp, cnp->cn_nameptr, len, cnp->cn_cred,
cnp->cn_td, &np);
dpos = dpossav1;
mdsav2 = md;
md = mdsav1;
- nfsm_loadattr(newvp, (struct vattr *)0);
+ nfsm_loadattr(newvp, NULL);
dpos = dpossav2;
md = mdsav2;
dp->nfs_type =
/* Try lookitups until we get one that isn't there */
while (nfs_lookitup(dvp, sp->s_name, sp->s_namlen, sp->s_cred,
- cnp->cn_td, (struct nfsnode **)0) == 0) {
+ cnp->cn_td, NULL) == 0) {
sp->s_name[4]++;
if (sp->s_name[4] > 'z') {
error = EINVAL;
u_int32_t *tl;
caddr_t cp;
int32_t t1, t2;
- struct vnode *newvp = (struct vnode *)0;
+ struct vnode *newvp = NULL;
struct nfsnode *np, *dnp = VTONFS(dvp);
caddr_t bpos, dpos, cp2;
int error = 0, fhlen, attrflag;
return (ENOENT);