ref: 7049e2397d6a0c0343068e3cc61e6b955311c64a
parent: 5b1f9c9a899c04f7531a9a47baf008c8db68fd15
author: Ali Gholami Rudi <ali@rudi.ir>
date: Thu Oct 26 07:46:26 EDT 2017
post: specify the title with -t
--- a/post.c
+++ b/post.c
@@ -21,6 +21,7 @@
#include <string.h>
#include "post.h"
+static char *ps_title; /* document title */
static int ps_pagewidth = 2159; /* page width (tenths of a millimetre) */
static int ps_pageheight = 2794;/* page height (tenths of a millimetre) */
static int ps_linewidth = 40; /* drawing line thickness in thousandths of an em */
@@ -288,7 +289,7 @@
fprintf(stderr, "neatpost: cannot open device %s\n", postdev);
exit(1);
}
- ps_header(ps_pagewidth, ps_pageheight, ps_linewidth);
+ ps_header(ps_title, ps_pagewidth, ps_pageheight, ps_linewidth);
break;
case 'T':
nextword(postdev);
@@ -460,6 +461,7 @@
"Options:\n"
" -F dir \tset font directory (" TROFFFDIR ")\n"
" -p size \tset paper size (letter); e.g., a4, 2100x2970\n"
+ " -t title\tspecify document title\n"
" -w lwid \tdrawing line thickness in thousandths of an em (40)\n"
" -n \talways draw glyphs by name (ps glyphshow)\n";
@@ -475,6 +477,8 @@
ps_linewidth = atoi(argv[i][2] ? argv[i] + 2 : argv[++i]);
} else if (argv[i][0] == '-' && argv[i][1] == 'n') {
outgname(1);
+ } else if (argv[i][0] == '-' && argv[i][1] == 't') {
+ ps_title = argv[i][2] ? argv[i] + 2 : argv[++i];
} else {
printf("%s", usage);
return 0;
--- a/post.h
+++ b/post.h
@@ -70,7 +70,7 @@
void draws(int h1, int v1, int h2, int v2);
/* postscript functions */
-void ps_header(int pagewidth, int pageheight, int linewidth);
+void ps_header(char *title, int pagewidth, int pageheight, int linewidth);
void ps_trailer(int pages, char *fonts);
void ps_pagebeg(int n);
void ps_pageend(int n);
--- a/ps.c
+++ b/ps.c
@@ -125,11 +125,13 @@
"} bind def\n";
/* pagewidth and pageheight are in tenths of a millimetre */
-void ps_header(int pagewidth, int pageheight, int linewidth)
+void ps_header(char *title, int pagewidth, int pageheight, int linewidth)
{
out("%%!PS-Adobe-2.0\n");
out("%%%%Version: 1.0\n");
- out("%%%%Creator: Neatroff - http://litcave.rudi.ir/\n");
+ if (title)
+ out("%%%%Title: (%s)\n", title);
+ out("%%%%Creator: Neatroff\n");
out("%%%%DocumentFonts: (atend)\n");
out("%%%%Pages: (atend)\n");
out("%%%%EndComments\n");