]>
diplodocus.org Git - nmh/blob - docs/historical/SRI-NOSC/subs.dir/m_getdefs.c
2 #include "/m/mh/iobuf.h"
4 char *mypath
, defpath
[128];
10 register struct node
*np
;
11 register int state
, pid
;
14 char name
[NAMESZ
], field
[128];
17 return; /* We've already been called! */
19 mypath
= getpath(getruid());
20 copy(mh_defs
, copy(mypath
, defpath
));
22 if(fopen(defpath
, &ib
) < 0) {
23 if((pid
= fork()) == 0) {
24 execl(installproc
, "install-defs", "-detached", 0);
25 printf("Can't install .mh_defs!!\n");
27 } else if(pid
== -1) {
28 printf("No forks!\n");
31 while((state
= waita(&status
)) != -1 && state
!= pid
)
33 if(status
|| fopen(defpath
, &ib
) < 0) {
34 printf("[install-defs aborted]\n");
40 fstat(ib
.b_fildes
, field
);
41 deftime
= (&field
)->i_atime
;
47 switch(state
= m_getfld(state
,name
,field
,sizeof field
,&ib
)) {
50 np
->n_next
= alloc(sizeof *np
);
52 np
->n_name
= getcpy(name
);
53 np
->n_field
= trimcpy(field
);
62 printf(".mh_defs must not contain a body--it can't \
63 end with a blank line!\n");
65 printf("Bad format: .mh_defs!\n");