Article View: comp.sys.next.sysadmin
Article #856Re: NNTP Compiling - type mismatch in initialization
From: Eric P. Scott
Date: Tue, 01 Sep 1992 10:26
Date: Tue, 01 Sep 1992 10:26
46 lines
1901 bytes
1901 bytes
[comp.sys.next.sysadmin is an inappropriate newsgroup for this
question; followups have been redirected to
comp.sys.next.programmer]
In article <1992Aug31.152659.15528@magnus.acs.ohio-state.edu>
szatezal@magnus.acs.ohio-state.edu (Shane M Zatezalo)
writes:
>I'm trying to compile NNTP, and when the compiler is doing the file "misc.c"
>it bombs out with this:
>misc.c:955: type mismatch in initialization
>struct nlist Nl[] =
>{
> { "_avenrun" },
(1) You need to add another layer of braces to nlist vectors
before they'll compile, e.g.
{ { "_avenrun" } },
[I suggest using #if[n]def NeXT conditionals as warranted]
(2) Mining load average out of kmem is the WRONG approach on the
NeXT. A better way is to use the table() call, which also
doesn't require exceptional access privileges. This example
ought to be in the programmers' FAQ; the question seems to come
up about every other month.
#include <stdio.h>
#include <sys/types.h>
#include <sys/table.h>
main() {
struct tbl_loadavg avg;
(void)table(TBL_LOADAVG, 0, (caddr_t)&avg, 1, sizeof avg);
(void)printf("load average:%5.2f,%5.2f,%5.2f\n",
(double)avg.tl_avenrun[0]/(double)avg.tl_lscale,
(double)avg.tl_avenrun[1]/(double)avg.tl_lscale,
(double)avg.tl_avenrun[2]/(double)avg.tl_lscale);
exit(0);
}
Valid for 1.0
Valid for 2.0
Not verified for 3.0
-=EPS=-
Technical Details
Message-ID:
<1992Sep1.102639.22689@csus.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!decwrl!csus.edu!newsReferences:
<1992Aug31.152659.15528@magnus.acs.ohio-state.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.sysadmin,comp.sys.next.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!decwrl!csus.edu!news From: eps@futon.SFSU.EDU (Eric P. Scott) Subject: Re: NNTP Compiling - type mismatch in initialization Message-ID: <1992Sep1.102639.22689@csus.edu> Followup-To: comp.sys.next.programmer Sender: news@csus.edu Reply-To: eps@cs.sfsu.edu Organization: San Francisco State University References: <1992Aug31.152659.15528@magnus.acs.ohio-state.edu> Date: Tue, 1 Sep 1992 10:26:39 GMT Lines: 46