Print this page
make: unifdef for NSE (undefined)

*** 310,449 **** rp->cond_macrostring = NULL; } } } - #ifdef NSE - /* - * report_recursive_done() - * - * Write the .nse_depinfo file. - * - * Parameters: - * - * Static variables used: - * recursive_list The list of targets - * changed Written if report set changed - * - * Global variables used: - * recursive_name The Name ".RECURSIVE", compared against - */ - void - report_recursive_done(void) - { - char *search_dir; - char nse_depinfo[MAXPATHLEN]; - char tmpfile[MAXPATHLEN]; - FILE *ofp; - FILE *ifp; - wchar_t *space; - wchar_t *data; - wchar_t *line; - wchar_t *bigger_line; - int line_size, line_index; - int lock_err; - Recursive_make rp; - - if (changed == false) { - return; - } - - search_dir = getenv(NOCATGETS("NSE_DEP")); - if (search_dir == NULL) { - return; - } - (void) sprintf(nse_depinfo, "%s/%s", search_dir, NSE_DEPINFO); - (void) sprintf(tmpfile, "%s.%d", nse_depinfo, getpid()); - ofp = fopen(tmpfile, "w"); - if (ofp == NULL) { - (void) fprintf(stderr, - catgets(catd, 1, 116, "Cannot open `%s' for writing\n"), - tmpfile); - return; - } - (void) sprintf(nse_depinfo_lockfile, - "%s/%s", search_dir, NSE_DEPINFO_LOCK); - if (lock_err = file_lock(nse_depinfo, - nse_depinfo_lockfile, - (int *) &nse_depinfo_locked, 0)) { - (void) fprintf(stderr, - catgets(catd, 1, 117, "writing .RECURSIVE lines to %s\n"), - tmpfile); - (void) fprintf(stderr, - catgets(catd, 1, 118, "To recover, merge .nse_depinfo.%d with .nse_depinfo\n"), - getpid(), - catgets(catd, 1, 119, "with .nse_depinfo")); - } - - if (nse_depinfo_locked) { - ifp = fopen(nse_depinfo, "r"); - if (ifp != NULL) { - /* - * Copy all the non-.RECURSIVE lines from - * the old file to the new one. - */ - line_size = MAXPATHLEN; - line_index = line_size - 1; - line = ALLOC_WC(line_size); - while (fgetws(line, line_size, ifp) != NULL) { - while (wslen(line) == line_index) { - if (line[wslen(line) - 1] == '\n') { - continue; - } - bigger_line = ALLOC_WC(2 * line_size); - wscpy(bigger_line, line); - retmem(line); - line = bigger_line; - if (fgetws(&line[line_index], - line_size, ifp) == NULL) - continue; - line_index = 2 * line_index; - line_size = 2 * line_size; - } - - space = wschr(line, (int) space_char); - if (space != NULL && - IS_WEQUALN(&space[1], - recursive_name->string, - (int) recursive_name->hash.length)) { - continue; - } - WCSTOMBS(mbs_buffer, line); - (void) fprintf(ofp, "%s", mbs_buffer); - } - (void) fclose(ifp); - } - } - - /* - * Write out the .RECURSIVE lines. - */ - for (rp = recursive_list; rp != NULL; rp = rp->next) { - if (rp->removed) { - continue; - } - if (rp->newline != NULL) { - data = rp->newline; - } else { - data = rp->oldline; - } - if (data != NULL) { - WCSTOMBS(mbs_buffer, data); - (void) fprintf(ofp, "%s\n", mbs_buffer); - } - } - (void) fclose(ofp); - - if (nse_depinfo_locked) { - (void) rename(tmpfile, nse_depinfo); - (void) unlink(nse_depinfo_lockfile); - nse_depinfo_locked = false; - nse_depinfo_lockfile[0] = '\0'; - (void) chmod(nse_depinfo, 0666); - } - } - #endif // NSE /* gather_recursive_deps() * * Create or update list of recursive targets. */ --- 310,319 ----