* Jeremy Chadwick ([EMAIL PROTECTED]) wrote: > There's a periodic script (/etc/periodic/weekly/330.catman) which > rebuilds all the catman pages for you. However, it makes an immense > mess of your weekly system mails due to all the manpage/nroff > formatting mistakes. Have a look: > > http://lists.freebsd.org/pipermail/freebsd-ports/2007-May/040648.html
If you want to find what's causing these errors, you could run catman with -v so it prints the filename of what it's processing. Less spammy but still noisy in the event of these warnings would be something like the attached patch, which saves the stderr stream and prints it and the currently processed filename if it's non-empty. Maybe friendlier would be the other patch, which silences nroff unless catman is running verbose. -- Thomas 'Freaky' Hurst http://hur.st/
--- catman.c.orig 2007-10-30 04:43:52.000000000 +0000 +++ catman.c 2007-10-30 04:45:35.000000000 +0000 @@ -403,6 +403,10 @@ dev_t src_dev; ino_t src_ino; const char *link_name; + struct stat err_st; + char err_file[MAXPATHLEN]; + int err_fd; + char err_buf[1024]; src_test = test_path(src, &src_mtime); if (!(src_test & (TEST_FILE|TEST_READABLE))) { @@ -447,13 +451,33 @@ } snprintf(tmp_file, sizeof tmp_file, "%s.tmp", cat); snprintf(cmd, sizeof cmd, - "%scat %s | tbl | nroff -T%s -man | col | %s > %s.tmp", + "%scat %s | tbl | nroff -T%s -man 2>%s.err | col | %s > %s.tmp", zipped == BZIP ? BZ2CAT_CMD : zipped == GZIP ? GZCAT_CMD : "", - src, nroff_device, + src, nroff_device, cat, zipped == BZIP ? BZ2_CMD : zipped == GZIP ? GZ_CMD : "cat", cat); if (system(cmd) != 0) err(1, "formatting pipeline"); + + snprintf(err_file, sizeof err_file, "%s.err", cat); + if (stat(err_file, &err_st) < 0) + warn("%s", err_file); + else if (err_st.st_size > 0) + { + fprintf(stderr, "nroff formatting errors in %s:\n", src); + if ((err_fd = open(err_file, O_RDONLY)) < 0) + warn("%s", err_file); + else + { + while (read(err_fd, &err_buf, sizeof err_buf) > 0) + fprintf(stderr, "%s", err_buf); + + close(err_fd); + } + } + if (unlink(err_file) < 0) + warn("%s", err_file); + if (rename(tmp_file, cat) < 0) warn("%s", cat); tmp_file[0] = '\0';
--- catman.c 2007-10-30 05:05:04.000000000 +0000 +++ catman.c.orig 2007-10-30 04:43:52.000000000 +0000 @@ -447,9 +447,9 @@ } snprintf(tmp_file, sizeof tmp_file, "%s.tmp", cat); snprintf(cmd, sizeof cmd, - "%scat %s | tbl | nroff -T%s -man %s| col | %s > %s.tmp", + "%scat %s | tbl | nroff -T%s -man | col | %s > %s.tmp", zipped == BZIP ? BZ2CAT_CMD : zipped == GZIP ? GZCAT_CMD : "", - src, nroff_device, verbose ? "" : "2>/dev/null", + src, nroff_device, zipped == BZIP ? BZ2_CMD : zipped == GZIP ? GZ_CMD : "cat", cat); if (system(cmd) != 0)
_______________________________________________ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[EMAIL PROTECTED]"