#include "gsint.h"
#include "getopt.h"
+#include <locale.h>
+#include <limits.h>
/*
* Prototypes for static functions.
* Send mail notification to user after print job has been completed.
*/
int mail = 0;
+char *mailto;
/*
* -M, --media
{{"88597", "greek", NULL}, ENC_ISO_8859_7, '\n', 8},
{{"88599", "latin5", NULL}, ENC_ISO_8859_9, '\n', 8},
{{"885910", "latin6", NULL}, ENC_ISO_8859_10, '\n', 8},
+ {{"885915", "latin9", NULL}, ENC_ISO_8859_15, '\n', 8},
{{"ascii", NULL, NULL}, ENC_ASCII, '\n', 8},
{{"asciifise", "asciifi", "asciise"}, ENC_ASCII_FISE, '\n', 8},
{{"asciidkno", "asciidk", "asciino"}, ENC_ASCII_DKNO, '\n', 8},
{"no-page-prefeed", no_argument, 0, 'K'},
{"lineprinter", no_argument, 0, 'l'},
{"lines-per-page", required_argument, 0, 'L'},
- {"mail", no_argument, 0, 'm'},
+ {"mail", optional_argument, 0, 'm'},
{"media", required_argument, 0, 'M'},
{"copies", required_argument, 0, 'n'},
{"newline", required_argument, 0, 'N'},
*/
#if HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
+#endif
+ setlocale (LC_CTYPE, "");
+#ifdef LC_PAPER
+ setlocale (LC_PAPER, "");
#endif
#endif
#if ENABLE_NLS
ERROR ((stderr, _("\tmake")));
ERROR ((stderr, _("\tmake check")));
ERROR ((stderr, _("\tmake install")));
- ERROR ((stderr,
-_("or set the environment variable `ENSCRIPT_LIBRARY' to point to your")));
- ERROR ((stderr,
-_("library directory.")));
+ ERROR ((stderr, _("or set the environment variable `ENSCRIPT_LIBRARY'"
+ " to point to your library directory.")));
exit (1);
}
buffer_append (&buffer, enscript_library);
buffer_append (&buffer, "/hl/*.st");
- system (buffer_ptr (&buffer));
+ if (system (buffer_ptr (&buffer)) < 0)
+ perror("system");
exit (0);
}
real_total_pages = total_pages;
/* We did something, tell what. */
- MESSAGE (0, (stderr, _("[ %d pages * %d copy ]"), real_total_pages,
- num_copies));
+ char message[80];
+ snprintf(message, sizeof message, "%s%s%s%s%s",
+ "[ ",
+ ngettext("%d page", "%d pages", real_total_pages),
+ " * ",
+ ngettext("%d copy", "%d copies", num_copies),
+ " ]");
+ MESSAGE (0, (stderr, message, real_total_pages, num_copies));
+
if (output_file == OUTPUT_FILE_NONE)
MESSAGE (0, (stderr, _(" sent to %s\n"),
printer ? printer : _("printer")));
/* Format spooler options. */
spooler_options[0] = '\0';
if (mail)
- strcat (spooler_options, "-m ");
+ {
+ strcat (spooler_options, "-m ");
+ strcat (spooler_options, mailto);
+ strcat (spooler_options, " ");
+ }
if (no_job_header)
{
strcat (spooler_options, no_job_header_switch);
int i;
c = getopt_long (argc, argv,
- "#:123456789a:A:b:BcC::d:D:e::E::f:F:gGhH::i:I:jJ:kKlL:mM:n:N:o:Op:P:qrRs:S:t:T:u::U:vVw:W:X:zZ",
+ "#:123456789a:A:b:BcC::d:D:e::E::f:F:gGhH::i:I:jJ:kKlL:m::M:n:N:o:Op:P:qrRs:S:t:T:u::U:vVw:W:X:zZ",
long_options, &option_index);
if (c == -1)
case 'm': /* send mail upon completion */
mail = 1;
+ if(optarg)
+ mailto = (optarg);
+ else
+ mailto = (*passwd).pw_name;
break;
case 'M': /* select output media */
-b, --header=HEADER set page header\n\
-B, --no-header no page headers\n\
-c, --truncate-lines cut long lines (default is to wrap)\n\
- -C, --line-numbers[=START]\n\
+ -C[START], --line-numbers[=START]\n\
precede each line with its line number\n\
-d an alias for option --printer\n\
-D, --setpagedevice=KEY[:VALUE]\n\
pass a page device definition to output\n\
- -e, --escapes[=CHAR] enable special escape interpretation\n"),
+ -e[CHAR], --escapes[=CHAR] enable special escape interpretation\n"),
program);
printf (_("\
- -E, --highlight[=LANG] highlight source code\n"));
+ -E[LANG], --highlight[=LANG] highlight source code\n"));
printf (_("\
-f, --font=NAME use font NAME for body text\n\
-G same as --fancy-header\n\
--fancy-header[=NAME] select fancy page header\n\
-h, --no-job-header suppress the job header page\n\
- -H, --highlight-bars=NUM specify how high highlight bars are\n\
+ -H[NUM], --highlight-bars[=NUM] specify how high highlight bars are\n\
-i, --indent=NUM set line indent to NUM characters\n\
-I, --filter=CMD read input files through input filter CMD\n\
-j, --borders print borders around columns\n\
-t, --title=TITLE set banner page's job title to TITLE. Option\n\
sets also the name of the input file stdin.\n\
-T, --tabsize=NUM set tabulator size to NUM\n\
- -u, --underlay[=TEXT] print TEXT under every page\n\
+ -u[TEXT], --underlay[=TEXT] print TEXT under every page\n\
-U, --nup=NUM print NUM logical pages on each output page\n\
-v, --verbose tell what we are doing\n\
-V, --version print version number\n\