static int see_also(FILE *fp, char *refs, int flags) { int err= 0; char *buf= strdup(refs); #define isref(c) ( ('A'<=(c) && (c)<='Z') || \ ('a'<=(c) && (c)<='z') || \ ('0'<=(c) && (c)<='9') || ((c)=='_') || ((c)=='-') || ((c)=='/') || ((c)=='.') ) if(buf) { /* make `s' the working pointer in `buf' */ char *s= buf; /* * former revisions of ADOC used to indent the parsed references * by the same amount of white space as the first. Actually we * do not indent them amymore, so out it goes.... */ /* indentation string of the first reference */ #if 0 char *indent= (char *)0; #endif int num_refs= 0; while( *s && (err==0) ) { char *l, *r; /* move `l' and `r' to the left and right end of a reference in `s' */ for(l=s; *l && !isref(*l); l++) ; for(r=l; *r && isref(*r); r++) ; /* terminate the reference string with a '\0' */ if(*r) *r++= '\0'; /* save the indentation of the first reference */ #if 0 if(num_refs == 0) { if( (indent= strdup(s)) ) { char *t= indent; while(*t==' ' || *t=='\t') ++t; *t= '\0'; } else err= __LINE__; } #endif /* move `s' behind the reference */ s= r; if( *l && (err==0) ) { /* look for a function `l' and initialize `fun' to it's name */ char *fun= (char *)0; /*fprintf(stderr,"--> @ref{%s} ?\n",l);*/ if( getfun(l) ) fun= strdup(l); else if( !strchr(l,'/') ) { if( islib(l) ) fun= strdup(l); else { /* * Okay, we tried it the easy way but perhaps this is a reference * into the library without the library name in front of it. * Let's try appending `l' to the the current library name... */ char *f= getfun( (char *)0 ); if(f) { char *x, *xl, *xr; if( (x= chapsec(f, &xl, &xr)) ) { size_t len= strlen(xl) + 1 + strlen(l) + 1; char *y= (char *)malloc( len * sizeof(char) ); if(y) { sprintf(y,"%s/%s",xl,l); /*fprintf(stderr,"--> @ref{%s} ?\n",y);*/ if( getfun(y) ) fun= strdup(y); free(y); } else err= __LINE__; free(x); } else err= __LINE__; } else /* no current function? */ err= __LINE__; } } if(err == 0) { /* print the reference */ if( fun ) { char *cs, *chapter, *section; if( (cs= chapsec(fun, &chapter, §ion)) ) { if(flags & TEXI_ITEMIZE_REFERENCES) { if(num_refs==0) fprintf(fp,"@itemize\n"); if(section) fprintf(fp,"@item\n@xref{%s%s%s}.\n",chapter,CHAPSEC,section); else fprintf(fp,"@item\n@xref{%s}.\n",chapter); } else /* not itemized */ { if( (num_refs==0) && (flags & TEXI_GROUP_SECTIONS) ) fprintf(fp,"@group\n"); fprintf(fp,"%s",(num_refs==0) ? "@*@xref" : "@ref"); if(section) fprintf(fp,"{%s%s%s},\n",chapter,CHAPSEC,section); else fprintf(fp,"{%s},\n",chapter); } free(cs); } else err= __LINE__; free(fun); } else /* !fun */ { if(flags & TEXI_ITEMIZE_REFERENCES) { if(num_refs==0) fprintf(fp,"@itemize\n"); fprintf(fp,"@item\nSee @file{%s}\n",l); } else /* not itemized */ { if( (num_refs==0) && (flags & TEXI_GROUP_SECTIONS) ) fprintf(fp,"@group\n"); fprintf(fp,"%s{%s},\n",((num_refs==0) ? "@*See @file":"@file"),l); } } /* now at least one reference is printed */ ++num_refs; } } } if(num_refs > 0) { if(flags & TEXI_ITEMIZE_REFERENCES) fprintf(fp,"@end itemize\n"); else /* not itemized */ { if(flags & TEXI_GROUP_SECTIONS) fprintf(fp,"@end group\n"); fprintf(fp,"for more information.\n"); } } #if 0 if(indent) free(indent); #endif free(buf); } else err= __LINE__; #undef isref return err; }
static pid_t umm_getpgid(pid_t pid) { struct ummisc *mh = um_mod_get_private_data(); assert (mh != NULL); return getfun(mh,__NR_getpgid)(pid,mh); }
static pid_t umm_setsid(void) { struct ummisc *mh = um_mod_get_private_data(); assert (mh != NULL); return getfun(mh,__NR_setsid)(mh); }
static int umm_nice(int inc) { struct ummisc *mh = um_mod_get_private_data(); assert (mh != NULL); return getfun(mh,__NR_nice)(inc,mh); }
static int umm_setpriority(int which, int who, int prio) { struct ummisc *mh = um_mod_get_private_data(); assert (mh != NULL); return getfun(mh,__NR_setpriority)(which,who,prio,mh); }
static int umm_setfsgid(uid_t fsgid) { struct ummisc *mh = um_mod_get_private_data(); assert (mh != NULL); return getfun(mh,__NR_getegid)(fsgid,mh); }
static int umm_setresgid(gid_t rgid, gid_t egid, gid_t sgid) { struct ummisc *mh = um_mod_get_private_data(); assert (mh != NULL); return getfun(mh,__NR_setresgid)(rgid,egid,sgid,mh); }
static int umm_setdomainname(const char *name, size_t len) { struct ummisc *mh = um_mod_get_private_data(); assert (mh != NULL); return getfun(mh,__NR_setdomainname)(name,len,mh); }
static int umm_setresuid(uid_t ruid, uid_t euid, uid_t suid) { struct ummisc *mh = um_mod_get_private_data(); assert (mh != NULL); return getfun(mh,__NR_setresuid)(ruid,euid,suid,mh); }
static int umm_uname(struct utsname *buf) { struct ummisc *mh = um_mod_get_private_data(); assert (mh != NULL); return getfun(mh,__NR_uname)(buf,mh); }
static int umm_clock_settime(clockid_t clk_id, const struct timespec *tp) { struct ummisc *mh = um_mod_get_private_data(); assert (mh != NULL); return (getfun(mh,__NR_clock_settime))(clk_id,tp,mh); }
static int umm_clock_getres(clockid_t clk_id, struct timespec *res) { struct ummisc *mh = um_mod_get_private_data(); assert (mh != NULL); return getfun(mh,__NR_clock_getres)(clk_id,res,mh); }
static int umm_adjtimex(struct timex *buf) { struct ummisc *mh = um_mod_get_private_data(); assert (mh != NULL); return getfun(mh,__NR_adjtimex)(buf,mh); }
static int umm_settimeofday(const struct timeval *tv , const struct timezone *tz) { struct ummisc *mh = um_mod_get_private_data(); assert (mh != NULL); return getfun(mh,__NR_settimeofday)(tv,tz,mh); }