FILE * file;
FILE * file = NULL;
Format(ManpageGlobals * man_globals, char * entry){  FILE * file;#ifdef HAS_MKSTEMP  int fd;#endif  Widget manpage = man_globals->manpagewidgets.manpage;  char cmdbuf[BUFSIZ], tmp[BUFSIZ], filename[BUFSIZ], error_buf[BUFSIZ];  char path[BUFSIZ];  XEvent event;  Position x,y;			/* location to pop up the				   "would you like to save" widget. */#ifndef HAS_MKSTEMP  if ( !UncompressUnformatted(man_globals, entry, filename) ) {#else  if ( !UncompressUnformatted(man_globals, entry, filename, &file) ) {#endif    /* We Really could not find it, this should never happen, yea right. */    sprintf(error_buf, "Could not open manual page, %s", entry);    PopupWarning(man_globals, error_buf);    XtPopdown( XtParent(man_globals->standby) );    return(NULL);  }#ifndef HAS_MKSTEMP  if ((file = fopen(filename, "r")) != NULL) {#else  if (file != NULL) {#endif    char line[BUFSIZ];    if (fgets(line, sizeof(line), file) != NULL) {	if (strncmp(line, ".so ", 4) == 0) {	  line[strlen(line) - 1] = '\0';	  fclose(file);	  unlink(filename);	  if (line[4] != '/') {	    char *ptr = NULL;	    strcpy(tmp, entry);	    if ((ptr = rindex(tmp, '/')) != NULL) {	      *ptr = '\0';	      if ((ptr = rindex(tmp, '/')) != NULL)		ptr[1] = '\0';	    }	  }	  else	    *tmp = '\0';	  sprintf(filename, "%s%s", tmp, line + 4);	  return (Format(man_globals, filename));	}    }    fclose(file);  }  Popup(XtParent(man_globals->standby), XtGrabExclusive);  while ( !XCheckTypedWindowEvent(XtDisplay(man_globals->standby),				  XtWindow(man_globals->standby),				  Expose, &event) );  XtDispatchEvent( &event );  XFlush(XtDisplay(man_globals->standby));  strcpy(tmp,MANTEMP);		          /* Get a temp file. */#ifndef HAS_MKSTEMP  (void) mktemp(tmp);#else  fd = mkstemp(tmp);  file = fdopen(fd, "r");#endif  strcpy(man_globals->tempfile, tmp);  ParseEntry(entry, path, NULL, NULL);#ifndef HANDLE_ROFFSEQ#ifndef HAS_MKSTEMP  sprintf(cmdbuf,"cd %s ; %s %s %s > %s %s", path, TBL,	  filename, FORMAT, man_globals->tempfile, "2> /dev/null");#else  sprintf(cmdbuf,"cd %s ; %s %s %s >> %s %s", path, TBL,	  filename, FORMAT, man_globals->tempfile, "2> /dev/null");#endif#else  /* Handle more flexible way of specifying the formatting pipeline */  if (! ConstructCommand(cmdbuf, path, filename, man_globals->tempfile)) {     sprintf(error_buf, "Constructed command was too long!");     PopupWarning(man_globals, error_buf);     file = NULL;  }  else#endif /* HANDLE_ROFFSEQ */  if(system(cmdbuf) != 0) {	/* execute search. */    sprintf(error_buf,	    "Something went wrong trying to run the command: %s", cmdbuf);    PopupWarning(man_globals, error_buf);    file = NULL;  }  else {#ifndef HAS_MKSTEMP    if ((file = fopen(man_globals->tempfile,"r")) == NULL) {      sprintf(error_buf, "Something went wrong in retrieving the %s",	      "temp file, try cleaning up /tmp");      PopupWarning(man_globals, error_buf);    }    else {#endif      XtPopdown( XtParent(man_globals->standby) );      if ( (man_globals->save == NULL) ||	   (man_globals->manpagewidgets.manpage == NULL) )	unlink(man_globals->tempfile);      else {	char * ptr, catdir[BUFSIZ];	/*	 * If the catdir is writeable then ask the user if he/she wants to	 * write the man page to it.	 */	strcpy(catdir, man_globals->save_file);	if ( (ptr = rindex(catdir, '/')) != NULL) {	  *ptr = '\0';	  if ( access(catdir, W_OK) != 0 )	    unlink(man_globals->tempfile);	  else {	    x = (Position) Width(man_globals->manpagewidgets.manpage)/2;	    y = (Position) Height(man_globals->manpagewidgets.manpage)/2;	    XtTranslateCoords(manpage, x, y, &x, &y);	    PositionCenter( man_globals->save, (int) x, (int) y, 0, 0, 0, 0);	    XtPopup( man_globals->save, XtGrabExclusive);	  }	}	else	  unlink(man_globals->tempfile);      }#ifndef HAS_MKSTEMP    }#endif  }  if (man_globals->compress || man_globals->gzip)    /* If the original							was compressed							then this is a tempory							file. */    unlink(filename);  return(file);}