@HAVE_JBIG@
@HAVE_JBIGTIFF@
+/*
+ * i18n support
+ */
+#define _(String) (String)
+#define N_(String) String
+#define textdomain(Domain) do {} while(0)
+#define bindtextdomain(Package, Directory) do {} while(0)
+#define ngettext(s1, s2, n) (n==1?s1:s2)
+
#endif
if (optind >= argc)
usage();
if (script == "" && !resubmit)
- fxFatal("No job parameters specified for alteration.");
+ fxFatal(_("No job parameters specified for alteration."));
if (callServer(emsg)) {
if (login(NULL, emsg) &&
(!useadmin || admin(NULL, emsg))) {
}
const char* old_job = jobid;
jobid = getCurrentJob();
- printf("Job %s: duplicated as job %s.\n", old_job, jobid);
+ printf(_("Job %s: duplicated as job %s.\n"), old_job, jobid);
} else if (! jobSuspend(jobid)) {
emsg = getLastResponse();
printError("%s", (const char*) emsg);
else
continue;
}
- printf("Job %s: done.\n", jobid);
+ printf(_("Job %s: done.\n"), jobid);
} else {
emsg = getLastResponse();
printError("%s", (const char*) emsg);
void
faxAlterApp::usage()
{
- fxFatal("usage: faxalter [-C]"
+ fxFatal(_("usage: faxalter [-C]"
" [-h server-host]"
" [-a time]"
" [-d number]"
" [-r]"
" [-v]"
" [-DQR]"
- " jobID...");
+ " jobID..."));
}
int
{
PageSizeInfo* info = PageSizeInfo::getPageSizeByName(name);
if (!info)
- fxFatal("Unknown page size \"%s\"", name);
+ fxFatal(_("Unknown page size \"%s\""), name);
pageWidth = info->width();
pageLength = info->height();
delete info;
void
faxCoverApp::usage()
{
- fxFatal("usage: %s"
+ fxFatal(_("usage: %s"
" [-t to]"
" [-c comments]"
" [-p #pages]"
" [-X from-company]"
" [-s pagesize]"
" -f from"
- " -n fax-number"
+ " -n fax-number")
, (const char*) appName);
}
} else
fd = Sys::open(cover, O_RDONLY);
if (fd < 0) {
- printError( "Could not locate prototype cover sheet \"%s\"",
+ printError(_("Could not locate prototype cover sheet \"%s\""),
(const char*) cover);
return;
}
path.remove(0);
struct passwd* pwd = getpwuid(getuid());
if (!pwd) {
- fxFatal("Can not figure out who you are.");
+ fxFatal(_("Can not figure out who you are."));
}
char* cp = pwd->pw_dir;
path.insert(cp);
void
usage()
{
- fprintf(stderr, "usage: %s [-a] [-t threshold] input.tif\n", appName);
+ fprintf(stderr, _("usage: %s [-a] [-t threshold] input.tif\n"), appName);
exit(-1);
}
usage();
TIFF* tif = TIFFOpen(argv[optind], "r");
if (!tif)
- fatal("%s: Cannot open, or not a TIFF file", argv[optind]);
+ fatal(_("%s: Cannot open, or not a TIFF file"), argv[optind]);
uint16 comp;
TIFFGetField(tif, TIFFTAG_COMPRESSION, &comp);
if (comp != COMPRESSION_CCITTFAX3 && comp != COMPRESSION_CCITTFAX4)
- fatal("%s: Not a Group 3 or Group 4-encoded TIFF file", argv[optind]);
+ fatal(_("%s: Not a Group 3 or Group 4-encoded TIFF file"), argv[optind]);
Class2Params params;
params.vr = VR_NORMAL;
params.ln = LN_INF;
params.df = DF_1DMH;
- printf("Chop %s >=%.2g\" of white space at the bottom.\n"
- , doAll ? "all pages with" : "last page if"
+ printf((doAll
+ ? _("Chop all pages with >=%.2g\" of white space at the bottom.\n")
+ : _("Chop last page if >=%.2g\" of white space at the bottom.\n"))
, minChop
);
dec.scanPageForBlanks(fillorder, params);
if (dec.getLastBlanks() > minRows) {
printf(
- "Chop %u rows, strip was %lu bytes, need only %lu\n"
+ _("Chop %u rows, strip was %lu bytes, need only %lu\n")
, dec.getLastBlanks()
, (u_long) totbytes
, (u_long) (dec.getEndOfPage() - data)
);
} else {
- printf("Don't chop, found %u rows, need %u rows\n"
+ printf(_("Don't chop, found %u rows, need %u rows\n")
, dec.getLastBlanks()
, minRows
);
recvStrip = 0; // TIFF strip number
if (EOFraised()) {
abortPageRecv();
- emsg = "Missing EOL after 5 seconds";
+ emsg = _("Missing EOL after 5 seconds");
recvTrace("%s", (const char*) emsg);
return (false);
}
* Adjust everything to reflect the location
* at which RTC was found in the data stream.
*/
- copyQualityTrace("Adjusting for RTC found at row %u", getRTCRow());
+ copyQualityTrace(_("Adjusting for RTC found at row %u"), getRTCRow());
// # EOL's in recognized RTC
u_int n = (u_int) (recvEOLCount - getRTCRow());
if ((recvRow -= n*rowSize) < buf)
* readable and/or is followed by line noise or random
* junk from the sender.
*/
- copyQualityTrace("adjusting for trailing noise (%lu run)", cblc);
+ copyQualityTrace(_("adjusting for trailing noise (%lu run)"), cblc);
recvEOLCount -= cblc;
recvBadLineCount -= cblc;
if ((recvRow -= cblc*rowSize) < buf)
recvRow = buf;
}
- recvTrace("%lu total lines, %lu bad lines, %lu consecutive bad lines"
+ recvTrace(_("%lu total lines, %lu bad lines, %lu consecutive bad lines")
, recvEOLCount
, recvBadLineCount
, recvConsecutiveBadLineCount
* Adjust the received line count to reflect the
* location at which RTC was found in the data stream.
*/
- copyQualityTrace("Adjusting for RTC found at row %u", getRTCRow());
+ copyQualityTrace(_("Adjusting for RTC found at row %u"), getRTCRow());
recvEOLCount = getRTCRow();
}
}
{
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, recvEOLCount);
if (TIFFWriteEncodedStrip(tif, strip, buf, cc) == -1)
- serverTrace("RECV: %s: write error", TIFFFileName(tif));
+ serverTrace(_("RECV: %s: write error"), TIFFFileName(tif));
}
/*
{
recvTrace("%u bytes of data, %lu total lines", cc, recvEOLCount);
if (TIFFWriteRawStrip(tif, strip, buf, cc) == -1)
- serverTrace("RECV: %s: write error", TIFFFileName(tif));
+ serverTrace(_("RECV: %s: write error"), TIFFFileName(tif));
}
/*
if (percentGoodLines != 0 && recvEOLCount != 0) {
u_long percent = 100 * (recvEOLCount - recvBadLineCount) / recvEOLCount;
if (percent < percentGoodLines) {
- serverTrace("RECV: REJECT page quality, %u%% good lines (%u%% required)",
+ serverTrace(_("RECV: REJECT page quality, %u%% good lines (%u%% required)"),
percent, percentGoodLines);
return (false);
}
if (params.vr == VR_FINE)
cblc *= 2;
if (recvConsecutiveBadLineCount > cblc) {
- serverTrace("RECV: REJECT page quality, %u-line run (max %u)",
+ serverTrace(_("RECV: REJECT page quality, %u-line run (max %u)"),
recvConsecutiveBadLineCount, cblc);
return (false);
}
{
va_list ap;
va_start(ap, fmt);
- static const fxStr recv("RECV: ");
+ static const fxStr recv(_("RECV: "));
vtraceStatus(FAXTRACE_PROTOCOL, recv | fmt, ap);
va_end(ap);
}
CQDecoder::invalidCode(const char* type, int x)
{
if (!seenRTC())
- copyQualityTrace("Invalid %s code word, row %u, x %d",
+ copyQualityTrace(_("Invalid %s code word, row %u, x %d"),
type, getReferenceRow(), x);
}
CQDecoder::badPixelCount(const char* type, int got, int expected)
{
if (!seenRTC())
- copyQualityTrace("Bad %s pixel count, row %u, got %d, expected %d",
+ copyQualityTrace(_("Bad %s pixel count, row %u, got %d, expected %d"),
type, getReferenceRow(), got, expected);
}
void
CQDecoder::badDecodingState(const char* type, int x)
{
- copyQualityTrace("Panic, bad %s decoding state, row %u, x %d",
+ copyQualityTrace(_("Panic, bad %s decoding state, row %u, x %d"),
type, getReferenceRow(), x);
}
{
va_list ap;
va_start(ap, fmt);
- static const fxStr cq("RECV/CQ: ");
+ static const fxStr cq(_("RECV/CQ: "));
vtraceStatus(FAXTRACE_COPYQUALITY, cq | fmt, ap);
va_end(ap);
}
void
usage()
{
- fprintf(stderr, "usage: %s [-m maxbad] [-p %%good] [-o output.tif] input.tif\n", appName);
+ fprintf(stderr, _("usage: %s [-m maxbad] [-p %%good] [-o output.tif] input.tif\n"), appName);
_exit(-1);
}
usage();
TIFF* tif = TIFFOpen(argv[optind], "r");
if (!tif) {
- fprintf(stderr, "%s: Cannot open, or not a TIFF file\n", argv[optind]);
+ fprintf(stderr, _("%s: Cannot open, or not a TIFF file\n"), argv[optind]);
return (-1);
}
TIFF* tifout = TIFFOpen(outFile, "w");
if (!tifout) {
- fprintf(stderr, "%s: Cannot create TIFF file\n", outFile);
+ fprintf(stderr, _("%s: Cannot create TIFF file\n"), outFile);
return (-1);
}
Class2Params params;
(void) cq.recvPageDLEData(tifout,
cq.checkQuality(), params, emsg);
} else
- printf("Read error on strip %u\n", strip);
+ printf(_("Read error on strip %u\n"), strip);
delete data;
}
}
faxQCleanApp::scanDirectory(void)
{
if (trace)
- printf("Scan %s directory for jobs to remove+archive.\n",
+ printf(_("Scan %s directory for jobs to remove+archive.\n"),
(const char*) doneDir);
DIR* dir = Sys::opendir(doneDir);
if (dir == NULL) {
- printf("%s: Could not scan directory for jobs.\n",
+ printf(_("%s: Could not scan directory for jobs.\n"),
(const char*) doneDir);
return;
}
struct stat sb;
if (Sys::stat(filename, sb) < 0 || !S_ISREG(sb.st_mode)) {
if (trace)
- printf("%s: ignored (cannot stat or not a regular file)\n",
+ printf(_("%s: ignored (cannot stat or not a regular file)\n"),
(const char*) filename);
continue;
}
* and forget it until later.
*/
if (trace)
- printf("%s: job too new, ignored (for now).\n",
+ printf(_("%s: job too new, ignored (for now).\n"),
(const char*) filename);
collectRefs(*req);
} else if (forceArchiving || archiving &&
* value to the archive script for archiving.
*/
if (verbose)
- printf("JOB %s: archive (%s)%s.\n"
+ printf(_("JOB %s: archive (%s)%s.\n")
, (const char*) req->jobid
, (const char*) req->doneop
- , nowork ? " (not done)" : ""
+ , nowork ? _(" (not done)") : ""
);
if (!nowork)
archiveJob(*req);
} else {
if (verbose)
- printf("JOB %s: remove (%s) %s.\n"
+ printf(_("JOB %s: remove (%s) %s.\n")
, (const char*) req->jobid
, (const char*) req->doneop
- , nowork ? " (not done)" : ""
+ , nowork ? _(" (not done)") : ""
);
if (!nowork)
Sys::unlink(req->qfile);
* so therefore can be removed.
*/
if (verbose)
- printf("%s: malformed queue file: remove\n",
+ printf(_("%s: malformed queue file: remove\n"),
(const char*) filename);
if (!nowork)
Sys::unlink(filename);
printf("%s: open: %s\n", (const char*) filename, strerror(errno));
}
if (trace)
- printf("Done scanning %s directory\n", (const char*) doneDir);
+ printf(_("Done scanning %s directory\n"), (const char*) doneDir);
closedir(dir);
}
case FaxRequest::send_pcl:
case FaxRequest::send_pcl_saved:
if (trace)
- printf("JOB %s: reference %s\n",
+ printf(_("JOB %s: reference %s\n"),
(const char*) req.jobid,
(const char*) fitem.item);
docrefs[fitem.item]++;
faxQCleanApp::expungeCruft(void)
{
if (trace)
- printf("Scan %s directory and remove unreferenced documents.\n",
+ printf(_("Scan %s directory and remove unreferenced documents.\n"),
(const char*) docDir);
DIR* dir = Sys::opendir(docDir);
if (dir == NULL) {
- printf("%s: Could not scan directory for unreferenced documents.\n",
+ printf(_("%s: Could not scan directory for unreferenced documents.\n"),
(const char*) docDir);
return;
}
struct stat sb;
if (Sys::stat(file, sb) < 0 || !S_ISREG(sb.st_mode)) {
if (trace)
- printf("%s: ignored, cannot stat or not a regular file\n",
+ printf(_("%s: ignored, cannot stat or not a regular file\n"),
(const char*) file);
continue;
}
*/
if (sb.st_nlink > 1) { // can't be orphaned yet
if (trace)
- printf("%s: ignored, file has %u links\n",
+ printf(_("%s: ignored, file has %u links\n"),
(const char*) file, sb.st_nlink);
continue;
}
if (docrefs.find(file)) { // referenced from doneq
if (trace)
- printf("%s: ignored, file has %u references\n",
+ printf(_("%s: ignored, file has %u references\n"),
(const char*) file, docrefs[file]);
continue;
}
if (now - sb.st_mtime < minDocAge) { // not old enough
if (trace)
- printf("%s: ignored, file is too new to remove\n",
+ printf(_("%s: ignored, file is too new to remove\n"),
(const char*) file);
continue;
}
fxStr qfile = qFilePrefix | file.tail(file.length()-l);
if (Sys::stat(qfile, sb) == 0) {
if (trace)
- printf("%s: file looks to be referenced by job\n",
+ printf(_("%s: file looks to be referenced by job\n"),
(const char*) file);
continue; // skip, in use
} else if (trace)
- printf("%s: file has no matching %s\n",
+ printf(_("%s: file has no matching %s\n"),
(const char*) file, (const char*)qfile);
} else if ((l != 0 && l < file.length() && strcmp(&file[l], "cover") == 0) ||
(k == 0 && strncmp(&file[docDir.length()+1], "cover", 5) == 0)) {
fxStr qfile = qFilePrefix | file.extract(prefix, len-prefix);
if (Sys::stat(qfile, sb) == 0) {
if (trace)
- printf("%s: file looks to be referenced by job\n",
+ printf(_("%s: file looks to be referenced by job\n"),
(const char*) file);
continue; // skip, in use
}
DIR *dir1 = Sys::opendir(docDir);
if(dir1 == 0) {
- printf("%s: Could not scan directory for base file.\n",
+ printf(_("%s: Could not scan directory for base file.\n"),
(const char *) docDir);
continue;
}
( strncmp(base, dp1->d_name, sl) == 0)) {
// Found match
if(trace)
- printf("%s: found match to base '%s', skipping.\n",
+ printf(_("%s: found match to base '%s', skipping.\n"),
(const char *)file, dp1->d_name);
got_match = true;
break;
continue;
}
if(trace)
- printf("%s: did not find base '%s' match.\n",
+ printf(_("%s: did not find base '%s' match.\n"),
(const char *) file, base);
free(base);
if (nowork || Sys::unlink(file) >= 0) {
if (verbose)
- printf("DOC %s: unreferenced document removed%s.\n"
+ printf(_("DOC %s: unreferenced document removed%s.\n")
, (const char*) file
- , nowork ? " (not done)" : ""
+ , nowork ? _(" (not done)") : ""
);
} else {
if (verbose)
- printf("%s: error removing unreferenced document: %s.\n",
+ printf(_("%s: error removing unreferenced document: %s.\n"),
(const char*) file, strerror(errno));
}
}
if (trace)
- printf("Done scanning %s directory\n", (const char*) docDir);
+ printf(_("Done scanning %s directory\n"), (const char*) docDir);
closedir(dir);
}
usage(const char* appName)
{
fprintf(stderr,
- "usage: %s [-a] [-j time] [-d time] [-q queue-directory]\n",
+ _("usage: %s [-a] [-j time] [-d time] [-q queue-directory]\n"),
appName);
}
case '?': usage(appName);
}
if (Sys::chdir(queueDir) < 0) {
- fprintf(stderr, "%s: Can not change directory: %s.\n",
+ fprintf(stderr, _("%s: Can not change directory: %s.\n"),
(const char*) queueDir, strerror(errno));
exit(-1);
}
usage()
{
fprintf(stderr,
- "usage: %s [-m format] [-o t.tif] [-f font.pcf] input.tif\n",
+ _("usage: %s [-m format] [-o t.tif] [-f font.pcf] input.tif\n"),
appName);
exit(-1);
}
usage();
TIFF* tif = TIFFOpen(argv[optind], "r");
if (!tif)
- fatal("%s: Cannot open, or not a TIFF file", argv[optind]);
+ fatal(_("%s: Cannot open, or not a TIFF file"), argv[optind]);
uint16 comp;
TIFFGetField(tif, TIFFTAG_COMPRESSION, &comp);
if (comp != COMPRESSION_CCITTFAX3 && comp != COMPRESSION_CCITTFAX4)
- fatal("%s: Not a Group 3 or Group 4-encoded TIFF file", argv[optind]);
+ fatal(_("%s: Not a Group 3 or Group 4-encoded TIFF file"), argv[optind]);
setupTagLine();
if (!tagLineFont->isReady())
- fatal("%s: Problem reading font", (const char*) tagLineFontFile);
+ fatal(_("%s: Problem reading font"), (const char*) tagLineFontFile);
TIFF* otif = TIFFOpen(output, "w");
if (!otif)
- fatal("%s: Cannot create output file", output);
+ fatal(_("%s: Cannot create output file"), output);
for (totalPages = 1; TIFFReadDirectory(tif); totalPages++)
;
TIFFSetDirectory(tif, 0);
if (fillorder != FILLORDER_LSB2MSB)
TIFFReverseBits(dp, totbytes);
if (TIFFWriteRawStrip(otif, strip, dp, totbytes) == -1)
- fatal("%s: Write error at strip %u, writing %lu bytes",
+ fatal(_("%s: Write error at strip %u, writing %lu bytes"),
output, strip, (u_long) totbytes);
}
delete data;
if (re->getErrorCode() > REG_NOMATCH) {
fxStr emsg;
re->getError(emsg);
- printf("Bad TSI pattern: %s: " | emsg | ".\n", re->pattern());
+ printf(_("Bad TSI pattern: %s: ") | emsg | ".\n", re->pattern());
}
}
}
static void
usage()
{
- fxFatal("usage: %s [-q] tsifile", appName);
+ fxFatal(_("usage: %s [-q] tsifile"), appName);
}
static int
prompt()
{
- printf("ready> "); fflush(stdout);
+ printf(_("ready> ")); fflush(stdout);
return (1);
}
if (cp)
*cp = '\0';
if (verbose)
- printf("input = \"%s\"\n", line);
+ printf(_("input = \"%s\"\n"), line);
updateTSIPatterns();
if (tsiPats != NULL) {
u_int i;
for (i = 0; i < tsiPats->length(); i++) {
RE* pat = (*tsiPats)[i];
if (verbose)
- printf("[check %s]\n", pat->pattern());
+ printf(_("[check %s]\n"), pat->pattern());
fxStr tsi(line);
if (pat->Find(tsi)) {
- printf("%s (matched by %s)\n",
- (*acceptTSI)[i] ? "accept" : "reject",
+ printf(((*acceptTSI)[i] ?
+ _("accept (matched by %s)\n") :
+ _("reject (matched by %s)\n")),
pat->pattern());
break;
}
}
if (i == tsiPats->length())
- printf("reject (no pattern match)\n");
+ printf(_("reject (no pattern match)\n"));
} else
- printf("reject (no patterns)\n");
+ printf(_("reject (no patterns)\n"));
}
return (0);
}
type.lowercase();
subtype.lowercase();
} else {
- emsg = "Syntax error parsing MIME Content-Type: " | *s;
+ emsg = _("Syntax error parsing MIME Content-Type: ") | *s;
type = "text"; // reset on parsing error
return (false);
}
case ENC_BASE64: return getBase64Line(fd, buf);
case ENC_UUENCODE: return getUUDecodeLine(fd, buf);
}
- fxFatal("Internal error, unsupported Content-Transfer-Encoding %u", encode);
+ fxFatal(_("Internal error, unsupported Content-Transfer-Encoding %u"), encode);
/*NOTREACHED*/
return (false);
}
;
headers.append(line.tail(len-l));
if (verbose)
- fprintf(stderr, "HEADER %s: %s\n"
+ fprintf(stderr, _("HEADER %s: %s\n")
, (const char*) fields[fields.length()-1]
, (const char*) headers[headers.length()-1]
);
} else if (field != "") { // append continuation
headers[headers.length()-1].append("\n" | line);
if (verbose)
- fprintf(stderr, "+HEADER %s: %s\n"
+ fprintf(stderr, _("+HEADER %s: %s\n")
, (const char*) field
, (const char*) line
);
setTitle("HylaFAX-Mail");
if (Sys::mkdtemp(&tmpDir[0]) == NULL)
- fxFatal("Cannot create temp directory %s", (const char*) tmpDir);
+ fxFatal(_("Cannot create temp directory %s"), (const char*) tmpDir);
}
faxMailApp::~faxMailApp()
if ((s = findHeader("x-fax-dialstring"))) // dialstring in envelope
job->setDialString(*s);
if (job->getDialString() == "")
- fxFatal("No Destination/Dialstring specified");
+ fxFatal(_("No Destination/Dialstring specified"));
/*
* Establish the sender's identity.
} else if ((s = findHeader("from"))) {
client->setFromIdentity(*s);
} else {
- fxFatal("No From/Sender identity specified");
+ fxFatal(_("No From/Sender identity specified"));
}
if (pageSize != "")
if (version && stripComments(*version) == "1.0") {
if (verbose)
- fprintf(stderr, "faxmail: This is a MIME message\n");
+ fprintf(stderr, _("faxmail: This is a MIME message\n"));
beginFile();
withinFile = true;
// We only format top-level headers if they are
withinFile = false;
} else {
if (verbose)
- fprintf(stderr, "faxmail: This is not a MIME message\n");
+ fprintf(stderr, _("faxmail: This is not a MIME message\n"));
beginFile();
withinFile = true;
// We only format top-level headers if they are
client->hangupServer();
}
if (!status)
- fxFatal("unable to process message:\n\t%s", (const char*) emsg);
+ fxFatal(_("unable to process message:\n\t%s"), (const char*) emsg);
}
}
while (! last) {
int c = getc(fd);
if (c == EOF) {
- error("Badly formatted MIME; premature EOF");
+ error(_("Badly formatted MIME; premature EOF"));
break;
}
ungetc(c, fd); // push back read ahead
faxMailApp::formatWithExternal (FILE* fd, const fxStr& app, MIMEState& mime)
{
if (verbose)
- fprintf(stderr, "CONVERT: run %s\n", (const char*) app);
+ fprintf(stderr, _("CONVERT: run %s\n"), (const char*) app);
fxStr tmp = tmpDir | "/" | mimeid;
tmps.append(tmp);
fxStackBuffer buf;
buf.put("-----------------------------\n");
if (mime.getDescription() != "")
- buf.fput("DISCARDED %s (%s/%s) GOES HERE\n"
+ buf.fput(_("DISCARDED %s (%s/%s) GOES HERE\n")
, (const char*) mime.getDescription()
, (const char*) mime.getType()
, (const char*) mime.getSubType()
);
else
- buf.fput("DISCARDED %s/%s GOES HERE\n"
+ buf.fput(_("DISCARDED %s/%s GOES HERE\n")
, (const char*) mime.getType()
, (const char*) mime.getSubType()
);
if (ftmp >= 0) {
/*
if (!Sys::isRegularFile(tmpFile)) {
- error("%s: is not a regular file", (const char*) tmpFile);
+ error(_("%s: is not a regular file"), (const char*) tmpFile);
return(false);
}
*/
Sys::close(ftmp);
return (true);
}
- error("%s: write error: %s", (const char*) tmpFile, strerror(errno));
+ error(_("%s: write error: %s"), (const char*) tmpFile, strerror(errno));
Sys::close(ftmp);
} else {
- error("%s: Can not create temporary file", (const char*) tmpFile);
+ error(_("%s: Can not create temporary file"), (const char*) tmpFile);
}
discardPart(fd, mime);
return (false);
{
int fd = Sys::open(output, O_WRONLY | O_CREAT | O_EXCL, S_IWUSR | S_IRUSR);
if (fd < 0)
- fxFatal("Couldn't open output file: %s", (const char*)output);
+ fxFatal(_("Couldn't open output file: %s"), (const char*)output);
const char* av[3];
av[0] = strrchr(app, '/');
switch (pid) {
case -1: // error
close(fd);
- error("Error converting %s/%s; could not fork subprocess: %s"
+ error(_("Error converting %s/%s; could not fork subprocess: %s")
, (const char*) mime.getType()
, (const char*) mime.getSubType()
, strerror(errno)
close(fd);
if (Sys::waitpid(pid, status) == pid && status == 0)
return (true);
- error("Error converting %s/%s; command was \"%s %s\"; exit status %x"
+ error(_("Error converting %s/%s; command was \"%s %s\"; exit status %x")
, (const char*) mime.getType()
, (const char*) mime.getSubType()
, (const char*) app
void
faxMailApp::usage()
{
- fxFatal("usage: faxmail"
+ fxFatal(_("usage: faxmail"
" [-b boldfont]"
" [-H pageheight]"
" [-i italicfont]"
" [-C covertemplate]"
" [-t notify]"
" [-u user]"
- " [-12cnNrRTv]"
+ " [-12cnNrRTv]")
);
}
emsg = getLastResponse();
break;
}
- printf("%s removed.\n", id);
+ printf(_("%s removed.\n"), id);
}
}
}
faxRmApp::removeJob(const char* id, fxStr& emsg)
{
if (jobKill(id)) {
- printf("Job %s removed.\n", id);
+ printf(_("Job %s removed.\n"), id);
return (true);
}
emsg = getLastResponse();
if (getLastCode() == 504 && jobDelete(id)) {
- printf("Job %s removed (from doneq).\n", id);
+ printf(_("Job %s removed (from doneq).\n"), id);
emsg = "";
return (true);
}
void
faxRmApp::usage()
{
- fxFatal("usage: faxrm [-h server-host] [-adv] id...");
+ fxFatal(_("usage: faxrm [-h server-host] [-adv] id..."));
}
int
setVerbose(true);
break;
case '?':
- fxFatal("usage: faxstat [-h server-host] [-adfgilrsv]");
+ fxFatal(_("usage: faxstat [-h server-host] [-adfgilrsv]"));
}
fxStr emsg;
if (callServer(emsg)) {
return (getReply(false) == COMPLETE);
}
if (cc < 0) {
- emsg = fxStr::format("Data Connection: %s", strerror(errno));
+ emsg = fxStr::format(_("Data Connection: %s"), strerror(errno));
(void) getReply(false);
break;
}
}
}
if (getNumberOfJobs() == 0) {
- fprintf(stderr, "%s: No destination specified.\n",
+ fprintf(stderr, _("%s: No destination specified.\n"),
(const char*) appName);
usage();
}
if (!optionsUsed) {
- fprintf(stderr, "%s: Unused options after last destination.\n",
+ fprintf(stderr, _("%s: Unused options after last destination.\n"),
(const char*) appName);
usage();
}
&& submitJobs(emsg);
if (status && waitForJob) {
if (getNumberOfJobs() > 1) {
- printWarning("can only wait for one job (right now),"
- " waiting for job %s.", (const char*) getCurrentJob());
+ printWarning(_("can only wait for one job (right now),"
+ " waiting for job %s."), (const char*) getCurrentJob());
}
jobWait(getCurrentJob());
}
void
sendFaxApp::usage()
{
- fxFatal("usage: %s [options] [files]\n"
- "(Read the manual page; it's too complicated)", (const char*) appName);
+ fxFatal(_("usage: %s [options] [files]\n"
+ "(Read the manual page; it's too complicated)"), (const char*) appName);
}
/*
}
}
if (dest.length() == 0) {
- fatal("Null destination for \"%s\"", cp);
+ fatal(_("Null destination for \"%s\""), cp);
}
SendFaxJob& job = addJob();
job.setDialString(dest);
job.setCoverName(recipient);
job.setSubAddress(subaddress);
if(job.getDesiredSpeed() > BR_14400 && job.getDesiredEC() == false) {
- printWarning("ECM disabled, limiting job to 14400 bps.");
+ printWarning(_("ECM disabled, limiting job to 14400 bps."));
job.setDesiredSpeed(BR_14400);
}
}
addDestination(dest);
}
} else {
- fatal("%s: no such file", filename);
+ fatal(_("%s: no such file"), filename);
}
}
tmpl = buff;
delete [] buff;
if (fd < 0) {
- fatal("%s: Can not create temporary file", (const char*) tmpl);
+ fatal(_("%s: Can not create temporary file"), (const char*) tmpl);
}
int cc, total = 0;
char buf[16*1024];
while ((cc = Sys::read(fin, buf, sizeof (buf))) > 0) {
if (Sys::write(fd, buf, cc) != cc) {
Sys::unlink(tmpl);
- fatal("%s: write error", (const char*) tmpl);
+ fatal(_("%s: write error"), (const char*) tmpl);
}
total += cc;
}
if (total == 0) {
Sys::unlink(tmpl);
tmpl = "";
- fatal("No input data; tranmission aborted");
+ fatal(_("No input data; transmission aborted"));
}
}
switch (c) {
case 'a': // time at which to transmit page
if (!proto.setHoldTime(optarg, emsg)) {
- printError("Invalid hold time \"%s\": %s",
+ printError(_("Invalid hold time \"%s\": %s"),
optarg, (const char*) emsg);
exit(-1);
}
}
if (getNumberOfJobs() == 0) {
- fprintf(stderr, "%s: No pager identification number (PIN) specified.\n",
+ fprintf(stderr, _("%s: No pager identification number (PIN) specified.\n"),
(const char*) appName);
usage();
}
void
sendPageApp::usage()
{
- fxFatal("usage: %s"
+ fxFatal(_("usage: %s"
" -p PIN [-p PIN ...]\n"
" [-a time-to-send]"
" [-l service-level]"
" [-t max-tries]"
" [-T max-dials]"
" [-nqvDNR]"
- " [msgs ...]",
+ " [msgs ...]"),
(const char*) appName);
}
}
Sys::close(fd);
} else
- fatal("%s: Can not create temporary file", (const char*) tmpl);
+ fatal(_("%s: Can not create temporary file"), (const char*) tmpl);
}
void
if (isdigit(cp[1]) && isdigit(cp[2])) {
int min = 10*(cp[1]-'0') + (cp[2]-'0');
if (min >= 60) {
- _atError(emsg, "Illegal minutes value %u", min);
+ _atError(emsg, _("Illegal minutes value %u"), min);
return (false);
}
v += min;
cp += 3;
} else {
- _atSyntax(emsg, "expecting HH:MM");
+ _atSyntax(emsg, _("expecting HH:MM"));
return (false);
}
}
cp = whitespace(cp);
if (streq(cp, "am", 2)) {
if (v >= HALFDAY+HOUR) {
- _atError(emsg, "%u:%02u is not an AM value", v/HOUR, v%HOUR);
+ _atError(emsg, _("%u:%02u is not an AM value"), v/HOUR, v%HOUR);
return (false);
}
if (HALFDAY <= v && v < HALFDAY+HOUR)
cp += 2;
} else if (streq(cp, "pm", 2)) {
if (v >= HALFDAY+HOUR) {
- _atError(emsg, "%u:%02u is not a PM value", v/HOUR, v%HOUR);
+ _atError(emsg, _("%u:%02u is not a PM value"), v/HOUR, v%HOUR);
return (false);
}
if (v < HALFDAY)
v = at.tm_hour*HOUR + at.tm_min;
cp += 4;
} else {
- _atSyntax(emsg, "unrecognized symbolic time \"%s\"", cp);
+ _atSyntax(emsg, _("unrecognized symbolic time \"%s\""), cp);
return (false);
}
}
if ((unsigned) v >= FULLDAY) {
- _atError(emsg, "Illegal time value; out of range");
+ _atError(emsg, _("Illegal time value; out of range"));
return (false);
}
at.tm_hour = v/HOUR;
at.tm_yday++;
cp += 8;
} else if (cp[0] != '\0' && cp[0] != '+') {
- _atSyntax(emsg, "expecting \"+\" after time");
+ _atSyntax(emsg, _("expecting \"+\" after time"));
return (false);
}
/*
return (false);
fixup(at);
if (at < ref) {
- _atError(emsg, "Invalid date/time; time must be in the future");
+ _atError(emsg, _("Invalid date/time; time must be in the future"));
return (false);
}
at0 = at;
char* tp;
at.tm_mday = (u_int) strtoul(cp, &tp, 10);
if (tp == cp) {
- _atSyntax(emsg, "missing or invalid day of month");
+ _atSyntax(emsg, _("missing or invalid day of month"));
return (false);
}
at.tm_mday--; // tm_mday is [0..31]
char* xp;
u_int year = (u_int) strtoul(++tp, &xp, 10);
if (tp == xp) {
- _atSyntax(emsg, "missing year");
+ _atSyntax(emsg, _("missing year"));
return (false);
}
if (year < TM_YEAR_BASE) {
- _atError(emsg, "Sorry, cannot handle dates before %u",
+ _atError(emsg, _("Sorry, cannot handle dates before %u"),
TM_YEAR_BASE);
return (false);
}
}
const int* days = daysInMonth[isLeapYear(at)];
if (at.tm_mday > days[at.tm_mon]) {
- _atError(emsg, "Invalid day of month, %s has only %u days",
+ _atError(emsg, _("Invalid day of month, %s has only %u days"),
months[at.tm_mon], days[at.tm_mon]);
return (false);
}
{
cp = whitespace(cp);
if (!isdigit(cp[0])) {
- _atSyntax(emsg, "expecting number after \"+\"");
+ _atSyntax(emsg, _("expecting number after \"+\""));
return (false);
}
int v = 0;
v = v*10 + (*cp - '0');
cp = whitespace(cp);
if (*cp == '\0') {
- _atSyntax(emsg, "\"+%u\" without unit", v);
+ _atSyntax(emsg, _("\"+%u\" without unit"), v);
return (false);
}
if (streq(cp, "minute", 6))
} else if (streq(cp, "year", 4))
at.tm_year += v;
else {
- _atError(emsg, "Unknown increment unit \"%s\"", cp);
+ _atError(emsg, _("Unknown increment unit \"%s\""), cp);
return (false);
}
return (true);
{
va_list ap;
va_start(ap, fmt);
- emsg = "Syntax error, " | fxStr::vformat(fmt, ap);
+ emsg = _("Syntax error, ") | fxStr::vformat(fmt, ap);
va_end(ap);
}
* Routines for printing some Class 2 capabilities.
*/
const char* Class2Params::verticalResNames[65] = {
- "3.85 line/mm",
- "7.7 line/mm",
- "15.4 line/mm", "",
- "R16 x 15.4 line/mm", "", "", "",
- "200 x 100 dpi", "", "", "", "", "", "", "",
- "200 x 200 dpi", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "200 x 400 dpi", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
- "300 x 300 dpi"
+ N_("3.85 line/mm"),
+ N_("7.7 line/mm"),
+ N_("15.4 line/mm"), "",
+ N_("R16 x 15.4 line/mm"), "", "", "",
+ N_("200 x 100 dpi"), "", "", "", "", "", "", "",
+ N_("200 x 200 dpi"), "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ N_("200 x 400 dpi"), "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ N_("300 x 300 dpi")
};
const char* Class2Params::verticalResName() const
const char* Class2Params::bitRateNames[16] = {
- "2400 bit/s", // BR_2400
- "4800 bit/s", // BR_4800
- "7200 bit/s", // BR_7200
- "9600 bit/s", // BR_9600
- "12000 bit/s", // BR_12000
- "14400 bit/s", // BR_14400
- "16800 bit/s", // BR_16800
- "19200 bit/s", // BR_19200
- "21600 bit/s", // BR_21600
- "24000 bit/s", // BR_24000
- "26400 bit/s", // BR_26400
- "28800 bit/s", // BR_28800
- "31200 bit/s", // BR_31200
- "33600 bit/s", // BR_33600
- "0 bit/s", // 14 ???
- "0 bit/s", // 15 ???
+ N_("2400 bit/s"), // BR_2400
+ N_("4800 bit/s"), // BR_4800
+ N_("7200 bit/s"), // BR_7200
+ N_("9600 bit/s"), // BR_9600
+ N_("12000 bit/s"), // BR_12000
+ N_("14400 bit/s"), // BR_14400
+ N_("16800 bit/s"), // BR_16800
+ N_("19200 bit/s"), // BR_19200
+ N_("21600 bit/s"), // BR_21600
+ N_("24000 bit/s"), // BR_24000
+ N_("26400 bit/s"), // BR_26400
+ N_("28800 bit/s"), // BR_28800
+ N_("31200 bit/s"), // BR_31200
+ N_("33600 bit/s"), // BR_33600
+ N_("0 bit/s"), // 14 ???
+ N_("0 bit/s"), // 15 ???
};
const char* Class2Params::bitRateName() const
{ return (bitRateNames[br&15]); }
}
const char* Class2Params::dataFormatNames[7] = {
- "1-D MH", // DF_1DMH
- "2-D MR", // DF_2DMR
- "2-D Uncompressed Mode", // DF_2DMRUNCOMP
- "2-D MMR", // DF_2DMMR
- "JBIG", // DF_JBIG
- "JPEG Greyscale", // JP_GREY
- "JPEG Full-Color" // JP_COLOR
+ N_("1-D MH"), // DF_1DMH
+ N_("2-D MR"), // DF_2DMR
+ N_("2-D Uncompressed Mode"), // DF_2DMRUNCOMP
+ N_("2-D MMR"), // DF_2DMMR
+ N_("JBIG"), // DF_JBIG
+ N_("JPEG Greyscale"), // JP_GREY
+ N_("JPEG Full-Color") // JP_COLOR
};
const char* Class2Params::dataFormatName() const
{ return (dataFormatNames[df+(jp > 0 && jp < (u_int) -1 ? jp + 4 : 0)]); }
fxStr
Class2Params::dataFormatsName()
{
- fxStr formats = "MH";
- if (df & BIT(DF_2DMR)) formats.append(", MR");
- if (df & BIT(DF_2DMMR)) formats.append(", MMR");
- if (df & BIT(DF_JBIG)) formats.append(", JBIG");
+ fxStr formats = N_("MH");
+ if (df & BIT(DF_2DMR)) formats.append(N_(", MR"));
+ if (df & BIT(DF_2DMMR)) formats.append(N_(", MMR"));
+ if (df & BIT(DF_JBIG)) formats.append(N_(", JBIG"));
// since color requires greyscale, just say one or the other
- if (jp & BIT(JP_COLOR)) formats.append(", JPEG Full-Color");
- else if (jp & BIT(JP_GREY)) formats.append(", JPEG Greyscale");
+ if (jp & BIT(JP_COLOR)) formats.append(N_(", JPEG Full-Color"));
+ else if (jp & BIT(JP_GREY)) formats.append(N_(", JPEG Greyscale"));
return (formats);
}
const char* Class2Params::pageWidthNames[8] = {
- "A4 page width (215 mm)",
- "B4 page width (255 mm)",
- "A3 page width (303 mm)",
- "page width 151 mm",
- "page width 107 mm",
- "undefined page width (wd=5)",
- "undefined page width (wd=6)",
- "undefined page width (wd=7)",
+ N_("A4 page width (215 mm)"),
+ N_("B4 page width (255 mm)"),
+ N_("A3 page width (303 mm)"),
+ N_("page width 151 mm"),
+ N_("page width 107 mm"),
+ N_("undefined page width (wd=5)"),
+ N_("undefined page width (wd=6)"),
+ N_("undefined page width (wd=7)"),
};
const char* Class2Params::pageWidthName() const
{ return (pageWidthNames[wd&7]); }
const char* Class2Params::pageLengthNames[4] = {
- "A4 page length (297 mm)",
- "B4 page length (364 mm)",
- "unlimited page length",
- "invalid page length (ln=3)",
+ N_("A4 page length (297 mm)"),
+ N_("B4 page length (364 mm)"),
+ N_("unlimited page length"),
+ N_("invalid page length (ln=3)"),
};
const char* Class2Params::pageLengthName() const
{ return (pageLengthNames[ln&3]); }
const char* Class2Params::scanlineTimeNames[8] = {
- "0 ms/scanline",
- "5 ms/scanline",
- "10 ms, 5 ms/scanline",
- "10 ms/scanline",
- "20 ms, 10 ms/scanline",
- "20 ms/scanline",
- "40 ms, 20 ms/scanline",
- "40 ms/scanline",
+ N_("0 ms/scanline"),
+ N_("5 ms/scanline"),
+ N_("10 ms, 5 ms/scanline"),
+ N_("10 ms/scanline"),
+ N_("20 ms, 10 ms/scanline"),
+ N_("20 ms/scanline"),
+ N_("40 ms, 20 ms/scanline"),
+ N_("40 ms/scanline"),
};
const char* Class2Params::scanlineTimeName() const
{ return (scanlineTimeNames[st&7]); }
const char* Class2Params::ecmNames[8] = {
- "no ECM",
- "T.30 Annex A, 64-byte ECM",
- "T.30 Annex A, 256-byte ECM",
- "T.30 Annex C, half duplex ECM",
- "T.30 Annex C, full duplex ECM",
- "undefined ECM",
- "undefined ECM",
- "undefined ECM"
+ N_("no ECM"),
+ N_("T.30 Annex A, 64-byte ECM"),
+ N_("T.30 Annex A, 256-byte ECM"),
+ N_("T.30 Annex C, half duplex ECM"),
+ N_("T.30 Annex C, full duplex ECM"),
+ N_("undefined ECM"),
+ N_("undefined ECM"),
+ N_("undefined ECM")
};
const char* Class2Params::ecmName() const
{ return (ecmNames[ec&7]); }
ok = parseRules();
fclose(fp);
} else if (shouldExist)
- parseError("Cannot open file \"%s\" for reading",
+ parseError(_("Cannot open file \"%s\" for reading"),
(const char*) filename);
return (ok);
}
DialStringRules::def(const fxStr& var, const fxStr& value)
{
if (verbose)
- traceParse("Define %s = \"%s\"",
+ traceParse(_("Define %s = \"%s\""),
(const char*) var, (const char*) value);
(*vars)[var] = value;
}
DialStringRules::undef(const fxStr& var)
{
if (verbose)
- traceParse("Undefine %s", (const char*) var);
+ traceParse(_("Undefine %s"), (const char*) var);
vars->remove(var);
}
while ((cp = nextLine(line, sizeof (line)))) {
// collect token
if (!isalpha(*cp)) {
- parseError("Syntax error, expecting identifier");
+ parseError(_("Syntax error, expecting identifier"));
return (false);
}
const char* tp = cp;
if (*cp == ':' && cp[1] == '=') { // rule set definition
for (cp += 2; *cp != '['; cp++)
if (*cp == '\0') {
- parseError("Missing '[' while parsing rule set");
+ parseError(_("Missing '[' while parsing rule set"));
return (false);
}
if (verbose)
return (false);
def(var, value);
} else { // an error
- parseError("Missing '=' or ':=' after \"%s\"", (const char*) var);
+ parseError(_("Missing '=' or ':=' after \"%s\""), (const char*) var);
return (false);
}
}
if (verbose) {
RuleArray* ra = (*rules)["CanonicalNumber"];
if (ra == 0)
- traceParse("Warning, no \"CanonicalNumber\" rules.");
+ traceParse(_("Warning, no \"CanonicalNumber\" rules."));
ra = (*rules)["DialString"];
if (ra == 0)
- traceParse("Warning, no \"DialString\" rules.");
+ traceParse(_("Warning, no \"DialString\" rules."));
}
return (true);
}
tp = ++cp;
for (;;) {
if (*cp == '\0') {
- parseError("String with unmatched '\"'");
+ parseError(_("String with unmatched '\"'"));
return (NULL);
}
if (*cp == '\\' && cp[1] == '\0') {
- parseError("Bad '\\' escape sequence");
+ parseError(_("Bad '\\' escape sequence"));
return (NULL);
}
if (*cp == '"' && (cp == tp || cp[-1] != '\\'))
} else { // token terminated by white space
for (tp = cp; *cp != '\0'; cp++) {
if (*cp == '\\' && cp[1] == '\0') {
- parseError("Bad '\\' escape sequence");
+ parseError(_("Bad '\\' escape sequence"));
return (NULL);
}
if (isspace(*cp) && (cp == tp || cp[-1] != '\\'))
*/
u_int l = v.next(i, '}');
if (l >= v.length()) {
- parseError("Missing '}' for variable reference");
+ parseError(_("Missing '}' for variable reference"));
return (NULL);
}
fxStr var = v.cut(i+2,l-(i+2));// variable name
char line[1024];
const char* cp = nextLine(line, sizeof (line));
if (!cp) {
- parseError("Missing ']' while parsing rule set");
+ parseError(_("Missing ']' while parsing rule set"));
return (false);
}
if (*cp == ']')
while (isspace(*cp))
cp++;
if (*cp != '=') {
- parseError("Rule pattern without '='");
+ parseError(_("Rule pattern without '='"));
return (false);
}
DialRule r;
DialStringRules::applyRules(const fxStr& name, const fxStr& s)
{
if (verbose)
- traceRules("Apply %s rules to \"%s\"",
+ traceRules(_("Apply %s rules to \"%s\""),
(const char*) name, (const char*) s);
fxStr result(s);
RuleArray* ra = (*rules)[name];
result.insert(replace, ix);
off = ix + replace.length(); // skip replace when searching
if (verbose)
- traceRules("--> match rule \"%s\", result now \"%s\"",
+ traceRules(_("--> match rule \"%s\", result now \"%s\""),
rule.pat->pattern(), (const char*) result);
}
}
}
if (verbose)
- traceRules("--> return result \"%s\"", (const char*) result);
+ traceRules(_("--> return result \"%s\""), (const char*) result);
return result;
}
{
va_list ap;
va_start(ap, fmt);
- fprintf(stderr, "%s: line %u: ", (const char*) filename, lineno);
+ fprintf(stderr, _("%s: line %u: "), (const char*) filename, lineno);
vfprintf(stderr, fmt, ap);
va_end(ap);
putc('\n', stderr);
{
va_list ap;
va_start(ap, fmt);
- fprintf(stdout, "%s: line %u: ", (const char*) filename, lineno);
+ fprintf(stdout, _("%s: line %u: "), (const char*) filename, lineno);
vfprintf(stdout, fmt, ap);
va_end(ap);
putc('\n', stdout);
void
FaxClient::vprintWarning(const char* fmt, va_list ap)
{
- fprintf(stderr, "Warning, ");
+ fprintf(stderr, _("Warning, "));
vfprintf(stderr, fmt, ap);
fputs("\n", stderr);
}
if (name)
userName = name;
else {
- emsg = fxStr::format("Can not locate your password entry "
- "(uid %lu): %s", (u_long) getuid(), strerror(errno));
+ emsg = fxStr::format(_("Can not locate your password entry "
+ "(uid %lu): %s"), (u_long) getuid(), strerror(errno));
return (false);
}
}
} else
senderName = userName;
if (senderName.length() == 0) {
- emsg = "Bad (null) user name; your password file entry"
- " probably has bogus GECOS field information.";
+ emsg = _("Bad (null) user name; your password file entry"
+ " probably has bogus GECOS field information.");
return (false);
} else
return (true);
user = userName;
}
if (*user == '\0') {
- emsg = "Malformed (null) username";
+ emsg = _("Malformed (null) username");
return (false);
}
int n = command("USER %s", user);
}
return (true);
} else {
- emsg = "Login failed: " | lastResponse;
+ emsg = _("Login failed: ") | lastResponse;
return (false);
}
}
FaxClient::admin(const char* pass, fxStr& emsg)
{
if (command("ADMIN %s", pass ? pass : getpass("Password:")) != COMPLETE) {
- emsg = "Admin failed: " | lastResponse;
+ emsg = _("Admin failed: ") | lastResponse;
return (false);
} else
return (true);
return (false);
}
} else {
- printError("Bad %s parameter value %u.", parm.cmd, v);
+ printError(_("Bad %s parameter value %u."), parm.cmd, v);
return (false);
}
this->*parm.pv = v;
if (v == TZ_GMT) state &= ~FS_TZPEND;
else state |= FS_TZPEND;
} else {
- printError("Bad time zone parameter value %u.", v);
+ printError(_("Bad time zone parameter value %u."), v);
return (false);
}
return (true);
if (transport) {
if (!transport->initDataConn(emsg)) {
if (emsg == "") {
- emsg = "Unable to initialize data connection to server";
+ emsg = _("Unable to initialize data connection to server");
}
return (false);
}
if (transport) {
if (!transport->openDataConn(emsg)) {
if (emsg == "") {
- emsg = "Unable to open data connection to server";
+ emsg = _("Unable to open data connection to server");
}
return (false);
}
fflush(fdOut);
if (!transport->abortCmd(emsg)) {
if (emsg == "") {
- emsg = "Unable to abort data connection to server";
+ emsg = _("Unable to abort data connection to server");
}
return (false);
}
void
FaxClient::lostServer(void)
{
- printError("Service not available, remote server closed connection");
+ printError(_("Service not available, remote server closed connection"));
hangupServer();
}
void
FaxClient::unexpectedResponse(fxStr& emsg)
{
- emsg = "Unexpected server response: " | lastResponse;
+ emsg = _("Unexpected server response: ") | lastResponse;
}
void
{
va_list ap;
va_start(ap, fmt);
- emsg = "Protocol botch" | fxStr::vformat(fmt, ap);
+ emsg = _("Protocol botch") | fxStr::vformat(fmt, ap);
va_end(ap);
}
} else {
line = (char *)malloc(100);
if (line == NULL)
- printError("Memory allocation failed");
+ printError(_("Memory allocation failed"));
else {
vsnprintf(line, 100, fmt, ap);
traceServer("-> %s", line);
}
}
if (fdOut == NULL) {
- printError("No control connection for command");
+ printError(_("No control connection for command"));
code = -1;
return (0);
}
l = lastResponse.find(pos, pat);
}
if (l == lastResponse.length()) {
- protocolBotch(emsg, ": No \"%s\" in %s response: %s",
+ protocolBotch(emsg, _(": No \"%s\" in %s response: %s"),
pattern, cmd, (const char*) lastResponse);
return false;
}
l = lastResponse.skip(l+pat.length(), ' ');// skip white space
result = lastResponse.extract(l, lastResponse.next(l, ' ')-l);
if (result == "") {
- protocolBotch(emsg, ": Null %s in %s response: %s",
+ protocolBotch(emsg, _(": Null %s in %s response: %s"),
pattern, cmd, (const char*) lastResponse);
return false;
}
ok = runScript(fd, filename, emsg);
fclose(fd);
} else
- emsg = fxStr::format("Unable to open script file \"%s\".", filename);
+ emsg = fxStr::format(_("Unable to open script file \"%s\"."), filename);
return (ok);
}
if (Sys::read(fileno(fp), addr, (u_int) sb.st_size) == sb.st_size)
ok = runScript(addr, sb.st_size, filename, emsg);
else
- emsg = fxStr::format("%s: Read error: %s",
+ emsg = fxStr::format(_("%s: Read error: %s"),
filename, strerror(errno));
delete [] addr;
#if HAS_MMAP
u_int cmdLen = ep-script;
if (cmdLen > 1) {
if (command("%.*s", cmdLen, script) != COMPLETE) {
- emsg = fxStr::format("%s: line %u: %s",
+ emsg = fxStr::format(_("%s: line %u: %s"),
filename, lineno, (const char*) lastResponse);
return (false);
}
for (int cnt, sent = 0; cc; sent += cnt, cc -= cnt)
if ((cnt = write(fdData, bp + sent, cc)) <= 0) {
protocolBotch(emsg, errno == EPIPE ?
- " (server closed connection)" : " (server write error: %s).",
+ _(" (server closed connection)") : _(" (server write error: %s)."),
strerror(errno));
return (false);
}
#else
if (write(fdData, buf, cc) != cc) {
protocolBotch(emsg, errno == EPIPE ?
- " (server closed connection)" : " (server write error: %s).",
+ _(" (server closed connection)") : _(" (server write error: %s)."),
strerror(errno));
return (false);
}
size_t cc;
(void) Sys::fstat(fd, sb);
if (getVerbose())
- traceServer("SEND data, %lu bytes", (u_long) sb.st_size);
+ traceServer(_("SEND data, %lu bytes"), (u_long) sb.st_size);
if (!initDataConn(emsg))
goto bad;
if (!setMode(MODE_S))
char buf[32*1024]; // XXX better if page-aligned
size_t n = fxmin(cc, sizeof (buf));
if (read(fd, buf, n) != (ssize_t)n) {
- protocolBotch(emsg, " (data read: %s).", strerror(errno));
+ protocolBotch(emsg, _(" (data read: %s)."), strerror(errno));
goto bad;
}
if (!sendRawData(buf, n, emsg))
size_t cc;
Sys::fstat(fd, sb);
if (getVerbose())
- traceServer("SEND compressed data, %lu bytes", (u_long) sb.st_size);
+ traceServer(_("SEND compressed data, %lu bytes"), (u_long) sb.st_size);
if (!initDataConn(emsg))
goto bad;
if (!setMode(MODE_Z))
char buf[32*1024];
int n = fxmin((size_t) cc, sizeof (buf));
if (read(fd, buf, n) != n) {
- protocolBotch(emsg, " (data read: %s)", strerror(errno));
+ protocolBotch(emsg, _(" (data read: %s)"), strerror(errno));
goto bad;
}
zstream.next_in = (Bytef*) buf;
zstream.avail_in = n;
do {
if (deflate(&zstream, Z_NO_FLUSH) != Z_OK) {
- emsg = fxStr::format("zlib compressor error: %s",
+ emsg = fxStr::format(_("zlib compressor error: %s"),
zstream.msg);
goto bad;
}
zstream.avail_in = (u_int) sb.st_size;
do {
if (deflate(&zstream, Z_NO_FLUSH) != Z_OK) {
- emsg = fxStr::format("zlib compressor error: %s",
+ emsg = fxStr::format(_("zlib compressor error: %s"),
zstream.msg);
goto bad;
}
}
break;
default:
- emsg = fxStr::format("zlib compressor error: %s",
+ emsg = fxStr::format(_("zlib compressor error: %s"),
zstream.msg);
goto bad;
}
} while (dstate != Z_STREAM_END);
if (getVerbose())
- traceServer("SEND %lu bytes transmitted (%.1fx compression)",
+ traceServer(_("SEND %lu bytes transmitted (%.1fx compression)"),
#define NZ(x) ((x)?(x):1)
zstream.total_out, float(sb.st_size) / NZ(zstream.total_out));
closeDataConn();
#endif
deflateEnd(&zstream);
} else
- emsg = fxStr::format("Can not initialize compression library: %s",
+ emsg = fxStr::format(_("Can not initialize compression library: %s"),
zstream.msg);
return (false);
}
return (getReply(false) == COMPLETE);
}
if (cc < 0) {
- emsg = fxStr::format("Data Connection: %s", strerror(errno));
+ emsg = fxStr::format(_("Data Connection: %s"), strerror(errno));
(void) getReply(false);
break;
}
return (getReply(false) == COMPLETE);
}
if (cc < 0) {
- emsg = fxStr::format("Data Connection: %s", strerror(errno));
+ emsg = fxStr::format(_("Data Connection: %s"), strerror(errno));
(void) getReply(false);
goto bad;
}
if (dstate == Z_STREAM_END)
break;
if (dstate != Z_OK) {
- emsg = fxStr::format("Decoding error: %s", zstream.msg);
+ emsg = fxStr::format(_("Decoding error: %s"), zstream.msg);
goto bad;
}
size_t occ = sizeof (obuf) - zstream.avail_out;
closeDataConn();
inflateEnd(&zstream);
} else
- emsg = fxStr::format("Can not initialize decoder: %s", zstream.msg);
+ emsg = fxStr::format(_("Can not initialize decoder: %s"), zstream.msg);
return (false);
}
if (fspec[1] == '-') // left justify
width = -width;
if (width == 0 && prec == 0)
- header.append(hp->title);
+ header.append(_(hp->title));
else
- header.append(fxStr::format("%*.*s", width, prec, hp->title));
+ header.append(fxStr::format("%*.*s", width, prec, _(hp->title)));
} else {
*fp++ = c;
header.append(fxStr(fspec, fp-fspec));
* queue status listings returned by the server.
*/
const FaxClient::FaxFmtHeader FaxClient::jobFormats[] = {
- { 'A', "SUB" }, // A (subaddr)
- { 'B', "PWD" }, // B (passwd)
- { 'C', "Company" }, // C (company)
- { 'D', "Dials" }, // D (totdials & maxdials)
- { 'E', "BR" }, // E (desiredbr)
- { 'F', "Tagline" }, // F (tagline)
- { 'G', "ST" }, // G (desiredst)
- { 'H', "DF" }, // H (desireddf)
- { 'I', "UsrPri" }, // I (usrpri)
- { 'J', "JobTag" }, // J (jobtag)
- { 'K', "EC" }, // K (desiredec as symbol)
- { 'L', "Location" }, // L (location)
- { 'M', "MailAddr" }, // M (mailaddr)
- { 'N', "DT" }, // N (desiredtl as symbol)
- { 'O', "CC" }, // O (useccover as symbol)
- { 'P', "Pages" }, // P (npages & totpages)
- { 'Q', "MinSP" }, // Q (minsp)
- { 'R', "Receiver" }, // R (receiver)
- { 'S', "Sender" }, // S (sender)
- { 'T', "Tries" }, // T (tottries & maxtries)
- { 'U', "ChopThreshold" },// U (chopthreshold)
- { 'V', "DoneOp" }, // V (doneop)
- { 'W', "CommID" }, // W (commid)
- { 'X', "JobType" }, // X (jobtype)
- { 'Y', "Date Time" }, // Y (date & time)
- { 'Z', "UNIX Time" }, // Z (seconds since the UNIX epoch)
- { 'a', "State" }, // a (job state as symbol)
- { 'b', "NTries" }, // b (ntries)
- { 'c', "Client" }, // c (client)
- { 'd', "TotDials" }, // d (totdials)
- { 'e', "Number" }, // e (external)
- { 'f', "NDials" }, // f (ndials)
- { 'g', "GID" }, // g (groupid)
- { 'h', "Chop" }, // h (pagechop as symbol)
- { 'i', "Priority" }, // i (pri)
- { 'j', "JID" }, // j (jobid)
- { 'k', "LastTime" }, // k (killtime)
- { 'l', "PageLength" }, // l (pagelength)
- { 'm', "Modem" }, // m (modem)
- { 'n', "Notify" }, // n (notify as symbol)
- { 'o', "Owner" }, // o (owner)
- { 'p', "Pages" }, // p (npages)
- { 'q', "RetryTime" }, // q (retrytime as MM:SS)
- { 'r', "Resolution" }, // r (resolution)
- { 's', "Status" }, // s (notice a.k.a. status)
- { 't', "TotTries" }, // t (tottries)
- { 'u', "MaxTries" }, // u (maxtries)
- { 'v', "DialString" }, // v (number a.ka. dialstring)
- { 'w', "PageWidth" }, // w (pagewidth)
- { 'x', "MaxDials" }, // x (maxdials)
- { 'y', "TotPages" }, // y (totpages)
- { 'z', "TTS" }, // z (tts)
- { '0', "UseXVres" }, // 0 (usexvres as symbol)
+ { 'A', N_("SUB") }, // A (subaddr)
+ { 'B', N_("PWD") }, // B (passwd)
+ { 'C', N_("Company") }, // C (company)
+ { 'D', N_("Dials") }, // D (totdials & maxdials)
+ { 'E', N_("BR") }, // E (desiredbr)
+ { 'F', N_("Tagline") }, // F (tagline)
+ { 'G', N_("ST") }, // G (desiredst)
+ { 'H', N_("DF") }, // H (desireddf)
+ { 'I', N_("UsrPri") }, // I (usrpri)
+ { 'J', N_("JobTag") }, // J (jobtag)
+ { 'K', N_("EC") }, // K (desiredec as symbol)
+ { 'L', N_("Location") }, // L (location)
+ { 'M', N_("MailAddr") }, // M (mailaddr)
+ { 'N', N_("DT") }, // N (desiredtl as symbol)
+ { 'O', N_("CC") }, // O (useccover as symbol)
+ { 'P', N_("Pages") }, // P (npages & totpages)
+ { 'Q', N_("MinSP") }, // Q (minsp)
+ { 'R', N_("Receiver") }, // R (receiver)
+ { 'S', N_("Sender") }, // S (sender)
+ { 'T', N_("Tries") }, // T (tottries & maxtries)
+ { 'U', N_("ChopThreshold") }, // U (chopthreshold)
+ { 'V', N_("DoneOp") }, // V (doneop)
+ { 'W', N_("CommID") }, // W (commid)
+ { 'X', N_("JobType") }, // X (jobtype)
+ { 'Y', N_("Date Time") },// Y (date & time)
+ { 'Z', N_("UNIX Time") }, // Z (seconds since the UNIX epoch)
+ { 'a', N_("State") }, // a (job state as symbol)
+ { 'b', N_("NTries") }, // b (ntries)
+ { 'c', N_("Client") }, // c (client)
+ { 'd', N_("TotDials") }, // d (totdials)
+ { 'e', N_("Number") }, // e (external)
+ { 'f', N_("NDials") }, // f (ndials)
+ { 'g', N_("GID") }, // g (groupid)
+ { 'h', N_("Chop") }, // h (pagechop as symbol)
+ { 'i', N_("Priority") }, // i (pri)
+ { 'j', N_("JID") }, // j (jobid)
+ { 'k', N_("LastTime") }, // k (killtime)
+ { 'l', N_("PageLength") }, // l (pagelength)
+ { 'm', N_("Modem") }, // m (modem)
+ { 'n', N_("Notify") }, // n (notify as symbol)
+ { 'o', N_("Owner") }, // o (owner)
+ { 'p', N_("Pages") }, // p (npages)
+ { 'q', N_("RetryTime") }, // q (retrytime as MM:SS)
+ { 'r', N_("Resolution") }, // r (resolution)
+ { 's', N_("Status") }, // s (notice a.k.a. status)
+ { 't', N_("TotTries") }, // t (tottries)
+ { 'u', N_("MaxTries") }, // u (maxtries)
+ { 'v', N_("DialString") }, // v (number a.ka. dialstring)
+ { 'w', N_("PageWidth") }, // w (pagewidth)
+ { 'x', N_("MaxDials") }, // x (maxdials)
+ { 'y', N_("TotPages") }, // y (totpages)
+ { 'z', N_("TTS") }, // z (tts)
+ { '0', N_("UseXVres") }, // 0 (usexvres as symbol)
{ '\0' },
};
void FaxClient::getJobStatusHeader(fxStr& header)
* queue status listings returned by the server.
*/
const FaxClient::FaxFmtHeader FaxClient::recvFormats[] = {
- { 'Y', "Date Time" }, // Y (date & time)
- { 'a', "SUB" }, // a (subaddress)
- { 'b', "BR" }, // b (bitrate)
- { 'd', "DF" }, // d (data format)
- { 'e', "Error" }, // e (error description)
- { 'f', "Filename" }, // f (filename)
- { 'h', "Time" }, // h (time spent receiving)
- { 'i', "CIDName" }, // i (caller id name)
- { 'j', "CIDNumber" }, // j (caller id number)
- { 'l', "Length" }, // l (pagelength)
- { 'm', "Protect" }, // m (fax-style protection mode, no group bits)
- { 'n', "Size" }, // n (file size)
- { 'o', "Owner" }, // o (owner)
- { 'p', "Pages" }, // p (npages)
- { 'q', "Protect" }, // m (UNIX-style protection mode)
- { 'r', "Resolution" }, // r (resolution)
- { 's', "Sender/TSI" }, // s (sender TSI)
- { 't', "Recvd@" }, // t (time received)
- { 'w', "Width" }, // w (pagewidth)
- { 'z', " " }, // z (``*'' if being received)
+ { 'Y', N_("Date Time") },// Y (date & time)
+ { 'a', N_("SUB") }, // a (subaddress)
+ { 'b', N_("BR") }, // b (bitrate)
+ { 'd', N_("DF") }, // d (data format)
+ { 'e', N_("Error") }, // e (error description)
+ { 'f', N_("Filename") }, // f (filename)
+ { 'h', N_("Time") }, // h (time spent receiving)
+ { 'i', N_("CIDName") }, // i (caller id name)
+ { 'j', N_("CIDNumber") }, // j (caller id number)
+ { 'l', N_("Length") }, // l (pagelength)
+ { 'm', N_("Protect") }, // m (fax-style protection mode, no group bits)
+ { 'n', N_("Size") }, // n (file size)
+ { 'o', N_("Owner") }, // o (owner)
+ { 'p', N_("Pages") }, // p (npages)
+ { 'q', N_("Protect") }, // m (UNIX-style protection mode)
+ { 'r', N_("Resolution") }, // r (resolution)
+ { 's', N_("Sender/TSI") }, // s (sender TSI)
+ { 't', N_("Recvd@") }, // t (time received)
+ { 'w', N_("Width") }, // w (pagewidth)
+ { 'z', " " }, // z (``*'' if being received)
{ '\0' },
};
void FaxClient::getRecvStatusHeader(fxStr& header)
* status listings returned by the server.
*/
const FaxClient::FaxFmtHeader FaxClient::modemFormats[] = {
- { 'h', "Host" }, // h (hostname)
- { 'l', "LocalID" }, // l (local identifier)
- { 'm', "Modem" }, // m (canonical modem name)
- { 'n', "Number" }, // n (fax phone number)
- { 'r', "MaxRecv" }, // r (max recv pages)
- { 's', "Status" }, // s (status information)
- { 't', "Tracing" }, // t (server:session tracing level)
- { 'v', "Speaker" }, // v (speaker volume as symbol)
- { 'z', " " }, // z (``*'' if faxgetty is running)
+ { 'h', N_("Host") }, // h (hostname)
+ { 'l', N_("LocalID") }, // l (local identifier)
+ { 'm', N_("Modem") }, // m (canonical modem name)
+ { 'n', N_("Number") }, // n (fax phone number)
+ { 'r', N_("MaxRecv") }, // r (max recv pages)
+ { 's', N_("Status") }, // s (status information)
+ { 't', N_("Tracing") }, // t (server:session tracing level)
+ { 'v', N_("Speaker") }, // v (speaker volume as symbol)
+ { 'z', " " }, // z (``*'' if faxgetty is running)
{ '\0' },
};
void FaxClient::getModemStatusHeader(fxStr& header)
* status listings returned by the server.
*/
const FaxClient::FaxFmtHeader FaxClient::fileFormats[] = {
- { 'a', "LastAcc" }, // a (last access time)
- { 'c', "Created" }, // c (create time)
- { 'd', "Device" }, // d (device)
- { 'f', "Filename" }, // f (filename)
- { 'g', "GID" }, // g (GID of file)
- { 'l', "Links" }, // l (link count)
- { 'm', "LastMod" }, // m (last modification time)
- { 'o', "Owner" }, // o (owner based on file GID)
- { 'p', "Protect" }, // p (fax-style protection flags, no group bits)
- { 'q', "Protect" }, // q (UNIX-style protection flags)
- { 'r', "RootDev" }, // r (root device)
- { 's', "Size" }, // s (file size in bytes)
- { 'u', "UID" }, // u (UID of file)
+ { 'a', N_("LastAcc") }, // a (last access time)
+ { 'c', N_("Created") }, // c (create time)
+ { 'd', N_("Device") }, // d (device)
+ { 'f', N_("Filename") }, // f (filename)
+ { 'g', N_("GID") }, // g (GID of file)
+ { 'l', N_("Links") }, // l (link count)
+ { 'm', N_("LastMod") }, // m (last modification time)
+ { 'o', N_("Owner") }, // o (owner based on file GID)
+ { 'p', N_("Protect") }, // p (fax-style protection flags, no group bits)
+ { 'q', N_("Protect") }, // q (UNIX-style protection flags)
+ { 'r', N_("RootDev") }, // r (root device)
+ { 's', N_("Size") }, // s (file size in bytes)
+ { 'u', N_("UID") }, // u (UID of file)
{ '\0' },
};
void FaxClient::getFileStatusHeader(fxStr& header)
{
FILE* fd = Sys::fopen(tildeExpand(filename), "r");
if (fd) {
- configTrace("Read config file %s", (const char*) filename);
+ configTrace(_("Read config file %s"), (const char*) filename);
char line[1024];
while (fgets(line, sizeof (line)-1, fd)){
line[strlen(line)-1]='\0'; // Nuke \r at end of line
if (!cp || *cp == '\0') {
struct passwd* pwd = getpwuid(getuid());
if (!pwd) {
- configError("No passwd file entry for uid %u,"
- " cannot expand ~ in \"%s\"",
+ configError(_("No passwd file entry for uid %u,"
+ " cannot expand ~ in \"%s\""),
getuid(), (const char*) filename);
cp = ""; // NB: XXX maybe this should be fatal?
} else
cp++;
}
if (*cp != ':') {
- configError("Syntax error at line %u, missing ':' in \"%s\"",
+ configError(_("Syntax error at line %u, missing ':' in \"%s\""),
lineno, b);
return (false);
}
char* dp = ++cp;
for (value = dp; (c = *cp) != '"'; cp++) {
if (c == '\0') { // unmatched quote mark
- configError("Syntax error at line %u, missing quote mark in \"%s\"",
+ configError(_("Syntax error at line %u, missing quote mark in \"%s\""),
lineno, b);
return (false);
}
if (streq(tag, "include") ) {
u_int old_lineno = lineno;
- configTrace("%s = %s (line %u)", tag, value, lineno);
+ configTrace(_("%s = %s (line %u)"), tag, value, lineno);
lineno = 0;
readConfig(value);
lineno = old_lineno;
return (true);
}
if (!setConfigItem(tag, value)) {
- configTrace("Unknown configuration parameter \"%s\" ignored at line %u",
+ configTrace(_("Unknown configuration parameter \"%s\" ignored at line %u"),
tag, lineno);
return (false);
} else {
- configTrace("%s = %s (line %u)", tag, value, lineno);
+ configTrace(_("%s = %s (line %u)"), tag, value, lineno);
return (true);
}
}
while (getToken(fd, key)) {
if (key == "]") {
if (parent == 0)
- fprintf(stderr, "%s: line %d: Unmatched \"]\".\n",
+ fprintf(stderr, _("%s: line %d: Unmatched \"]\".\n"),
(const char*) filename, lineno);
break;
}
if (!getToken(fd, value))
break;
if (value != ":") {
- fprintf(stderr, "%s: line %d: Missing \":\" separator.\n",
+ fprintf(stderr, _("%s: line %d: Missing \":\" separator.\n"),
(const char*) filename, lineno);
continue;
}
if (c == '\\') {
c = getc(fd);
if (c == EOF) {
- fprintf(stderr, "%s: Premature EOF.\n", (const char*) filename);
+ fprintf(stderr, _("%s: Premature EOF.\n"), (const char*) filename);
return (false);
}
// XXX handle standard escapes
const char* cproto = proto; // XXX for busted include files
struct protoent* pp = getprotobyname(cproto);
if (!pp) {
- client.printWarning("%s: No protocol definition, using default.",
+ client.printWarning(_("%s: No protocol definition, using default."),
cproto);
protocol = 0;
} else
struct hostent* hp = Socket::gethostbyname(client.getHost());
if (!hp) {
- emsg = client.getHost() | ": Unknown host";
+ emsg = client.getHost() | _(": Unknown host");
return (false);
}
int fd = socket(hp->h_addrtype, SOCK_STREAM, protocol);
if (fd < 0) {
- emsg = "Can not create socket to connect to server.";
+ emsg = _("Can not create socket to connect to server.");
return (false);
}
struct sockaddr_in sin;
if (!sp) {
if (!isdigit(cproto[0])) {
client.printWarning(
- "No \"%s\" service definition, using default %u/%s.",
+ _("No \"%s\" service definition, using default %u/%s."),
FAX_SERVICE, FAX_DEFPORT, cproto);
sin.sin_port = htons(FAX_DEFPORT);
} else
for (char** cpp = hp->h_addr_list; *cpp; cpp++) {
memcpy(&sin.sin_addr, *cpp, hp->h_length);
if (client.getVerbose())
- client.traceServer("Trying %s (%s) at port %u...",
+ client.traceServer(_("Trying %s (%s) at port %u..."),
(const char*) client.getHost(),
inet_ntoa(sin.sin_addr),
ntohs(sin.sin_port));
if (Socket::connect(fd, &sin, sizeof (sin)) >= 0) {
if (client.getVerbose())
- client.traceServer("Connected to %s.", hp->h_name);
+ client.traceServer(_("Connected to %s."), hp->h_name);
#if defined(IP_TOS) && defined(IPTOS_LOWDELAY)
int tos = IPTOS_LOWDELAY;
if (Socket::setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof (tos)) < 0)
- client.printWarning("setsockopt(TOS): %s (ignored)",
+ client.printWarning(_("setsockopt(TOS): %s (ignored)"),
strerror(errno));
#endif
#ifdef SO_OOBINLINE
int on = 1;
if (Socket::setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, &on, sizeof (on)) < 0)
- client.printWarning("setsockopt(OOBLINE): %s (ignored)",
+ client.printWarning(_("setsockopt(OOBLINE): %s (ignored)"),
strerror(errno));
#endif
/*
return (true);
}
}
- emsg = fxStr::format("Can not reach server at host \"%s\", port %u.",
+ emsg = fxStr::format(_("Can not reach server at host \"%s\", port %u."),
(const char*) client.getHost(), ntohs(sin.sin_port));
Sys::close(fd), fd = -1;
return (false);
return (true);
}
#else
+void
+Transport::notConfigured(fxStr& emsg)
+{
+ emsg = _("Sorry, no TCP/IP communication support was configured.");
+}
+
bool InetTransport::callServer(fxStr& emsg)
- { notConfigured("TCP/IP", emsg); return (false); }
+ { notConfigured(emsg); return (false); }
bool InetTransport::initDataConn(fxStr& emsg)
- { notConfigured("TCP/IP", emsg); return (false); }
+ { notConfigured(emsg); return (false); }
bool InetTransport::openDataConn(fxStr& emsg)
- { notConfigured("TCP/IP", emsg); return (false); }
+ { notConfigured(emsg); return (false); }
bool InetTransport::abortDataConn(fxStr& emsg)
- { notConfigured("TCP/IP", emsg); return (false); }
+ { notConfigured(emsg); return (false); }
#endif
void fxObj::subClassMustDefine(const char* method) const
{
- fprintf(stderr, "%s: Sub class must define method \"%s\".\n",
+ fprintf(stderr, _("%s: Sub class must define method \"%s\".\n"),
className(), method);
abort();
}
{
va_list ap;
va_start(ap, fmt);
- fprintf(stderr, "%s: line %u: ", file, lineno);
+ fprintf(stderr, _("%s: line %u: "), file, lineno);
vfprintf(stderr, fmt, ap);
va_end(ap);
}
cp++;
if (*cp == '\0') {
parseError(file, lineno,
- "Unexpected end of line after \"%s\".\n", item);
+ _("Unexpected end of line after \"%s\".\n"), item);
return (false);
} else
return (true);
pi.name = cp;
while (*cp != '\t')
cp++;
- if (!skipws(cp, file, "page size name", lineno))
+ if (!skipws(cp, file, _("page size name"), lineno))
continue;
pi.abbr = cp;
while (*cp != '\t')
cp++;
- if (!skipws(cp, file, "page size abbreviation", lineno))
+ if (!skipws(cp, file, _("page size abbreviation"), lineno))
continue;
pi.w = (BMU) strtoul(cp, &cp, 10);
- if (!skipws(cp, file, "page width", lineno))
+ if (!skipws(cp, file, _("page width"), lineno))
continue;
pi.h = (BMU) strtoul(cp, &cp, 10);
- if (!skipws(cp, file, "page height", lineno))
+ if (!skipws(cp, file, _("page height"), lineno))
continue;
pi.grw = (BMU) strtoul(cp, &cp, 10);
- if (!skipws(cp, file, "guaranteed page width", lineno))
+ if (!skipws(cp, file, _("guaranteed page width"), lineno))
continue;
pi.grh = (BMU) strtoul(cp, &cp, 10);
- if (!skipws(cp, file, "guaranteed page height", lineno))
+ if (!skipws(cp, file, _("guaranteed page height"), lineno))
continue;
pi.top = (BMU) strtoul(cp, &cp, 10);
- if (!skipws(cp, file, "top margin", lineno))
+ if (!skipws(cp, file, _("top margin"), lineno))
continue;
pi.left = (BMU) strtoul(cp, &cp, 10);
pi.name = strdup(pi.name);
fclose(fp);
} else {
fprintf(stderr,
- "Warning, no page size database file \"%s\", using builtin default.\n",
+ _("Warning, no page size database file \"%s\", using builtin default.\n"),
(const char*)file);
PageInfo pi;
pi.name = strdup("default");
void
SNPPClient::vprintWarning(const char* fmt, va_list ap)
{
- fprintf(stderr, "Warning, ");
+ fprintf(stderr, _("Warning, "));
vfprintf(stderr, fmt, ap);
fputs("\n", stderr);
}
}
fxStr mbox;
if (senderName == "" || !getNonBlankMailbox(mbox)) {
- emsg = "Malformed (null) sender name or mail address";
+ emsg = _("Malformed (null) sender name or mail address");
return (false);
} else
return (true);
pwd = getpwuid(getuid());
if (!pwd) {
emsg = fxStr::format(
- "Can not locate your password entry (uid %lu): %s.",
+ _("Can not locate your password entry (uid %lu): %s."),
(u_long) getuid(), strerror(errno));
return (false);
}
} else
senderName = userName;
if (senderName.length() == 0) {
- emsg = "Bad (null) user name; your password file entry"
- " probably has bogus GECOS field information.";
+ emsg = _("Bad (null) user name; your password file entry"
+ " probably has bogus GECOS field information.");
return (false);
} else
return (true);
} else if (streq(tag, "holdtime")) {
fxStr emsg;
if (!jproto.setHoldTime(tag, emsg))
- configError("Invalid hold time \"%s\": %s",
+ configError(_("Invalid hold time \"%s\": %s"),
value, (const char*) emsg);
} else if (streq(tag, "retrytime")) {
jproto.setRetryTime(value);
}
struct hostent* hp = Socket::gethostbyname(getHost());
if (!hp) {
- emsg = getHost() | ": Unknown host";
+ emsg = getHost() | _(": Unknown host");
return (false);
}
int protocol;
const char* cproto = proto; // XXX for busted include files
struct protoent* pp = getprotobyname(cproto);
if (!pp) {
- printWarning("%s: No protocol definition, using default.", cproto);
+ printWarning(_("%s: No protocol definition, using default."), cproto);
protocol = 0;
} else
protocol = pp->p_proto;
int fd = socket(hp->h_addrtype, SOCK_STREAM, protocol);
if (fd < 0) {
- emsg = "Can not create socket to connect to server.";
+ emsg = _("Can not create socket to connect to server.");
return (false);
}
struct sockaddr_in sin;
if (!sp) {
if (!isdigit(cproto[0])) {
printWarning(
- "No \"%s\" service definition, using default %u/%s.",
+ _("No \"%s\" service definition, using default %u/%s."),
SNPP_SERVICE, SNPP_DEFPORT, cproto);
sin.sin_port = htons(SNPP_DEFPORT);
} else
for (char** cpp = hp->h_addr_list; *cpp; cpp++) {
memcpy(&sin.sin_addr, *cpp, hp->h_length);
if (getVerbose())
- traceServer("Trying %s (%s) at port %u...",
+ traceServer(_("Trying %s (%s) at port %u..."),
(const char*) getHost(),
inet_ntoa(sin.sin_addr),
ntohs(sin.sin_port));
if (Socket::connect(fd, &sin, sizeof (sin)) >= 0) {
if (getVerbose())
- traceServer("Connected to %s.", hp->h_name);
+ traceServer(_("Connected to %s."), hp->h_name);
#if defined(IP_TOS) && defined(IPTOS_LOWDELAY)
int tos = IPTOS_LOWDELAY;
if (Socket::setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof (tos)) < 0)
- printWarning("setsockopt(TOS): %s (ignored)",
+ printWarning(_("setsockopt(TOS): %s (ignored)"),
strerror(errno));
#endif
#ifdef SO_OOBINLINE
int on = 1;
if (Socket::setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, &on, sizeof (on)) < 0)
- printWarning("setsockopt(OOBLINE): %s (ignored)",
+ printWarning(_("setsockopt(OOBLINE): %s (ignored)"),
strerror(errno));
#endif
setCtrlFds(fd, fd);
return (true);
}
}
- emsg = fxStr::format("Can not reach server at host \"%s\", port %u.",
+ emsg = fxStr::format(_("Can not reach server at host \"%s\", port %u."),
(const char*) getHost(), ntohs(sin.sin_port));
close(fd), fd = -1;
return (false);
bool
SNPPServer::callInetServer(fxStr& emsg)
{
- emsg = "Sorry, no TCP/IP communication support was configured.";
+ emsg = _("Sorry, no TCP/IP communication support was configured.");
return (false);
}
#endif
state &= ~SS_HASSITE;
return (true);
} else {
- emsg = "Login failed: " | lastResponse;
+ emsg = _("Login failed: ") | lastResponse;
return (false);
}
}
void
SNPPClient::lostServer(void)
{
- printError("Service not available, remote server closed connection");
+ printError(_("Service not available, remote server closed connection"));
hangupServer();
}
void
SNPPClient::unexpectedResponse(fxStr& emsg)
{
- emsg = "Unexpected server response: " | lastResponse;
+ emsg = _("Unexpected server response: ") | lastResponse;
}
void
{
va_list ap;
va_start(ap, fmt);
- emsg = "Protocol botch" | fxStr::vformat(fmt, ap);
+ emsg = _("Protocol botch") | fxStr::vformat(fmt, ap);
va_end(ap);
}
}
}
if (fdOut == NULL) {
- printError("No control connection for command");
+ printError(_("No control connection for command"));
code = -1;
return (0);
}
SNPPClient::submitJobs(fxStr& emsg)
{
if (!isLoggedIn()) {
- emsg = "Not logged in to server";
+ emsg = _("Not logged in to server");
return (false);
}
/*
void
SNPPClient::notifyNewJob(const SNPPJob& job)
{
- printf("destination pin %s: request id is %s for host %s\n"
+ printf(_("destination pin %s: request id is %s for host %s\n")
, (const char*) job.getPIN()
, (const char*) job.getJobID()
, (const char*) getHost()
for (int cnt, sent = 0; cc; sent += cnt, cc -= cnt)
if ((cnt = write(fileno(fdOut), bp + sent, cc)) <= 0) {
protocolBotch(emsg, errno == EPIPE ?
- " (server closed connection)" : " (server write error: %s).",
+ _(" (server closed connection)") : _(" (server write error: %s)."),
strerror(errno));
return (false);
}
#else
if (write(fileno(fdOut), buf, cc) != cc) {
protocolBotch(emsg, errno == EPIPE ?
- " (server closed connection)" : " (server write error: %s).",
+ _(" (server closed connection)") : _(" (server write error: %s)."),
strerror(errno));
return (false);
}
struct stat sb;
(void) Sys::fstat(fd, sb);
if (getVerbose())
- traceServer("SEND message data, %lu bytes", (u_long) sb.st_size);
+ traceServer(_("SEND message data, %lu bytes"), (u_long) sb.st_size);
if (command("DATA") == CONTINUE) {
size_t cc = (size_t) sb.st_size;
while (cc > 0) {
char buf[32*1024];
size_t n = fxmin(cc, sizeof (buf));
if (read(fd, buf, n) != (ssize_t) n) {
- protocolBotch(emsg, " (data read: %s).", strerror(errno));
+ protocolBotch(emsg, _(" (data read: %s)."), strerror(errno));
return (false);
}
if (!sendRawData(buf, n, emsg))
ok = sendData(fd, emsg);
Sys::close(fd);
} else
- emsg = fxStr::format("Unable to open message file \"%s\".",
+ emsg = fxStr::format(_("Unable to open message file \"%s\"."),
(const char*) filename);
return (ok);
}
SNPPClient::siteParm(const char* name, const fxStr& value)
{
if (!hasSiteCmd()) {
- printWarning("no SITE %s support; ignoring set request.", name);
+ printWarning(_("no SITE %s support; ignoring set request."), name);
return (true);
} else
return (command("SITE %s %s", name, (const char*) value) == COMPLETE);
SNPPClient::siteParm(const char* name, u_int value)
{
if (!hasSiteCmd()) {
- printWarning("no SITE %s support; ignoring set request.", name);
+ printWarning(_("no SITE %s support; ignoring set request."), name);
return (true);
} else
return (command("SITE %s %u", name, value) == COMPLETE);
if (typeRules == NULL) {
typeRules = TypeRules::read(typeRulesFile);
if (!typeRules) {
- emsg = "Unable to setup file typing and conversion rules";
+ emsg = _("Unable to setup file typing and conversion rules");
return (false);
}
}
if (job.getPageWidth() != 0 && job.getPageLength() != 0)
continue;
if (!job.setPageSize(job.getPageSize())) {
- emsg = "Unknown page size " | job.getPageSize();
+ emsg = _("Unknown page size ") | job.getPageSize();
return (false);
}
}
pid_t pid = fork();
switch (pid) {
case -1: // error
- emsg = fxStr::format("Error creating cover sheet; "
- "could not fork subprocess: %s", strerror(errno));
+ emsg = fxStr::format(_("Error creating cover sheet; "
+ "could not fork subprocess: %s"), strerror(errno));
Sys::close(pfd[1]);
break;
case 0: // child, exec command
file = tmpFile;
return (true);
}
- emsg = fxStr::format("Error creating cover sheet; "
- "command was \"%s\"; exit status %x"
+ emsg = fxStr::format(_("Error creating cover sheet; "
+ "command was \"%s\"; exit status %x")
, (const char*) joinargs(coverCmd, av)
, status
);
}
Sys::close(pfd[0]);
} else {
- emsg = fxStr::format("Error creating cover sheet; "
- "unable to create pipe to subprocess: %s", strerror(errno));
+ emsg = fxStr::format(_("Error creating cover sheet; "
+ "unable to create pipe to subprocess: %s"), strerror(errno));
}
#undef MAXARGS
} else
- emsg = fxStr::format("%s: Can not create temporary file for cover page",
+ emsg = fxStr::format(_("%s: Can not create temporary file for cover page"),
(const char*) tmpFile);
Sys::unlink(tmpFile);
return (false);
SendFaxClient::submitJobs(fxStr& emsg)
{
if (!setup) {
- emsg = "Documents not prepared";
+ emsg = _("Documents not prepared");
return (false);
}
if (!isLoggedIn()) {
- emsg = "Not logged in to server";
+ emsg = _("Not logged in to server");
return (false);
}
/*
FileInfo& info = (*files)[i];
int fd = Sys::open(info.temp, O_RDONLY);
if (fd < 0) {
- emsg = fxStr::format(info.temp | ": Can not open: %s",
+ emsg = fxStr::format(info.temp | _(": Can not open: %s"),
strerror(errno));
return (false); // XXX
}
Sys::close(fd);
if (!fileSent) {
if (emsg == "")
- emsg = "Document transfer failed: " | getLastResponse();
+ emsg = _("Document transfer failed: ") | getLastResponse();
return (false);
}
}
SendFaxClient::notifyNewJob(const SendFaxJob& job)
{
int nfiles = files->length();
- printf("request id is %s (group id %s) for host %s (%u %s)\n"
+ printf(ngettext("request id is %s (group id %s) for host %s (%u file)\n",
+ "request id is %s (group id %s) for host %s (%u files)\n", nfiles)
, (const char*) job.getJobID()
, (const char*) job.getGroupID()
, (const char*) getHost()
, nfiles
- , nfiles > 1 ? "files" : "file"
);
}
}
fxStr mbox;
if (senderName == "" || !getNonBlankMailbox(mbox)) {
- emsg = "Malformed (null) sender name or mail address";
+ emsg = _("Malformed (null) sender name or mail address");
return (false);
} else
return (true);
printf("CONVERT \"%s\"\n", (const char*) sysCmd);
if (system(sysCmd) != 0) {
Sys::unlink(tmpFile);
- emsg = fxStr::format("Error converting document; command was \"%s\"",
+ emsg = fxStr::format(_("Error converting document; command was \"%s\""),
(const char*) sysCmd);
return (false);
}
struct stat sb;
int fd = Sys::open(filename, O_RDONLY);
if (fd < 0) {
- emsg = fxStr::format("%s: Can not open file", filename);
+ emsg = fxStr::format(_("%s: Can not open file"), filename);
return (NULL);
}
if (Sys::fstat(fd, sb) < 0) {
- emsg = fxStr::format("%s: Can not stat file", filename);
+ emsg = fxStr::format(_("%s: Can not stat file"), filename);
Sys::close(fd);
return (NULL);
}
if ((sb.st_mode & S_IFMT) != S_IFREG) {
- emsg = fxStr::format("%s: Not a regular file", filename);
+ emsg = fxStr::format(_("%s: Not a regular file"), filename);
Sys::close(fd);
return (NULL);
}
int cc = Sys::read(fd, buf, sizeof (buf));
Sys::close(fd);
if (cc == 0) {
- emsg = fxStr::format("%s: Empty file", filename);
+ emsg = fxStr::format(_("%s: Empty file"), filename);
return (NULL);
}
const TypeRule* tr = typeRules->match(buf, cc);
if (!tr) {
- emsg = fxStr::format("%s: Can not determine file type", filename);
+ emsg = fxStr::format(_("%s: Can not determine file type"), filename);
return (NULL);
}
if (tr->getResult() == TypeRule::ERROR) {
if (coverFile != "") {
int fd = Sys::open(coverFile, O_RDONLY);
if (fd < 0) {
- emsg = fxStr::format("%s: Can not open: %s",
+ emsg = fxStr::format(_("%s: Can not open: %s"),
(const char*) coverFile, strerror(errno));
return (false); // XXX
}
Sys::close(fd);
if (!fileSent) {
if (emsg == "")
- emsg = "Document transfer failed: " | client.getLastResponse();
+ emsg = _("Document transfer failed: ") | client.getLastResponse();
return (false);
}
CHECK(client.jobCover(coverDoc))
fd = -1;
}
if (fd < 0) {
- emsg = fxStr::format("Unable to open sequence number file %s; %s.",
+ emsg = fxStr::format(_("Unable to open sequence number file %s; %s."),
name, strerror(errno));
logError("%s: open: %s", name, strerror(errno));
return ((u_long) -1);
seqnum = atol(line);
}
if (seqnum < 1 || seqnum >= MAXSEQNUM) {
- logWarning("%s: Invalid sequence number \"%s\", resetting to 1",
+ logWarning(_("%s: Invalid sequence number \"%s\", resetting to 1"),
name, line);
seqnum = 1;
}
if (Sys::write(fd, (const char*)line2, len) != len ||
ftruncate(fd, len)) {
emsg = fxStr::format(
- "Unable update sequence number file %s; write failed.", name);
+ _("Unable update sequence number file %s; write failed."), name);
logError("%s: Problem updating sequence number file", name);
return ((u_long) -1);
}
void fxStr::remove(u_int start, u_int chars)
{
- fxAssert(start+chars<slength,"Str::remove: Invalid range");
+ fxAssert(start+chars<slength, "Str::remove: Invalid range");
long move = slength-start-chars; // we always move at least 1
assert(move > 0);
if (slength - chars <= 1) {
fxStr fxStr::cut(u_int start, u_int chars)
{
- fxAssert(start+chars<slength,"Str::cut: Invalid range");
+ fxAssert(start+chars<slength, "Str::cut: Invalid range");
fxStr a(data+start, chars);
remove(start, chars);
return a;
void
TextFormat::warning(const char* fmt ...) const
{
- fputs("Warning, ", stderr);
+ fputs(_("Warning, "), stderr);
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
if (workStarted) {
fxStr emsg;
if (!f->readMetrics(pointSize, useISO8859, emsg))
- error("Font %s: %s", f->getFamily(), (const char*) emsg);
+ error(_("Font %s: %s"), f->getFamily(), (const char*) emsg);
}
return (f);
}
*/
tf = Sys::tmpfile();
if (tf == NULL)
- fatal("Cannot open temporary file: %s", strerror(errno));
+ fatal(_("Cannot open temporary file: %s"), strerror(errno));
numcol = fxmax(1,numcol);
if (pointSize == -1)
else
pointSize = fxmax(inch("3bp"), pointSize);
if (pointSize > inch("18bp"))
- warning("point size is unusually large (>18pt)");
+ warning(_("point size is unusually large (>18pt)"));
// read font metrics
for (FontDictIter iter(*fonts); iter.notDone(); iter++) {
fxStr emsg;
TextFont* f = iter.value();
if (!f->readMetrics(pointSize, useISO8859, emsg))
- error("Font %s: %s", f->getFamily(), (const char*) emsg);
+ error(_("Font %s: %s"), f->getFamily(), (const char*) emsg);
}
outline = fxmax(0L,outline);
curFont = (*fonts)["Roman"];
pageHeight = t;
}
if (lm+rm >= pageWidth)
- fatal("Margin values too large for page; lm %lu rm %lu page width %lu",
+ fatal(_("Margin values too large for page; lm %lu rm %lu page width %lu"),
lm, rm, pageWidth);
if (tm+bm >= pageHeight)
- fatal("Margin values too large for page; tm %lu bm %lu page height %lu",
+ fatal(_("Margin values too large for page; tm %lu bm %lu page height %lu"),
tm, bm, pageHeight);
col_width = (pageWidth - (lm + rm))/numcol;
Copy_Block(0L, last-1);
}
if (fclose(tf))
- fatal("Close failure on temporary file: %s", strerror(errno));
+ fatal(_("Close failure on temporary file: %s"), strerror(errno));
tf = NULL;
emitTrailer();
fflush(output);
size_t cc = (size_t) fxmin(sizeof (buf), (size_t) (b2-k+1));
fseek(tf, (long) k, SEEK_SET); // position to desired block
if (fread(buf, 1, (size_t) cc, tf) != cc)
- fatal("Read error during reverse collation: %s", strerror(errno));
+ fatal(_("Read error during reverse collation: %s"), strerror(errno));
if (fwrite(buf, 1, (size_t) cc, output) != cc)
- fatal("Output write error: %s", strerror(errno));
+ fatal(_("Output write error: %s"), strerror(errno));
}
}
formatFile(fp);
fclose(fp);
} else
- error("%s: Cannot open file: %s", name, strerror(errno));
+ error(_("%s: Cannot open file: %s"), name, strerror(errno));
}
void
{
fflush(tf);
if (ferror(tf) && errno == ENOSPC)
- fatal("Output write error: %s", strerror(errno));
+ fatal(_("Output write error: %s"), strerror(errno));
}
/*
size_t len = strcspn(buf, "%\n");
if (len == strlen(buf)) {
emsg = fxStr::format(
- "Warning:%s - line too long.", (const char*)fontMapFile);
+ _("Warning: %s - line too long."), (const char*)fontMapFile);
break;
}
if (len == 0) continue;
*(buf + len) = '\0';
if (len == strlen(buf)) {
emsg = fxStr::format(
- "Warning: %s - line too long.", (const char*) fontMapFile);
+ _("Warning: %s - line too long."), (const char*) fontMapFile);
break;
}
if (len == 0) continue;
bool result = stat(filename, &junk) ? false : true;
if (!result)
emsg = fxStr::format(
- "Warning: %s invalid Fontmap entry - no filename present", (const char*)val);
+ _("Warning: %s invalid Fontmap entry - no filename present"), (const char*)val);
return result;
}
}
FILE *fp = openAFMFile(file);
if (fp == NULL) {
emsg = fxStr::format(
- "%s: Can not open font metrics file; using fixed widths",
+ _("%s: Can not open font metrics file; using fixed widths"),
(const char*) file);
loadFixedMetrics(625*ps/1000L); // NB: use fixed width metrics
return (false);
do {
if (!getAFMLine(fp, buf, sizeof (buf))) {
emsg = fxStr::format(
- "%s: No glyph metric table located; using fixed widths",
+ _("%s: No glyph metric table located; using fixed widths"),
(const char*) file);
fclose(fp);
/*
int ix, w;
/* read the glyph position and width */
if (sscanf(buf, "C %d ; WX %d ;", &ix, &w) != 2) {
- emsg = fxStr::format("%s, line %u: format error",
+ emsg = fxStr::format(_("%s, line %u: format error"),
(const char*) file, lineno);
fclose(fp);
return (false);
}
return (true);
}
-
-void
-Transport::notConfigured(const char* what, fxStr& emsg)
-{
- emsg = fxStr::format("Sorry, no %s communication support was configured.", what);
-}
Transport(FaxClient&);
- void notConfigured(const char* what, fxStr& emsg);
+ virtual void notConfigured(fxStr& emsg);
public:
virtual ~Transport();
TypeRule::match(const void* data, size_t size, bool verbose) const
{
if (verbose) {
- printf("rule: %soffset %#lx %s %s",
+ printf(_("rule: %soffset %#lx %s %s"),
cont ? ">" : "",
(u_long) off,
typeNames[type],
printf(" \"%s\"", value.s);
else if (type != ASCII && type != ASCIIESC) {
if (op == ANY)
- printf(" <any value>");
+ printf(_(" <any value>"));
else
printf(" %#llx", (long long) value.v);
}
}
if (off > (off_t)size) {
if (verbose)
- printf("failed (offset past data)\n");
+ printf(_("failed (offset past data)\n"));
return (false);
}
bool ok = false;
for (i = 0; i < size; i++)
if (!isprint(cp[i]) && !isspace(cp[i])) {
if (verbose)
- printf("failed (unprintable char %#x)\n", cp[i]);
+ printf(_("failed (unprintable char %#x)\n"), cp[i]);
return (false);
}
ok = true;
for (i = 0; i < size; i++)
if (!isprint(cp[i]) && !isspace(cp[i]) && cp[i] != '\033') {
if (verbose)
- printf("failed (unprintable char %#x)\n", cp[i]);
+ printf(_("failed (unprintable char %#x)\n"), cp[i]);
return (FALSE);
}
ok = TRUE;
break;
}
if (verbose)
- printf("failed (insufficient data)\n");
+ printf(_("failed (insufficient data)\n"));
return (false);
case LONG:
if (off + 4 < (off_t)size) {
break;
}
if (verbose)
- printf("failed (insufficient data)\n");
+ printf(_("failed (insufficient data)\n"));
return (false);
}
/*
done:
if (verbose) {
if (ok)
- printf("success (result %s, rule \"%s\")\n",
+ printf(_("success (result %s, rule \"%s\")\n"),
resultNames[result], (const char*) cmd);
else
- printf("failed (comparison)\n");
+ printf(_("failed (comparison)\n"));
}
return (ok);
}
{
va_list ap;
va_start(ap, fmt);
- fprintf(stderr, "%s: line %u: ", file, lineno);
+ fprintf(stderr, _("%s: line %u: "), file, lineno);
vfprintf(stderr, fmt, ap);
va_end(ap);
}
fp = fopen(file, "r");
if (fp == NULL) {
- fprintf(stderr, "%s: Can not open type rules file.\n",
+ fprintf(stderr, _("%s: Can not open type rules file.\n"),
(const char*) file);
return NULL;
}
const char *op = cp;
rule.off = strtoul(op, &cp, 0); // file offset
if (cp == op) {
- parseError(file, lineno, "Missing file offset");
+ parseError(file, lineno, _("Missing file offset"));
continue;
}
while (isspace(*cp))
else if (strncasecmp(tp, "addr", cp-tp) == 0)
rule.type = TypeRule::ADDR;
else {
- parseError(file, lineno, "Unknown datatype \"%.*s\"", cp-tp, tp);
+ parseError(file, lineno, _("Unknown datatype \"%.*s\""), cp-tp, tp);
continue; // bad type
}
while (isspace(*cp))
const char* vp = cp;
rule.value.v = strtol(vp, &cp, 0);
if (vp == cp) {
- parseError(file, lineno, "Missing match value");
+ parseError(file, lineno, _("Missing match value"));
continue;
}
}
else if (strncasecmp(rp, "error", cp-rp) == 0)
rule.result = TypeRule::ERROR;
else {
- parseError(file, lineno, "Unknown result \"%.*s\"", cp-rp, rp);
+ parseError(file, lineno, _("Unknown result \"%.*s\""), cp-rp, rp);
continue;
}
while (isspace(*cp))
TypeRules::match(const void* data, u_int size) const
{
if (verbose)
- printf("match against (..., %u)\n", size);
+ printf(_("match against (..., %u)\n"), size);
for (u_int i = 0, n = (*rules).length(); i < n; i++) {
TypeRule& rule = (*rules)[i];
if (!rule.isContinuation() && rule.match(data, size, verbose))
return (&(*rules)[i + match2(i, data, size, verbose)]);
}
if (verbose)
- printf("no match\n");
+ printf(_("no match\n"));
return (NULL);
}
#include "stdio.h"
#include "sys/types.h"
#include "port.h"
+#include "config.h"
// Needed for the placement new operator
#ifdef HAS_OLD_NEW_H
{
int fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd < 0) {
- emsg = "Can not create socket to connect to server.";
+ emsg = _("Can not create socket to connect to server.");
return (false);
}
struct sockaddr_un Sun;
Sun.sun_family = AF_UNIX;
strncpy(Sun.sun_path, client.getHost(), sizeof (Sun.sun_path));
if (client.getVerbose())
- client.traceServer("connect to server at %s",
+ client.traceServer(_("connect to server at %s"),
(const char*) client.getHost());
if (Socket::connect(fd, &Sun, sizeof (Sun)) >= 0) {
client.setCtrlFds(fd, dup(fd));
return (true);
} else {
- emsg = fxStr::format("Can not reach server at Unix domain socket \"%s\".",
+ emsg = fxStr::format(_("Can not reach server at Unix domain socket \"%s\"."),
(const char*) client.getHost());
Sys::close(fd), fd = -1;
return (false);
#endif
}
#else
+void
+Transport::notConfigured(fxStr& emsg)
+{
+ emsg = _("Sorry, no Unix domain communication support was configured.");
+}
+
bool UnixTransport::callServer(fxStr& emsg)
- { notConfigured("Unix domain", emsg); return (false); }
+ { notConfigured(emsg); return (false); }
bool UnixTransport::initDataConn(fxStr& emsg)
- { notConfigured("Unix domain", emsg); return (false); }
+ { notConfigured(emsg); return (false); }
bool UnixTransport::openDataConn(fxStr& emsg)
- { notConfigured("Unix domain", emsg); return (false); }
+ { notConfigured(emsg); return (false); }
#endif
static void
usage()
{
- fxFatal("usage: %s"
+ fxFatal(_("usage: %s"
" [-v]"
" [-a area-code]"
" [-c country-code]"
" [-i international-prefix]"
" [-l long-distance-prefix]"
- " dialrules"
+ " dialrules")
, appName
);
}
prompt()
{
if (! quiet)
- printf("ready> "); fflush(stdout);
+ printf(_("ready> ")); fflush(stdout);
return (1);
}
rules.def("InternationalPrefix", internationalPrefix);
rules.def("LongDistancePrefix", longDistancePrefix);
if (!rules.parse())
- fxFatal("%s: Problem parsing rules in %s", appName, argv[optind]);
+ fxFatal(_("%s: Problem parsing rules in %s"), appName, argv[optind]);
char line[1024];
while (prompt() && fgets(line, sizeof (line), stdin)) {
char* cp = strchr(line, '\n');
if (cp)
*cp = '\0';
if (verbose)
- printf("input = \"%s\"\n", line);
+ printf(_("input = \"%s\"\n"), line);
if ((cp = strchr(line, '('))) {
char* ep = strrchr(cp, ')');
if (ep)
fxStr c = rules.canonicalNumber(line);
fxStr d = rules.dialString(line);
fxStr n = rules.displayNumber(line);
- printf("canonical = \"%s\"\n", (const char*) c);
- printf("dial-string = \"%s\"\n", (const char*) d);
- printf("display = \"%s\"\n", (const char *) n);
+ printf(_("canonical = \"%s\"\n"), (const char*) c);
+ printf(_("dial-string = \"%s\"\n"), (const char*) d);
+ printf(_("display = \"%s\"\n"), (const char *) n);
}
}
return (0);
mode = MODE_Z;
break;
case '?':
- fxFatal("usage: faxfetch [-h server-host] [-v] file");
+ fxFatal(_("usage: faxfetch [-h server-host] [-v] file"));
}
if (optind < argc) {
fxStr emsg;
static void
usage (const char* app)
{
- printf("usage: %s [-n] [-S fmt] [-s fmt] [-e fmt] [-E fmt] [-D]\n\n", app);
- printf("\t-n\tPrint FAX filename\n");
- printf("\t-C d\tQuoted CSV-style output with <d> as the deliminator\n");
- printf("\t-c d\tCSV-style output with <d> as the deliminator\n");
- printf("\t-r\traw format - values outputed with no names\n");
+ printf(_("usage: %s [-n] [-S fmt] [-s fmt] [-e fmt] [-E fmt] [-D]\n\n"), app);
+ printf(_("\t-n\tPrint FAX filename\n"));
+ printf(_("\t-C d\tQuoted CSV-style output with <d> as the deliminator\n"));
+ printf(_("\t-c d\tCSV-style output with <d> as the deliminator\n"));
+ printf(_("\t-r\traw format - values outputed with no names\n"));
- printf(" Raw format options:\n");
- printf("\t-S fmt\tUse fmt for the fax start format\n");
- printf("\t-s fmt\tUse fmt for the field start format\n");
- printf("\t-e fmt\tUse fmt for the field end format\n");
- printf("\t-E fmt\tUse fmt for the fax end format\n");
+ printf(_(" Raw format options:\n"));
+ printf(_("\t-S fmt\tUse fmt for the fax start format\n"));
+ printf(_("\t-s fmt\tUse fmt for the field start format\n"));
+ printf(_("\t-e fmt\tUse fmt for the field end format\n"));
+ printf(_("\t-E fmt\tUse fmt for the fax end format\n"));
}
static const char*
TIFFSetWarningHandler(NULL);
TIFF* tif = TIFFOpen(argv[optind], "r");
if (tif == NULL) {
- printf("Could not open %s; either not TIFF or corrupted.\n",
+ printf(_("Could not open %s; either not TIFF or corrupted.\n"),
argv[optind]);
return (1);
}
bool ok = isFAXImage(tif);
if (!ok) {
- printf("Does not look like a facsimile?\n");
+ printf(_("Does not look like a facsimile?\n"));
return (1);
}
i++;
}
} else
- sender = "<unknown>";
- printField("%s", "Sender", (const char*) sender);
+ sender = _("<unknown>");
+ printField("%s", _("Sender"), (const char*) sender);
#ifdef TIFFTAG_FAXSUBADDRESS
if (TIFFGetField(tif, TIFFTAG_FAXSUBADDRESS, &cp)) {
fxStr subaddr(cp);
sanitize(subaddr);
- printField("%s", "SubAddr", (const char*) subaddr);
+ printField("%s", _("SubAddr"), (const char*) subaddr);
}
#endif
fxStr date;
} while (TIFFReadDirectory(tif));
TIFFClose(tif);
- printField("%u", "Pages", npages);
+ printField("%u", _("Pages"), npages);
if (params.vr == VR_NORMAL)
- printField("Normal", "Quality");
+ printField(_("Normal"), _("Quality"));
else if (params.vr == VR_FINE)
- printField("Fine", "Quality");
+ printField(_("Fine"), _("Quality"));
else if (params.vr == VR_R8)
- printField("Superfine", "Quality");
+ printField(_("Superfine"), _("Quality"));
else if (params.vr == VR_R16)
- printField("Hyperfine", "Quality");
+ printField(_("Hyperfine"), _("Quality"));
else
- printField("%u lines/inch", "Quality", params.verticalRes());
+ printField(_("%u lines/inch"), _("Quality"), params.verticalRes());
PageSizeInfo* info = PageSizeInfo::getPageSizeBySize(w, h);
if (info)
- printField("%s", "Page", info->name());
+ printField("%s", _("Page"), info->name());
else
- printField("%u by %u", "Page", params.pageWidth(), (u_int) h);
+ printField(_("%u by %u"), _("Page"), params.pageWidth(), (u_int) h);
delete info;
- printField("%s", "Received", (const char*) date);
- printField("%s", "TimeToRecv", time == 0 ? "<unknown>" : fmtTime(time));
- printField("%s", "SignalRate", params.bitRateName());
- printField("%s", "DataFormat", params.dataFormatName());
- printField("%s", "ErrCorrect", params.ec == EC_DISABLE ? "No" : "Yes");
+ printField("%s", _("Received"), (const char*) date);
+ printField("%s", _("TimeToRecv"), time == 0 ? _("<unknown>") : fmtTime(time));
+ printField("%s", _("SignalRate"), params.bitRateName());
+ printField("%s", _("DataFormat"), params.dataFormatName());
+ printField("%s", _("ErrCorrect"), params.ec == EC_DISABLE ? _("No") : _("Yes"));
for (u_int i = 0; i < callid.size(); i++) {
// formatting will mess up if i gets bigger than one digit
- fxStr fmt(fxStr::format("CallID%u", i+1));
+ fxStr fmt(fxStr::format(_("CallID%u"), i+1));
printField("%s", (const char*)fmt, (const char*) callid.id(i));
}
printEnd(name);
writeData(int arg, const char* buf, int cc, fxStr& emsg)
{
if (Sys::write((intptr_t) arg, buf, cc) != cc) {
- emsg = fxStr::format("write error: %s", strerror(errno));
+ emsg = fxStr::format(_("write error: %s"), strerror(errno));
return (false);
} else
return (true);
if (callServer(emsg)) {
if (login(NULL, emsg) && setType(TYPE_A)) {
if (getTimeZone() == TZ_GMT)
- printWarning("time values reported in GMT");
+ printWarning(_("time values reported in GMT"));
(void) recvData(writeData, STDOUT_FILENO, emsg, 0,
"SITE TRIGGER %s", argv[optind]);
}
void
watchApp::usage()
{
- fxFatal("usage: %s [-h host] [-g] [-l] [-v] trigger-specification",
+ fxFatal(_("usage: %s [-h host] [-g] [-l] [-v] trigger-specification"),
(const char*) appName);
}
static void
usage()
{
- fprintf(stderr, "Usage: %s"
+ fprintf(stderr, _("Usage: %s"
" [-1]"
" [-2]"
" [-B]"
" [-U]"
" [-Ml=#,r=#,t=#,b=#]"
" [-V #]"
- " files... >out.ps\n", prog);
- fprintf(stderr,"Default options:"
+ " files... >out.ps\n"), prog);
+ fprintf(stderr, _("Default options:"
" -f Courier"
" -1"
" -p 11bp"
" -o 0"
- "\n");
+ "\n"));
exit(1);
}
case 'f': // body font
if (!fmt.setTextFont(optarg)) {
fprintf(stderr,
- "%s: No font metric information found for \"%s\".\n",
+ _("%s: No font metric information found for \"%s\".\n"),
prog, optarg);
usage();
}
break;
case 'M': // margin(s)
if (!fmt.setPageMargins(optarg)) {
- fprintf(stderr, "Bad margin syntax.\n");
+ fprintf(stderr, _("Bad margin syntax.\n"));
usage();
}
break;
break;
case 's': // page size
if (!fmt.setPageSize(optarg)) {
- fprintf(stderr, "Unknown page size %s.\n", optarg);
+ fprintf(stderr, _("Unknown page size %s.\n"), optarg);
usage();
}
break;
fmt.setTextLineHeight(TextFormat::inch(optarg));
break;
default:
- fprintf(stderr,"Unrecognized option \"%c\".\n", c);
+ fprintf(stderr, _("Unrecognized option \"%c\".\n"), c);
usage();
}
#ifdef notdef
static void
usage(void)
{
- fxFatal("usage: %s"
+ fxFatal(_("usage: %s"
" [-r vertical-res]"
" [-l page-length]"
" [-w page-width]"
" [-1] [-2] [-3]"
- " input.tif"
+ " input.tif")
, appName
);
}
} else {
struct stat sb;
if (Sys::stat(argv[optind], sb) < 0)
- emsg = "Document file is unreadable or does not exist";
+ emsg = _("Document file is unreadable or does not exist");
else
- emsg = "Document is not valid TIFF (unspecified format error)";
+ emsg = _("Document is not valid TIFF (unspecified format error)");
status = REJECT;
}
if (status != OK) {
TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &bps);
if (bps != 1) {
emsg.append(fxStr::format(
- "Document is not a bilevel image (bits/sample %u).\n", bps));
+ _("Document is not a bilevel image (bits/sample %u).\n"), bps));
status |= REIMAGE;
}
uint16 spp;
TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &spp);
if (spp != 1) {
emsg.append(fxStr::format(
- "Document is a multi-sample image (samples/pixel %u).\n", spp));
+ _("Document is a multi-sample image (samples/pixel %u).\n"), spp));
status |= REIMAGE;
}
uint16 compression = 0;
(void) TIFFGetField(tif, TIFFTAG_COMPRESSION, &compression);
if (useMMR) {
if (compression != COMPRESSION_CCITTFAX4) {
- emsg.append("Document requires reformatting, not in Group 4 format.\n");
+ emsg.append(_("Document requires reformatting, not in Group 4 format.\n"));
status |= REFORMAT;
}
} else {
if (compression != COMPRESSION_CCITTFAX3) {
- emsg.append("Document requires reformatting, not in Group 3 format.\n");
+ emsg.append(_("Document requires reformatting, not in Group 3 format.\n"));
status |= REFORMAT;
}
uint32 g3opts = 0;
(void) TIFFGetField(tif, TIFFTAG_GROUP3OPTIONS, &g3opts);
if ((g3opts ^ dataFormat) & GROUP3OPT_2DENCODING) {
- emsg.append("Document requires reformatting, not in 2DMR format.\n");
+ emsg.append(_("Document requires reformatting, not in 2DMR format.\n"));
status |= REFORMAT;
}
}
* but not if the strips are not in sequential order.
*/
if (TIFFNumberOfStrips(tif) != 1) {
- emsg.append("Document should be reformatted as a single strip.\n");
+ emsg.append(_("Document should be reformatted as a single strip.\n"));
status |= REFORMAT;
}
#ifdef notdef
uint16 fill;
(void) TIFFGetFieldDefaulted(tif, TIFFTAG_FILLORDER, &fill);
if (fill != FILLORDER_LSB2MSB) {
- emsg.append("Document should be reformatted with "
- "LSB-to-MSB bit order.\n");
+ emsg.append(_("Document should be reformatted with "
+ "LSB-to-MSB bit order.\n"));
status |= REFORMAT;
}
#endif
}
// vres is in inches, compare inches to inches, allow 15 lpi variation
if ((u_long) yresinch > vres ? (u_long) yresinch - vres > 15 : vres - (u_long) yresinch > 15) {
- emsg.append(fxStr::format("Document requires reformatting to adjust"
- " vertical resolution (convert to %lu, document is %lu).\n",
+ emsg.append(fxStr::format(_("Document requires reformatting to adjust"
+ " vertical resolution (convert to %lu, document is %lu).\n"),
vres, (u_long) yresinch));
status |= REVRES;
}
*/
uint32 w;
if (!TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w)) {
- emsg = "Document is not valid TIFF (missing ImageWidth tag).\n";
+ emsg = _("Document is not valid TIFF (missing ImageWidth tag).\n");
return (REJECT);
}
if (w != pageWidth) {
- emsg.append(fxStr::format("Document requires resizing to adjust"
- " page width (convert to %lu, document is %lu).\n",
+ emsg.append(fxStr::format(_("Document requires resizing to adjust"
+ " page width (convert to %lu, document is %lu).\n"),
(u_long) pageWidth, (u_long) w));
status |= RESIZE;
}
*/
uint32 h = 0;
if (!TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h)) {
- emsg = "Document is not valid TIFF (missing ImageLength tag).\n";
+ emsg = _("Document is not valid TIFF (missing ImageLength tag).\n");
return (REJECT);
}
/*
if (!useUnlimitedLength) {
float len = h / (yres == 0 ? 1. : yres); // page length in mm
if (pageLength != (uint32) -1 && len > pageLength) {
- emsg.append(fxStr::format("Document requires resizing to adjust"
- " page length (convert to %lu, document is %lu).\n",
+ emsg.append(fxStr::format(_("Document requires resizing to adjust"
+ " page length (convert to %lu, document is %lu).\n"),
(u_long) pageLength, (u_long) len));
status |= RESIZE;
}
struct stat sb;
int fd = open(filename, O_RDONLY);
if (fd < 0) {
- fprintf(stderr, "%s: Can not open file\n", filename);
+ fprintf(stderr, _("%s: Can not open file\n"), filename);
return (NULL);
}
if (fstat(fd, &sb) < 0) {
- fprintf(stderr, "%s: Can not stat file\n", filename);
+ fprintf(stderr, _("%s: Can not stat file\n"), filename);
close(fd);
return (NULL);
}
if ((sb.st_mode & S_IFMT) != S_IFREG) {
- fprintf(stderr, "%s: Not a regular file\n", filename);
+ fprintf(stderr, _("%s: Not a regular file\n"), filename);
close(fd);
return (NULL);
}
int cc = read(fd, buf, sizeof (buf));
close(fd);
if (cc == 0) {
- fprintf(stderr, "%s: Empty file\n", filename);
+ fprintf(stderr, _("%s: Empty file\n"), filename);
return (NULL);
}
const TypeRule* tr = typeRules->match(buf, cc);
if (!tr) {
- fprintf(stderr, "%s: Can not determine file type\n", filename);
+ fprintf(stderr, _("%s: Can not determine file type\n"), filename);
return (NULL);
}
if (tr->getResult() == TypeRule::ERROR) {
void
usage()
{
- fprintf(stderr, "usage: %s [-f rulesfile] files\n", appName);
+ fprintf(stderr, _("usage: %s [-f rulesfile] files\n"), appName);
exit(-1);
}
usage();
typeRules = TypeRules::read(file);
if (!typeRules) {
- fprintf(stderr, "Unable to setup file typing and conversion rules\n");
+ fprintf(stderr, _("Unable to setup file typing and conversion rules\n"));
return (-1);
}
typeRules->setVerbose(true);