CLI: return ZINT_ERROR_INVALID_OPTION instead of 1 on bad option and

ZINT_WARN_INVALID_OPTION instead of 0 on ignored option;
  more barcode synonyms
manual: append man page zint.1.pmd instead of CLI help;
  various tweaks and fiddlings;
  rMQR add ISO 23941 (released the other day but haven't got yet)
man page: expand and tweak
doc/Makefile: add HTML demo
This commit is contained in:
gitlost 2022-05-22 21:33:45 +01:00
parent 6537d4670f
commit 9ae4e347d7
14 changed files with 1533 additions and 593 deletions

1
.gitignore vendored
View File

@ -10,6 +10,7 @@ CMakeLists.txt.user*
backend/Makefile
frontend/Makefile
docs/manual.pdf
docs/zint.1.tex
build-*
win32/*.VC.opendb
win32/*.VC.db

View File

@ -21,6 +21,9 @@ Version 2.10.0.9 (dev) not released yet
- HANXIN, QRCODE/RMQR now warn when convert to GB 18030, Shift JIS resp.
and no ECI given
- GRIDMATRIX no longer attempts Latin-1 conversion when no ECI given
- CLI now returns ZINT_ERROR_INVALID_OPTION (8) on its failed option checks
and ZINT_WARN_INVALID_OPTION (2) on ignored options
NOTE: previously returned 1 and 0 respectively
Changes
-------
@ -74,6 +77,8 @@ Changes
- CLI: man page moved from frontend/zint.1.gz to docs/zint.1.gz, now
generated from docs/zint.1.pmd
- add README.linux to root dir
- CLI: return ZINT_ERROR_INVALID_OPTION instead of 1 on bad option and
ZINT_WARN_INVALID_OPTION instead of 0 on ignored option
Bugs
----

View File

@ -14,6 +14,9 @@ INCLUDES_PDF = $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF)
INC_PDF = --include-in-header $(INC_HEADER_PDF) --include-before-body $(INC_BEFORE_BODY_PDF)
INCLUDES_TXT = inc_header_txt.tex
INC_TXT = --include-in-header $(INCLUDES_TXT)
SOURCE_MAN_PAGE = zint.1.pmd
OUT_MAN_PAGE = zint.1
INC_HEADER_TEX_MAN = inc_header_man.tex
IMAGES = \
images/zint.png \
images/zint-qt.png \
@ -130,29 +133,55 @@ IMAGES = \
MAIN_FONT = mainfont="TeX Gyre Pagella"
MONO_FONT = monofont="Liberation Mono"
CJK_FONT = CJKmainfont="WenQuanYi Micro Hei Mono"
PDF_OPTS = --pdf-engine=xelatex --filter pandoc-tablenos --highlight-style=$(HIGHLIGHT_THEME) -V block-headings \
-V colorlinks -V geometry:margin=20mm -V papersize=a4 --dpi=300 -M tablenos-warning-level=0
PDF_OPTS = --pdf-engine=xelatex --filter pandoc-tablenos -M tablenos-warning-level=0 \
--highlight-style=$(HIGHLIGHT_THEME) -V colorlinks -V geometry:margin=20mm -V papersize=a4 --dpi=300
TEX_MAN_PAGE = zint.1.tex
TXT_OPTS = --columns 80 --eol=lf -t plain
SOURCE_MAN = zint.1.pmd
OUT_MAN = zint.1
MAN_OPTS = -t man -s
MAN_PAGE_OPTS = -s -t man
all : $(OUT_PDF) $(OUT_TXT) $(OUT_MAN)
all : $(OUT_PDF) $(OUT_TXT) $(OUT_MAN_PAGE)
$(OUT_PDF) : $(SOURCE) $(HIGHLIGHT_THEME) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) $(IMAGES) Makefile
pandoc $(SOURCE) -f markdown $(INC_PDF) --toc --toc-depth=4 \
-V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) \
$(OUT_PDF) : $(SOURCE) $(SOURCE_MAN_PAGE) $(HIGHLIGHT_THEME) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) $(IMAGES) Makefile
pandoc $(SOURCE_MAN_PAGE) -f markdown \
$(PDF_OPTS) \
-o $(TEX_MAN_PAGE)
sed -i -e 's/section{/subsection{/' $(TEX_MAN_PAGE) # Convert man page sections to subsections
pandoc $(SOURCE) -f markdown $(INC_PDF) --toc --toc-depth=4 \
-V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) -V block-headings \
$(PDF_OPTS) \
--include-after-body $(TEX_MAN_PAGE) \
-o $(OUT_PDF)
$(OUT_TXT) : $(SOURCE) $(INCLUDES_TXT) Makefile
pandoc $(SOURCE) -f markdown $(INC_TXT) --toc --toc-depth=4 \
$(OUT_TXT) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INCLUDES_TXT) Makefile
pandoc $(SOURCE) $(SOURCE_MAN_PAGE) -f markdown $(INC_TXT) --toc --toc-depth=4 \
-V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) \
$(TXT_OPTS) \
-o $(OUT_TXT)
sed -i -e 's/ *$$//' $(OUT_TXT)
# Indent Man Page sections in TOC and remove trailing spaces
sed -i \
-e 's/^\(- [A-Z][A-Z ]*\)$$/ \1/' \
-e 's/ *$$//' \
$(OUT_TXT)
$(OUT_MAN) : $(SOURCE_MAN) Makefile
pandoc $(SOURCE_MAN) -f markdown \
$(MAN_OPTS) \
-o $(OUT_MAN)
$(OUT_MAN_PAGE) : $(SOURCE_MAN_PAGE) Makefile
pandoc $(SOURCE_MAN_PAGE) -f markdown \
$(MAN_PAGE_OPTS) \
-o $(OUT_MAN_PAGE)
# HTML demo
OUT_HTML = manual.html
HTML_OPTS = --filter pandoc-tablenos -M tablenos-warning-level=0 --highlight-style=$(HIGHLIGHT_THEME) \
--eol=lf -s -t html
$(OUT_HTML) : $(SOURCE) $(SOURCE_MAN_PAGE) Makefile
pandoc $(SOURCE) $(SOURCE_MAN_PAGE) -f markdown --toc --toc-depth=4 \
-V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) \
$(HTML_OPTS) \
-o $(OUT_HTML)
# Indent Man Page sections in TOC & change Man Page sections h1 -> h2
sed -i \
-e 's/\(Man Page<\/a>\)<\/li>/\1<ul>/' \
-e 's/\(AUTHORS<\/a><\/li>\)/\1<\/ul><\/li>/' \
-e 's/^<h1\([^>]*>[A-Z][A-Z ]*<\/\)h1>$$/<h2\1h2>/' \
$(OUT_HTML)

View File

@ -13,7 +13,7 @@
%% https://github.com/jgm/pandoc/wiki/Pandoc-Tricks#definition-list-terms-on-their-own-line-in-latex
\let\originalitem\item
\makeatletter
\renewcommand{\item}[1][\@nil]{
\renewcommand{\item}[1][\@nil]{%
\def\tmp{#1}
\ifx\tmp\@nnil\originalitem\else\originalitem[#1]\hfill\par\fi}
\makeatother
@ -27,7 +27,7 @@
%% Unfortunately this messes up wrapping TODO: fix
%% Background color for inline code https://tex.stackexchange.com/a/507116
%\definecolor{icbg}{HTML}{fafafa} % Same as modified pygments.theme
%\newcommand{\code}[1]{
%\newcommand{\code}[1]{%
%\begingroup\setlength{\fboxsep}{1pt}
%\colorbox{icbg}{\oldtexttt{\hspace*{0.1pt}\vphantom{A}#1\hspace*{0.1pt}}}\endgroup}
%\renewcommand{\texttt}[1]{\textcolor{icfg}{\code{\oldtexttt{#1}}}}

View File

@ -29,29 +29,35 @@ Some of the words and phrases used in this document are specific to barcoding,
and so a brief explanation is given to help understanding:
symbol:
: A symbol is an image which encodes data according to one of the standards.
This encompasses barcodes (linear symbols) as well as any of the other
methods of representing data used in this program.
symbology:
: A method of encoding data to create a certain type of symbol.
linear:
: A linear or one-dimensional symbol is one which consists of bars and spaces,
and is what most people associate with the term 'barcode'. Examples include
Code 128.
stacked:
: A stacked symbol consists of multiple linear symbols placed one above
another and which together hold the message, usually alongside some error
correction data. Examples include PDF417.
matrix:
: A matrix symbol is one based on a (usually square) grid of elements called
modules. Examples include Data Matrix, but MaxiCode and DotCode are also
considered matrix symbologies.
composite:
: A composite symbology is one which is made up of elements which are both
linear and stacked. Those currently supported are made up of a linear
'primary' message above which is printed a stacked component based on the
@ -59,6 +65,7 @@ composite:
linear and the stacked components.
X-dimension:
: The X-dimension of a symbol is the size (usually the width) of the smallest
element. For a linear symbology this is the width of the smallest bar. For
matrix symbologies it is the width of the smallest module (usually a
@ -68,11 +75,13 @@ X-dimension:
is determined by the width.
GS1 data:
: This is a structured way of representing information which consists of
'chunks' of data, each of which starts with an Application Identifier (AI).
The AI identifies what type of information is being encoded.
Reader Initialisation:
Reader Initialisation (Programming):
: Some symbologies allow a special character to be included which can be
detected by the scanning equipment as signifying that the data is used to
program or change settings in that equipment. This data is usually not
@ -81,6 +90,7 @@ Reader Initialisation:
to your scanner.
ECI:
: The Extended Channel Interpretations (ECI) mechanism allows for
multi-language data to be encoded in symbols which would usually support
only Latin-1 (ISO/IEC 8859-1 plus ASCII) characters. This can be useful, for
@ -90,10 +100,12 @@ ECI:
Two other concepts that are important are raster and vector.
raster:
: A low level bitmap representation of an image. BMP, GIF, PCX, PNG and TIF
are raster file formats.
vector:
: A high level command- or data-based representation of an image. EMF, EPS
and SVG are vector file formats. They require renderers to turn them into
bitmaps.
@ -245,13 +257,13 @@ preview.
## 3.2 Composite Groupbox
![Zint Barcode Studio encoding GS1 composite data](images/gui_composite.png)
![Zint Barcode Studio encoding GS1 Composite data](images/gui_composite.png)
In the middle of the Data tab is an area for creating composite symbologies
which appears when the currently selected symbology is supported by the
composite symbology standard. GS1 data can then be entered with square brackets
used to separate Application Identifier (AI) information from data as shown
here. For details, see [6.3 Composite Symbols (ISO 24723)].
GS1 Composite symbology standard. GS1 data can then be entered with square
brackets used to separate Application Identifier (AI) information from data as
shown here. For details, see [6.3 GS1 Composite Symbols (ISO 24723)].
## 3.3 Additional ECI/Data Segments Groupbox
@ -280,8 +292,8 @@ part of a Structured Append sequence of symbols.
The Appearance tab can be used to adjust the dimensions and other properties of
the symbol. The `"Height"` value affects the height of symbologies which do not
have a fixed width-to-height ratio, i.e. those other than matrix symbologies.
Boundary bars (`"Border Type"`) can be added and adjusted and the size of the
saved image (`"Printing Scale"`) can be determined.
Boundary bars (`"Border Type"`) can be added and adjusted (`"Border Width"`) and
the size of the saved image (`"Printing Scale"`) can be determined.
## 3.6 Colour Dialog
@ -711,10 +723,11 @@ Value
Table: {#tbl:barcode_types tag=": Barcode Types (Symbologies)"}
[^2]: The symbologies marked with an asterisk (`*`) in the above table used
different names in Zint before version 2.9.0. For example, symbology 29 used the
name `BARCODE_RSS14`. These names are now deprecated but are still recognised by
Zint and will continue to be supported in future versions.
[^2]: The symbologies marked with an asterisk (`*`) in Table
{@tbl:barcode_types} above used different names in Zint before version 2.9.0.
For example, symbology 29 used the name `BARCODE_RSS14`. These names are now
deprecated but are still recognised by Zint and will continue to be supported in
future versions.
## 4.4 Adjusting Height
@ -803,8 +816,8 @@ symbol by corrupting a scan if the scanning beam strays off the top or bottom of
the symbol. Zint can also put a border right around the symbol and its
horizontal whitespace with the `--box` option.
The width of the boundary or box must be specified using the `--border` switch.
For example:
The width of the boundary bars or box borders must be specified using the
`--border` switch. For example:
```bash
zint --box --border=10 -w 10 -d "This Text"
@ -1759,10 +1772,11 @@ Variable Name Type Meaning Default Value
Table: API Structure `zint_symbol` {#tbl:api_structure_zint_symbol tag="$ $"}
[^5]: This value is ignored for Aztec (including HIBC and Aztec Rune), Code One,
Data Matrix (including HIBC), DotCode, Grid Matrix, Han Xin, MaxiCode, QR Code
(including HIBC, Micro QR, rMQR and UPNQR), and Ultracode - all of which have a
fixed width-to-height ratio (or, in the case of Code One, a fixed height).
[^5]: The `height` value is ignored for Aztec (including HIBC and Aztec Rune),
Code One, Data Matrix (including HIBC), DotCode, Grid Matrix, Han Xin, MaxiCode,
QR Code (including HIBC, Micro QR, rMQR and UPNQR), and Ultracode - all of which
have a fixed width-to-height ratio (or, in the case of Code One, a fixed
height).
To alter these values use the syntax shown in the example below. This code has
the same result as the previous example except the output is now taller and
@ -1929,8 +1943,8 @@ Value Effect
`BARCODE_STDOUT` Output the file to stdout.
`READER_INIT` Add a reader initialisation symbol to the data
before encoding.
`READER_INIT` Create as a Reader Initialisation (Programming)
symbol.
`SMALL_TEXT` Use a smaller font for the Human Readable Text.
@ -1958,10 +1972,10 @@ Value Effect
Table: API `output_options` Values {#tbl:api_output_options tag="$ $"}
[^6]: This flag is always set for Codablock-F, Code 16K and Code 49. Special
considerations apply to ITF-14 - see [6.1.2.6 ITF-14].
[^6]: The `BARCODE_BIND` flag is always set for Codablock-F, Code 16K and Code
49. Special considerations apply to ITF-14 - see [6.1.2.6 ITF-14].
[^7]: Codablock-F, Code 16K, Code 49, ITF-14, EAN-2 to EAN-13, ISBN,
[^7]: Codablock-F, Code 16K, Code 49, EAN-2 to EAN-13, ISBN, ITF-14,
UPC-A and UPC-E have compliant quiet zones added by default.
\clearpage
@ -2160,7 +2174,7 @@ Value Meaning
is it UPC/EAN?)
`ZINT_CAP_COMPOSITE` Does the symbology support composite data? (see [6.3
Composite Symbols (ISO 24723)] below)
GS1 Composite Symbols (ISO 24723)] below)
`ZINT_CAP_ECI` Does the symbology support Extended Channel
Interpretations?
@ -2296,7 +2310,7 @@ Human Readable Text, set `--vers=2` (API `option_2 = 2`).
![`zint -b ITF14 --compliantheight -d "9212320967145"`](images/itf14.svg)
ITF-14, also known as UPC Shipping Container Symbol or Case Code, is based on
Interleaved Code 2 of 5 and requires a 13 digit numeric input (digits 0-9). One
Interleaved Code 2 of 5 and requires a 13-digit numeric input (digits 0-9). One
modulo-10 check digit is added by Zint.
If no border option is specified Zint defaults to adding a bounding box with a
@ -2332,7 +2346,7 @@ check digit.
![`zint -b UPCA --compliantheight -d "72527270270"`](images/upca.svg)
UPC-A is used in the United States for retail applications. The symbol requires
an 11 digit article number. The check digit is calculated by Zint. In addition
an 11-digit article number. The check digit is calculated by Zint. In addition
EAN-2 and EAN-5 add-on symbols can be added using the + character. For example,
to draw a UPC-A symbol with the data 72527270270 with an EAN-5 add-on showing
the data 12345 use the command:
@ -2352,7 +2366,7 @@ error = ZBarcode_Encode_and_Print(my_symbol, "72527270270+12345", 0, 0);
![`zint -b UPCA --compliantheight -d "72527270270+12345"`](images/upca_5.svg)
If your input data already includes the check digit symbology `BARCODE_UPCA_CHK`
(35) can be used which takes a 12 digit input and validates the check digit
(35) can be used which takes a 12-digit input and validates the check digit
before encoding.
You can adjust the gap between the main symbol and an add-on in multiples of
@ -2366,7 +2380,7 @@ to a value between 0 and 20 (default 5).
![`zint -b UPCE --compliantheight -d "1123456"`](images/upce.svg)
UPC-E is a zero-compressed version of UPC-A developed for smaller packages. The
code requires a 6 digit article number (digits 0-9). The check digit is
code requires a 6-digit article number (digits 0-9). The check digit is
calculated by Zint. EAN-2 and EAN-5 add-on symbols can be added using the +
character as with UPC-A. In addition Zint also supports Number System 1
encoding by entering a 7-digit article number stating with the digit 1. For
@ -2385,7 +2399,7 @@ error = ZBarcode_Encode_and_Print(my_symbol, "1123456", 0, 0);
```
If your input data already includes the check digit symbology `BARCODE_UPCE_CHK`
(38) can be used which takes a 7 or 8 digit input and validates the check digit
(38) can be used which takes a 7 or 8-digit input and validates the check digit
before encoding.
You can adjust the gap between the main symbol and an add-on in multiples of
@ -2401,7 +2415,7 @@ to a value between 0 and 20 (default 5).
![`zint -b EANX --compliantheight -d "4512345678906"`](images/eanx13.svg)
The EAN system is used in retail across Europe and includes standards for EAN-2,
EAN-5, EAN-8 and EAN-13 which encode 2, 5, 7 or 12 digit numbers respectively.
EAN-5, EAN-8 and EAN-13 which encode 2, 5, 7 or 12-digit numbers respectively.
Zint will decide which symbology to use depending on the length of the input
data. In addition EAN-2 and EAN-5 add-on symbols can be added to EAN-8 and
EAN-13 symbols using the + character as with UPC symbols. For example:
@ -2435,7 +2449,7 @@ All of the EAN symbols include check digits which are added by Zint.
If you are encoding an EAN-8 or EAN-13 symbol and your data already includes
the check digit then you can use symbology `BARCODE_EANX_CHK` (14) which takes
an 8 or 13 digit input and validates the check digit before encoding.
an 8 or 13-digit input and validates the check digit before encoding.
You can adjust the gap between the main symbol and an add-on in multiples of
the X-dimension by setting `--addongap` (API `option_2`) to a value between 7
@ -2547,7 +2561,7 @@ shown in the Human Readable Text, but may be shown by setting `--vers=1` (API
![`zint -b PZN --compliantheight -d "2758089"`](images/pzn.svg)
PZN is a Code 39 based symbology used by the pharmaceutical industry in Germany.
PZN encodes a 7 digit number to which Zint will add a modulo-11 check digit.
PZN encodes a 7-digit number to which Zint will add a modulo-11 check digit.
#### 6.1.7.5 LOGMARS
@ -2630,7 +2644,7 @@ ISO/IEC 8859-1 character set is shown in Appendix [A.2 Latin Alphabet No. 1
![`zint -b CODE128B -d "130170X178"`](images/code128b.svg)
It is sometimes advantageous to stop Code 128 from using subset mode C which
compresses numerical data. The `BARCODE_CODE128B` option (symbology 60)
compresses numerical data. The `BARCODE_CODE128B` variant (symbology 60)
suppresses mode C in favour of mode B.
#### 6.1.10.3 GS1-128
@ -2668,7 +2682,7 @@ zint -b 16 --gs1parens -d "(01)98898765432106(3202)012345(15)991231"
![`zint -b EAN14 --compliantheight -d "9889876543210"`](images/ean14.svg)
A shorter version of GS1-128 which encodes GTIN data only. A 13 digit number is
A shorter version of GS1-128 which encodes GTIN data only. A 13-digit number is
required. The GTIN check digit and AI (01) are added by Zint.
#### 6.1.10.5 NVE-18 (SSCC-18)
@ -2677,7 +2691,7 @@ required. The GTIN check digit and AI (01) are added by Zint.
A variation of Code 128 the 'Nummer der Versandeinheit' standard, also known
as SSCC-18 (Serial Shipping Container Code), includes both modulo-10 and
modulo-103 check digits. NVE-18 requires a 17 digit numerical input. Check
modulo-103 check digits. NVE-18 requires a 17-digit numerical input. Check
digits and AI (00) are added by Zint.
#### 6.1.10.6 HIBC Code 128
@ -2702,15 +2716,15 @@ specified by DPD and adds a modulo-36 check character.
Previously known as RSS (Reduced Spaced Symbology) these symbols are due to
replace GS1-128 symbols in accordance with the GS1 General Specifications. If a
GS1 DataBar symbol is to be printed with a 2D component as specified in ISO/IEC
24723 set `--mode=2` (API `option_1 = 2`). See [6.3 Composite Symbols (ISO
24723 set `--mode=2` (API `option_1 = 2`). See [6.3 GS1 Composite Symbols (ISO
24723)] to find out how to generate DataBar symbols with 2D components.
#### 6.1.11.1 GS1 DataBar Omnidirectional and GS1 DataBar Truncated
![`zint -b DBAR_OMN --compliantheight -d "0950110153001"`](images/dbar_omn.svg)
Previously known as RSS-14 this standard encodes a 13 digit item code. A check
digit and Application Identifier of (01) are added by Zint. (A 14 digit code
Previously known as RSS-14 this standard encodes a 13-digit item code. A check
digit and Application Identifier of (01) are added by Zint. (A 14-digit code
that appends the check digit may be given, in which case the check digit will be
verified.) To produce a truncated symbol set the symbol height to a value
between 13 and 32. Truncated symbols may not be scannable by omnidirectional
@ -2723,11 +2737,11 @@ greater.
![`zint -b DBAR_LTD --compliantheight -d "0950110153001"`](images/dbar_ltd.svg)
Previously known as RSS Limited this standard encodes a 13 digit item code and
Previously known as RSS Limited this standard encodes a 13-digit item code and
can be used in the same way as DataBar Omnidirectional above. DataBar Limited,
however, is limited to data starting with digits 0 and 1 (i.e. numbers in the
range 0 to 1999999999999). As with DataBar Omnidirectional a check digit and
Application Identifier of (01) are added by Zint, and a 14 digit code may be
Application Identifier of (01) are added by Zint, and a 14-digit code may be
given in which case the check digit will be verified.
#### 6.1.11.3 GS1 DataBar Expanded
@ -2757,7 +2771,7 @@ zint -b 31 -d "[01]98898765432106[3202]012345[15]991231"
![`zint -b KOREAPOST -d "923457"`](images/koreapost.svg)
The Korean Postal Barcode is used to encode a six-digit number and includes one
The Korean Postal Barcode is used to encode a 6-digit number and includes one
check digit.
### 6.1.13 Channel Code
@ -2786,7 +2800,7 @@ Table: {#tbl:channel_maxima tag=": Channel Maximum Values"}
\clearpage
## 6.2 Stacked Symbols
## 6.2 Stacked Symbologies
### 6.2.1 Basic Symbol Stacking
@ -2968,7 +2982,7 @@ minimum number of rows to use can be set using the `--rows` option (API
\clearpage
## 6.3 Composite Symbols (ISO 24723)
## 6.3 GS1 Composite Symbols (ISO 24723)
Composite symbols employ a mixture of components to give more comprehensive
information about a product. The permissible contents of a composite symbol is
@ -3097,9 +3111,9 @@ pharmaceuticals. The symbology is able to encode whole numbers between 4 and
Used by the United States Postal Service until 2009, the POSTNET barcode was
used for encoding zip-codes on mail items. POSTNET uses numerical input data
and includes a modulo-10 check digit. While Zint will encode POSTNET symbols of
up to 38 digits in length, standard lengths as used by USPS were `PostNet6` (5
digit ZIP input), `PostNet10` (5 digit ZIP + 4 digit user data) and `PostNet12`
(5 digit ZIP + 6 digit user data).
up to 38 digits in length, standard lengths as used by USPS were `PostNet6`
(5-digit ZIP input), `PostNet10` (5-digit ZIP + 4-digit user data) and
`PostNet12` (5-digit ZIP + 6-digit user data).
### 6.4.3 PLANET
@ -3109,7 +3123,7 @@ Used by the United States Postal Service until 2009, the PLANET (Postal Alpha
Numeric Encoding Technique) barcode was used for encoding routing data on mail
items. PLANET uses numerical input data and includes a modulo-10 check digit.
While Zint will encode PLANET symbols of up to 38 digits in length, standard
lengths used by USPS were `Planet12` (11 digit input) and `Planet14` (13 digit
lengths used by USPS were `Planet12` (11-digit input) and `Planet14` (13-digit
input).
\clearpage
@ -3131,20 +3145,20 @@ included in the input data. Reed-Solomon error correction data is generated by
Zint. Encoding behaviour is determined by the length of the input data according
to the formula shown in the following table:
----------------------------------------------------------
Input Required Input Format Symbol FCC Encoding
Length Length Table
------ ----------------------- ------ --- --------
8 99999999 37-bar 11 None
-------------------------------------------------------------
Input Required Input Format Symbol FCC Encoding
Length Length Table
------ ------------------------- ------ --- --------
8 `99999999` 37-bar 11 None
13 99999999AAAAA 52-bar 59 C
13 `99999999AAAAA` 52-bar 59 C
16 9999999999999999 52-bar 59 N
16 `9999999999999999` 52-bar 59 N
18 99999999AAAAAAAAAA 67-bar 62 C
18 `99999999AAAAAAAAAA` 67-bar 62 C
23 99999999999999999999999 67-bar 62 N
----------------------------------------------------------
23 `99999999999999999999999` 67-bar 62 N
-------------------------------------------------------------
Table: {#tbl:auspost_input_formats tag=": Australia Post Input Formats"}
@ -3208,7 +3222,7 @@ Also known as the OneCode barcode and used in the US by the United States Postal
Service (USPS), the Intelligent Mail system replaced the POSTNET and PLANET
symbologies in 2009. Intelligent Mail is a fixed length (65-bar) symbol which
combines routing and customer information in a single symbol. Input data
consists of a 20 digit tracking code, followed by a dash (`-`), followed by a
consists of a 20-digit tracking code, followed by a dash (`-`), followed by a
delivery point zip-code which can be 0, 5, 9 or 11 digits in length. For example
all of the following inputs are valid data entries:
@ -3428,7 +3442,7 @@ specified by using the `--mask` switch with values 0-3, or in the API by setting
option_3 = ZINT_FULL_MULTIBYTE | (N + 1) << 8
```
### 6.6.4 Rectangular Micro QR Code (rMQR)
### 6.6.4 Rectangular Micro QR Code (rMQR) (ISO 23941)
![`zint -b RMQR -d "0123456"`](images/rmqr.svg)
@ -3519,8 +3533,8 @@ Characters Meaning
unused characters can be filled with the SPACE character
(ASCII 32) or omitted (if omitted adjust the following
character positions).
10 - 12 Three digit country code according to ISO 3166-1.
13 - 15 Three digit service code. This depends on your parcel courier.
10 - 12 Three-digit country code according to ISO 3166-1.
13 - 15 Three-digit service code. This depends on your parcel courier.
Table: {#tbl:maxicode_scm tag=": MaxiCode Structured Carrier Message Format"}
@ -4062,13 +4076,11 @@ international standards:
- ISO/IEC 21471:2020 Information technology - Automatic identification and data
capture techniques - Extended rectangular data matrix (DMRE) bar code
symbology specification
- Uniform Symbology Specification Code One (AIM Inc., 1994)
- AIM Uniform Symbology Specification Code One (1994)
- ANSI/AIM BC12-1998 - Uniform Symbology Specification Channel Code
- ANSI/AIM BC6-2000 - Uniform Symbology Specification Code 49
- ANSI/AIM BC5-1995 - Uniform Symbology Specification Code 93
- ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling
Standard
- AIM ISS-X-24 - Uniform Symbology Specification Codablock-F
- AIM Europe ISS-X-24 - Uniform Symbology Specification Codablock-F (1995)
- AIM TSC1705001 (v 4.0 Draft 0.15) - Information technology - Automatic
identification and data capture techniques - Bar code symbology
specification - DotCode (Revised 28th May 2019)
@ -4077,6 +4089,8 @@ international standards:
(Released 9th Dec 2008)
- AIMD/TSC15032-43 (v 0.99c) - International Technical Specification -
Ultracode Symbology (Draft) (Released 4th Nov 2015)
- ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling
Standard
- GS1 General Specifications Release 22.0 (Jan 2022)
- AIM ITS/04-001 International Technical Standard - Extended Channel
Interpretations Part 1: Identification Schemes and Protocol (Released 24th
@ -4147,71 +4161,4 @@ F `¯` `¿` `Ï` `ß` `ï` `ÿ`
Table: {#tbl:iso_iec_8869_1 tag=": ISO/IEC 8859-1"}
# B. CLI Help
```
Zint version 2.10.0.9
Encode input data in a barcode and save as BMP/EMF/EPS/GIF/PCX/PNG/SVG/TIF/TXT
-b, --barcode=TYPE Number or name of barcode type. Default is 20 (CODE128)
--addongap=NUMBER Set add-on gap in multiples of X-dimension for UPC/EAN
--batch Treat each line of input file as a separate data set
--bg=COLOUR Specify a background colour (in hex RGB/RGBA)
--binary Treat input as raw binary data
--bind Add boundary bars
--bold Use bold text
--border=NUMBER Set width of border in multiples of X-dimension
--box Add a box around the symbol
--cmyk Use CMYK colour space in EPS/TIF symbols
--cols=NUMBER Set the number of data columns in symbol
--compliantheight Warn if height not compliant, and use standard default
-d, --data=DATA Set the symbol data content (segment 0)
--direct Send output to stdout
--dmre Allow Data Matrix Rectangular Extended
--dotsize=NUMBER Set radius of dots in dotty mode
--dotty Use dots instead of squares for matrix symbols
--dump Dump hexadecimal representation to stdout
-e, --ecinos Display ECI (Extended Channel Interpretation) table
--eci=NUMBER Set the ECI code for the data (segment 0)
--esc Process escape characters in input data
--fast Use faster encodation (Data Matrix)
--fg=COLOUR Specify a foreground colour (in hex RGB/RGBA)
--filetype=TYPE Set output file type BMP/EMF/EPS/GIF/PCX/PNG/SVG/TIF/TXT
--fullmultibyte Use multibyte for binary/Latin (QR/Han Xin/Grid Matrix)
--gs1 Treat input as GS1 compatible data
--gs1nocheck Do not check validity of GS1 data
--gs1parens Process parentheses "()" as GS1 AI delimiters, not "[]"
--gssep Use separator GS for GS1 (Data Matrix)
--guarddescent=NUMBER Set height of guard bar descent in X-dims (UPC/EAN)
-h, --help Display help message
--height=NUMBER Set height of symbol in multiples of X-dimension
--heightperrow Treat height as per-row
-i, --input=FILE Read input data from FILE
--init Create reader initialisation/programming symbol
--mask=NUMBER Set masking pattern to use (QR/Han Xin/DotCode)
--mirror Use batch data to determine filename
--mode=NUMBER Set encoding mode (MaxiCode/Composite)
--nobackground Remove background (EMF/EPS/GIF/PNG/SVG/TIF only)
--noquietzones Disable default quiet zones
--notext Remove human readable text
-o, --output=FILE Send output to FILE. Default is out.png
--primary=STRING Set primary message (MaxiCode/Composite)
--quietzones Add compliant quiet zones
-r, --reverse Reverse colours (white on black)
--rotate=NUMBER Rotate symbol by NUMBER degrees
--rows=NUMBER Set number of rows (Codablock-F/PDF417)
--scale=NUMBER Adjust size of X-dimension
--scmvv=NUMBER Prefix SCM with "[)>\R01\Gvv" (vv is NUMBER) (MaxiCode)
--secure=NUMBER Set error correction level (ECC)
--segN=ECI,DATA Set the ECI & data content for segment N, where N 1 to 9
--separator=NUMBER Set height of row separator bars (stacked symbologies)
--small Use small text
--square Force Data Matrix symbols to be square
--structapp=I,C[,ID] Set Structured Append info (I index, C count)
-t, --types Display table of barcode types
--vers=NUMBER Set symbol version (size, check digits, other options)
-v, --version Display Zint version
--vwhitesp=NUMBER Set height of vertical whitespace in multiples of X-dim
-w, --whitesp=NUMBER Set width of horizontal whitespace in multiples of X-dim
--werror Convert all warnings into errors
```
# B. zint(1) Man Page

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,11 @@
zint takes input data from the command line or a file to encode in a
barcode which is then output to an image file.
.PP
Input data is UTF-8, unless \f[V]--binary\f[R] is specified.
.PP
Human Readable Text (HRT) is displayed by default for those barcodes
that support HRT, unless \f[V]--notext\f[R] is specified.
.PP
The output image file (specified with \f[V]-o\f[R] or
\f[V]--output\f[R]) may be in one of these formats: Windows Bitmap
(\f[V]BMP\f[R]), Enhanced Metafile Format (\f[V]EMF\f[R]), Encapsulated
@ -76,7 +81,7 @@ Automatic code page translation to an ECI page is disabled, and no
validation of the data\[cq]s character encoding takes place.
.TP
\f[V]--bind\f[R]
Add horizontal boundary bars, aka bearer bars, to the symbol.
Add horizontal boundary bars (also known as bearer bars) to the symbol.
The width of the boundary bars must be specified by the
\f[V]--border\f[R] option.
\f[V]--bind\f[R] can also be used to add row separator bars to symbols
@ -85,7 +90,7 @@ case the width of the separator bars must be specified with the
\f[V]--separator\f[R] option.
.TP
\f[V]--bold\f[R]
Use bold text for the Human Readable Text.
Use bold text for the Human Readable Text (HRT).
.TP
\f[V]--border=INTEGER\f[R]
Set the width of boundary bars (\f[V]--bind\f[R]) or box borders
@ -103,8 +108,8 @@ Use the CMYK colour space when outputting to Encapsulated PostScript
.TP
\f[V]--cols=INTEGER\f[R]
Set the number of data columns in the symbol to \f[I]INTEGER\f[R].
Affects Codablock-F, PDF417, MicroPDF417, GS1 DataBar Expanded Stacked
(DBAR_EXPSTK) and DotCode symbols.
Affects Codablock-F, DotCode, GS1 DataBar Expanded Stacked
(DBAR_EXPSTK), MicroPDF417 and PDF417 symbols.
.TP
\f[V]--compliantheight\f[R]
Warn if the height specified by the \f[V]--height\f[R] option is not
@ -122,6 +127,7 @@ is given, in which case it can be anything.
\f[V]--direct\f[R]
Send output to stdout, which in most cases should be re-directed to a
pipe or a file.
Use \f[V]--filetype\f[R] to specify output format.
.TP
\f[V]--dmre\f[R]
For Data Matrix symbols, allow Data Matrix Rectangular Extended (RMRE)
@ -140,6 +146,9 @@ DotCode is always in dotty mode.
\f[V]--dump\f[R]
Dump a hexadecimal representation of the symbol\[cq]s encodation to
stdout.
The same representation may be outputted to a file by using a
\f[V].txt\f[R] extension with \f[V]-o\f[R] or \f[V]--output\f[R] or by
specifying \f[V]--filetype=txt\f[R].
.TP
\f[V]-e\f[R], \f[V]--ecinos\f[R]
Display the table of ECIs (Extended Channel Interpretations).
@ -147,42 +156,36 @@ Display the table of ECIs (Extended Channel Interpretations).
\f[V]--eci=INTEGER\f[R]
Set the ECI code for the input data to \f[I]INTEGER\f[R].
See \f[V]-e\f[R] or \f[V]--ecinos\f[R] for a list of the ECIs available.
ECIs are supported by Aztec Code, Code One, Data Matrix, DotCode, Grid
Matrix, Han Xin Code, MaxiCode, MicroPDF417, PDF417, QR Code, rMQR and
Ultracode
.TP
\f[V]--esc\f[R]
Process escape characters in the input data.
The escape sequences are:
.RS
.IP \[bu] 2
\f[V]\[rs]0\f[R] (0x00) \f[V]NUL\f[R] Null character
.IP \[bu] 2
\f[V]\[rs]E\f[R] (0x04) \f[V]EOT\f[R] End of Transmission
.IP \[bu] 2
\f[V]\[rs]a\f[R] (0x07) \f[V]BEL\f[R] Bell
.IP \[bu] 2
\f[V]\[rs]b\f[R] (0x08) \f[V]BS\f[R] Backspace
.IP \[bu] 2
\f[V]\[rs]t\f[R] (0x09) \f[V]HT\f[R] Horizontal Tab
.IP \[bu] 2
\f[V]\[rs]n\f[R] (0x0A) \f[V]LF\f[R] Line Feed
.IP \[bu] 2
\f[V]\[rs]v\f[R] (0x0B) \f[V]VT\f[R] Vertical Tab
.IP \[bu] 2
\f[V]\[rs]f\f[R] (0x0C) \f[V]FF\f[R] Form Feed
.IP \[bu] 2
\f[V]\[rs]r\f[R] (0x0D) \f[V]CR\f[R] Carriage Return
.IP \[bu] 2
\f[V]\[rs]e\f[R] (0x1B) \f[V]ESC\f[R] Escape
.IP \[bu] 2
\f[V]\[rs]G\f[R] (0x1D) \f[V]GS\f[R] Group Separator
.IP \[bu] 2
\f[V]\[rs]R\f[R] (0x1E) \f[V]RS\f[R] Record Separator
.IP \[bu] 2
\f[V]\[rs]\[rs]\f[R] (0x5C) \f[V]\[rs]\f[R] Backslash
.IP \[bu] 2
\f[V]\[rs]xNN\f[R] (0xNN) Any 8-bit character where NN is hexadecimal
.IP \[bu] 2
\f[V]\[rs]uNNNN\f[R] (U+NNNN) Any 16-bit Unicode BMP character where
NNNN is hexadecimal
.IP
.nf
\f[C]
\[rs]0 (0x00) NUL Null character
\[rs]E (0x04) EOT End of Transmission
\[rs]a (0x07) BEL Bell
\[rs]b (0x08) BS Backspace
\[rs]t (0x09) HT Horizontal Tab
\[rs]n (0x0A) LF Line Feed
\[rs]v (0x0B) VT Vertical Tab
\[rs]f (0x0C) FF Form Feed
\[rs]r (0x0D) CR Carriage Return
\[rs]e (0x1B) ESC Escape
\[rs]G (0x1D) GS Group Separator
\[rs]R (0x1E) RS Record Separator
\[rs]\[rs] (0x5C) \[rs] Backslash
\[rs]xNN (0xNN) Any 8-bit character where NN is
hexadecimal
\[rs]uNNNN (U+NNNN) Any 16-bit Unicode BMP character
where NNNN is hexadecimal
\f[R]
.fi
.RE
.TP
\f[V]--fast\f[R]
@ -200,7 +203,7 @@ Set the output file type to \f[I]TYPE\f[R], which is one of
\f[V]TXT\f[R].
.TP
\f[V]--fullmultibyte\f[R]
Use the multibyte modes of QR Code, Han Xin, and Grid Matrix for
Use the multibyte modes of Grid Matrix, Han Xin and QR Code for
non-ASCII data.
.TP
\f[V]--gs1\f[R]
@ -214,7 +217,7 @@ Do not check the validity of GS1 data.
\f[V]--gs1parens\f[R]
Process parentheses \f[V]\[dq]()\[dq]\f[R] as GS1 AI delimiters, rather
than square brackets \f[V]\[dq][]\[dq]\f[R].
The input data must not contain parentheses.
The input data must not otherwise contain parentheses.
.TP
\f[V]--gssep\f[R]
For Data Matrix in GS1 mode, use \f[V]GS\f[R] (0x1D) as the GS1 data
@ -239,10 +242,10 @@ Affects Codablock-F, Code16K, Code 49, GS1 DataBar Expanded Stacked
Read the input data from \f[I]FILE\f[R].
.TP
\f[V]--init\f[R]
Create a reader initialisation/programming symbol.
Create a Reader Initialisation (Programming) symbol.
.TP
\f[V]--mask=INTEGER\f[R]
Set the masking pattern to use for QR Code, Han Xin or DotCode to
Set the masking pattern to use for DotCode, Han Xin or QR Code to
\f[I]INTEGER\f[R], overriding the automatic selection.
.TP
\f[V]--mirror\f[R]
@ -250,9 +253,34 @@ Use the batch data to determine the filename in batch mode
(\f[V]--batch\f[R]).
.TP
\f[V]--mode=INTEGER\f[R]
For MaxiCode and composite symbols, set the encoding mode to
For MaxiCode and Composite symbols, set the encoding mode to
\f[I]INTEGER\f[R].
The meaning is symbol-specific.
.RS
.PP
For MaxiCode (SCM is Structured Carrier Message, with 3 fields:
postcode, 3-digit ISO 3166-1 country code, 3-digit service code):
.IP
.nf
\f[C]
2 SCM with 9-digit numeric postcode
3 SCM with 6-character alphanumeric postcode
4 Enhanced ECC for the primary part of the message
5 Enhanced ECC for all of the message
6 Reader Initialisation (Programming)
\f[R]
.fi
.PP
For Composite symbols (names end in \f[V]_CC\f[R], i.e.\ EANX_CC,
GS1_128_CC, DBAR_OMN_CC etc.):
.IP
.nf
\f[C]
1 CC-A
2 CC-B
3 CC-C (GS1_128_CC only)
\f[R]
.fi
.RE
.TP
\f[V]--nobackground\f[R]
Remove the background colour (EMF, EPS, GIF, PNG, SVG and TIF only).
@ -261,7 +289,7 @@ Remove the background colour (EMF, EPS, GIF, PNG, SVG and TIF only).
Disable any quiet zones for symbols that define them by default.
.TP
\f[V]--notext\f[R]
Remove the Human Readable Text.
Remove the Human Readable Text (HRT).
.TP
\f[V]-o\f[R], \f[V]--output=FILE\f[R]
Send the output to \f[I]FILE\f[R].
@ -270,14 +298,15 @@ When not in batch mode, the default is \[lq]out.png\[rq] (or
When in batch mode (\f[V]--batch\f[R]), special characters can be used
to format the output filenames:
.RS
.IP \[bu] 2
\f[V]\[ti]\f[R] Insert a number or 0
.IP \[bu] 2
\f[V]#\f[R] Insert a number or space
.IP \[bu] 2
\f[V]\[at]\f[R] Insert a number or \f[V]*\f[R]
.IP \[bu] 2
Any other Insert literally
.IP
.nf
\f[C]
\[ti] Insert a number or 0
# Insert a number or space
\[at] Insert a number or *
Any other Insert literally
\f[R]
.fi
.RE
.TP
\f[V]--primary=STRING\f[R]
@ -286,6 +315,8 @@ For Composite symbols, set the content of the linear symbol.
.TP
\f[V]--quietzones\f[R]
Add compliant quiet zones for symbols that specify one.
This is in addition to any whitespace specified by \f[V]-w\f[R] or
\f[V]--whitesp\f[R] or \f[V]--vwhitesp\f[R].
.TP
\f[V]-r\f[R], \f[V]--reverse\f[R]
Reverse the foreground and background colours (white on black).
@ -310,9 +341,23 @@ For MaxiCode, prefix the Structured Carrier Message (SCM) with
\f[I]INTEGER\f[R].
.TP
\f[V]--secure=INTEGER\f[R]
Set the error correction level (ECC) or check character options to
\f[I]INTEGER\f[R].
The meaning is symbol-specific.
Set the error correction level (ECC) to \f[I]INTEGER\f[R].
The meaning is specific to the following matrix symbols:
.RS
.IP
.nf
\f[C]
Aztec Code 1 to 4 (10%, 23%, 36%, 50%) (approx.)
Grid Matrix 1 to 5 (10% to 50%) (approx.)
Han Xin 1 to 4 (8%, 15%, 23%, 30%) (approx.)
Micro QR 1 to 3 (L, M, Q)
PDF417 0 to 8 (2\[ha](INTEGER + 1) codewords)
QR Code 1 to 4 (L, M, Q, H)
rMQR 2 or 4 (M, H)
Ultracode 1 to 6 (0%, 5%, 9%, 17%, 25%, 33%) (approx.)
\f[R]
.fi
.RE
.TP
\f[V]--segN=ECI,DATA\f[R]
Set the \f[I]ECI\f[R] & \f[I]DATA\f[R] content for segment N, where N is
@ -326,7 +371,7 @@ Set the height of row separator bars for stacked symbologies, where
\f[I]INTEGER\f[R] is in integral multiples of the X-dimension.
.TP
\f[V]--small\f[R]
Use small text for Human Readable Text.
Use small text for Human Readable Text (HRT).
.TP
\f[V]--square\f[R]
For Data Matrix symbols, exclude rectangular sizes when considering
@ -337,6 +382,9 @@ Set Structured Append info, where \f[V]I\f[R] is the 1-based index,
\f[V]C\f[R] is the count of total symbols in the sequence, and
\f[V]ID\f[R], which is optional, is the identifier that all symbols in
the sequence share.
Structured Append is supported by Aztec Code, Code One, Data Matrix,
DotCode, Grid Matrix, MaxiCode, MicroPDF417, PDF417, QR Code and
Ultracode.
.TP
\f[V]-t\f[R], \f[V]--types\f[R]
Display the table of barcode types (symbologies).
@ -347,12 +395,60 @@ The numbers or names can be used with \f[V]-b\f[R] or
Set the symbol version (size, check digits, other options) to
\f[I]INTEGER\f[R].
The meaning is symbol-specific.
For most matrix symbols, it specifies size.
For a number of linear symbols, it specifies check character options.
For a few other symbologies, it specifies other characteristics.
.RS
.PP
For most matrix symbols, it specifies size:
.IP
.nf
\f[C]
Aztec Code 1 to 36 (1 to 4 compact)
Code One 1 to 10
Data Matrix 1 to 48 (31 to 48 DMRE)
Grid Matrix 1 to 13
Han Xin 1 to 84
Micro QR 1 to 4 (M1, M2, M3, M4)
QR Code 1 to 40
rMQR 1 to 38 (33 to 38 automatic width)
\f[R]
.fi
.PP
For a number of linear symbols, it specifies check character options
(\[lq]hide\[rq] or \[lq]hidden\[rq] means don\[cq]t show in HRT,
\[lq]show\[rq] or \[lq]visible\[rq] means do display in HRT):
.IP
.nf
\f[C]
C25IATA 1 or 2 (add visible or hidden check digit)
C25IND ditto
C25INTER ditto
C25LOGIC ditto
C25STANDARD ditto
Codabar 1 or 2 (add hidden or visible check digit)
Code 11 0 or 1 (no or 1 check digit only)
(has 2 check digits by default)
Code 39 1 (add visible check digit)
Code 93 1 (hide the default check characters)
EXCODE39 1 (add visible check digit)
LOGMARS 1 (add visible check digit)
MSI Plessey 0 to 6 (various check digit options)
+10 (hide)
\f[R]
.fi
.PP
For a few other symbologies, it specifies other characteristics:
.IP
.nf
\f[C]
Channel Code 3 to 8 (no. of channels)
DAFT 50 to 900 (permille tracker ratio)
Ultracode 2 (revision 2)
VIN 1 (add international prefix)
\f[R]
.fi
.RE
.TP
\f[V]-v\f[R], \f[V]--version\f[R]
Display the zint version.
Display zint version.
.TP
\f[V]--vwhitesp=INTEGER\f[R]
Set the height of vertical whitespace above and below the barcode, where
@ -364,6 +460,56 @@ Set the width of horizontal whitespace either side of the barcode, where
.TP
\f[V]--werror\f[R]
Convert all warnings into errors.
.SH EXIT STATUS
.TP
\f[V]0\f[R]
Success (including when given informational options \f[V]-h\f[R],
\f[V]--help\f[R], \f[V]-e\f[R], \f[V]--ecinos\f[R], \f[V]-t\f[R],
\f[V]--types\f[R], \f[V]-v\f[R], \f[V]--version\f[R]).
.TP
\f[V]2\f[R]
Invalid option given but overridden by Zint
(\f[V]ZINT_WARN_INVALID_OPTION\f[R])
.TP
\f[V]3\f[R]
Automatic ECI inserted by Zint (\f[V]ZINT_WARN_USES_ECI\f[R])
.TP
\f[V]4\f[R]
Symbol created not compliant with standards
(\f[V]ZINT_WARN_NONCOMPLIANT\f[R])
.TP
\f[V]5\f[R]
Input data wrong length (\f[V]ZINT_ERROR_TOO_LONG\f[R])
.TP
\f[V]6\f[R]
Input data incorrect (\f[V]ZINT_ERROR_INVALID_DATA\f[R])
.TP
\f[V]7\f[R]
Input check digit incorrect (\f[V]ZINT_ERROR_INVALID_CHECK\f[R])
.TP
\f[V]8\f[R]
Incorrect option given (\f[V]ZINT_ERROR_INVALID_OPTION\f[R])
.TP
\f[V]9\f[R]
Internal error (should not happen)
(\f[V]ZINT_ERROR_ENCODING_PROBLEM\f[R])
.TP
\f[V]10\f[R]
Error opening output file (\f[V]ZINT_ERROR_FILE_ACCESS\f[R])
.TP
\f[V]11\f[R]
Memory allocation (malloc) failure (\f[V]ZINT_ERROR_MEMORY\f[R])
.TP
\f[V]12\f[R]
Error writing to output file (\f[V]ZINT_ERROR_FILE_WRITE\f[R])
.TP
\f[V]13\f[R]
Error counterpart of warning if \f[V]--werror\f[R] given
(\f[V]ZINT_ERROR_USES_ECI\f[R])
.TP
\f[V]14\f[R]
Error counterpart of warning if \f[V]--werror\f[R] given
(\f[V]ZINT_ERROR_NONCOMPLIANT\f[R])
.SH EXAMPLES
.PP
Create \[lq]out.png\[rq] (or \[lq]out.gif\[rq] if zint built without PNG
@ -382,34 +528,39 @@ Create \[lq]qr.svg\[rq] in the current directory, as a QR Code symbol.
zint -b QRCode -d \[aq]This Text\[aq] -o \[aq]qr.svg\[aq]
\f[R]
.fi
.PP
Use batch mode to read from an input file \[lq]ean_nos.txt\[rq]
containing 13-digit GTINs, to create a series of EAN-13 barcodes,
formatting the output filenames to \[lq]ean001.gif\[rq],
\[lq]ean002.gif\[rq] etc.
using the special character \[lq]\[ti]\[rq].
.IP
.nf
\f[C]
zint -b EANX --batch -i \[aq]ean_nos.txt\[aq] -o \[aq]ean\[ti]\[ti]\[ti].gif\[aq]
\f[R]
.fi
.SH BUGS
.PP
Please send bug reports to https://sourceforge.net/p/zint/tickets/
Please send bug reports to https://sourceforge.net/p/zint/tickets/.
.SH SEE ALSO
.PP
Full documention for \f[V]zint\f[R] (and the API \f[V]libzint\f[R] and
the GUI \f[V]zint-qt\f[R]) is available from
http://zint.org.uk/Manual.aspx, and at
https://sourceforge.net/p/zint/docs/manual.txt.
.SH STANDARDS
.SH CONFORMING TO
.PP
Zint is designed to be compliant with a number of international
standards, including:
.IP \[bu] 2
.PP
EN 798:1996, EN 12323:2005, ISO/IEC 15420:2009, ISO/IEC 15417:2007,
.IP \[bu] 2
ISO/IEC 15438:2015, ISO/IEC 16022:2006, ISO/IEC 16023:2000,
.IP \[bu] 2
ISO/IEC 16388:2007, ISO/IEC 18004:2015, ISO/IEC 20830:2021,
.IP \[bu] 2
ISO/IEC 24723:2010, ISO/IEC 24724:2011, ISO/IEC 24728:2006,
.IP \[bu] 2
ISO/IEC 24778:2008, ISO/IEC 16390:2007, ISO/IEC 21471:2019,
.IP \[bu] 2
ANSI-HIBC 2.6-2016, ANSI/AIM BC12-1998, ANSI/AIM BC6-2000,
.IP \[bu] 2
ANSI/AIM BC5-1995, AIM ISS-X-24, AIMD014 (v 1.63), USPS-B-3200,
.IP \[bu] 2
USS Code One (1994), GS1 22.0 (2022), AIM ITS/04-023 (2022)
ISO/IEC 15438:2015, ISO/IEC 16022:2006, ISO/IEC 16023:2000, ISO/IEC
16388:2007, ISO/IEC 18004:2015, ISO/IEC 20830:2021, ISO/IEC 24723:2010,
ISO/IEC 24724:2011, ISO/IEC 24728:2006, ISO/IEC 24778:2008, ISO/IEC
16390:2007, ISO/IEC 21471:2019, AIM USS Code One (1994), ANSI/AIM
BC12-1998, ANSI/AIM BC6-2000, ANSI/AIM BC5-1995, AIM ISS-X-24 (1995),
AIMD014 (v 1.63) (2008), ANSI-HIBC 2.6-2016, AIM ITS/04-023 (2022)
.SH AUTHORS
Robin Stuart <robin@zint.org.uk>.
.PP
Robin Stuart <robin@zint.org.uk>

View File

@ -1,5 +1,5 @@
% zint(1) Version 2.10.0.9
% Robin Stuart <robin@zint.org.uk>
%
% May 2022
# NAME
@ -15,6 +15,10 @@
zint takes input data from the command line or a file to encode in a barcode which is then output to an image file.
Input data is UTF-8, unless `--binary` is specified.
Human Readable Text (HRT) is displayed by default for those barcodes that support HRT, unless `--notext` is specified.
The output image file (specified with `-o` or `--output`) may be in one of these formats: Windows Bitmap (`BMP`),
Enhanced Metafile Format (`EMF`), Encapsulated PostScript (`EPS`), Graphics Interchange Format (`GIF`), ZSoft
Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`SVG`), or Tagged Image File Format
@ -27,8 +31,8 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`-b TYPE`, `--barcode=TYPE`
: Set the barcode symbology that will be used to encode the data. *TYPE* is the number or name of the barcode
symbology. If not given, the symbology defaults to 20 (Code 128). To see what types are available, use the `-t`
or `--types` option. Type names are case-insensitive, and non-alphanumerics are ignored.
symbology. If not given, the symbology defaults to 20 (Code 128). To see what types are available, use the `-t` or
`--types` option. Type names are case-insensitive, and non-alphanumerics are ignored.
`--addongap=INTEGER`
: For UPC/EAN symbologies, set the gap between the main data and the add-on. *INTEGER* is in integral multiples of
@ -47,12 +51,13 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
page is disabled, and no validation of the data's character encoding takes place.
`--bind`
: Add horizontal boundary bars, aka bearer bars, to the symbol. The width of the boundary bars must be specified by
the `--border` option. `--bind` can also be used to add row separator bars to symbols stacked with multiple `-d`
or `--data` inputs, in which case the width of the separator bars must be specified with the `--separator` option.
: Add horizontal boundary bars (also known as bearer bars) to the symbol. The width of the boundary bars must be
specified by the `--border` option. `--bind` can also be used to add row separator bars to symbols stacked with
multiple `-d` or `--data` inputs, in which case the width of the separator bars must be specified with the
`--separator` option.
`--bold`
: Use bold text for the Human Readable Text.
: Use bold text for the Human Readable Text (HRT).
`--border=INTEGER`
: Set the width of boundary bars (`--bind`) or box borders (`--box`), where *INTEGER* is in integral multiples of
@ -65,8 +70,8 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
: Use the CMYK colour space when outputting to Encapsulated PostScript (EPS) or TIF files.
`--cols=INTEGER`
: Set the number of data columns in the symbol to *INTEGER*. Affects Codablock-F, PDF417, MicroPDF417, GS1 DataBar
Expanded Stacked (DBAR_EXPSTK) and DotCode symbols.
: Set the number of data columns in the symbol to *INTEGER*. Affects Codablock-F, DotCode, GS1 DataBar Expanded
Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417 symbols.
`--compliantheight`
@ -80,7 +85,8 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--direct`
: Send output to stdout, which in most cases should be re-directed to a pipe or a file.
: Send output to stdout, which in most cases should be re-directed to a pipe or a file. Use `--filetype` to specify
output format.
`--dmre`
@ -97,7 +103,8 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--dump`
: Dump a hexadecimal representation of the symbol's encodation to stdout.
: Dump a hexadecimal representation of the symbol's encodation to stdout. The same representation may be outputted
to a file by using a `.txt` extension with `-o` or `--output` or by specifying `--filetype=txt`.
`-e`, `--ecinos`
@ -105,27 +112,31 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--eci=INTEGER`
: Set the ECI code for the input data to *INTEGER*. See `-e` or `--ecinos` for a list of the ECIs available.
: Set the ECI code for the input data to *INTEGER*. See `-e` or `--ecinos` for a list of the ECIs available. ECIs
are supported by Aztec Code, Code One, Data Matrix, DotCode, Grid Matrix, Han Xin Code, MaxiCode, MicroPDF417,
PDF417, QR Code, rMQR and Ultracode
`--esc`
: Process escape characters in the input data. The escape sequences are:
- `\0` (0x00) `NUL` Null character
- `\E` (0x04) `EOT` End of Transmission
- `\a` (0x07) `BEL` Bell
- `\b` (0x08) `BS` Backspace
- `\t` (0x09) `HT` Horizontal Tab
- `\n` (0x0A) `LF` Line Feed
- `\v` (0x0B) `VT` Vertical Tab
- `\f` (0x0C) `FF` Form Feed
- `\r` (0x0D) `CR` Carriage Return
- `\e` (0x1B) `ESC` Escape
- `\G` (0x1D) `GS` Group Separator
- `\R` (0x1E) `RS` Record Separator
- `\\` (0x5C) `\` Backslash
- `\xNN` (0xNN) Any 8-bit character where NN is hexadecimal
- `\uNNNN` (U+NNNN) Any 16-bit Unicode BMP character where NNNN is hexadecimal
\0 (0x00) NUL Null character
\E (0x04) EOT End of Transmission
\a (0x07) BEL Bell
\b (0x08) BS Backspace
\t (0x09) HT Horizontal Tab
\n (0x0A) LF Line Feed
\v (0x0B) VT Vertical Tab
\f (0x0C) FF Form Feed
\r (0x0D) CR Carriage Return
\e (0x1B) ESC Escape
\G (0x1D) GS Group Separator
\R (0x1E) RS Record Separator
\\ (0x5C) \ Backslash
\xNN (0xNN) Any 8-bit character where NN is
hexadecimal
\uNNNN (U+NNNN) Any 16-bit Unicode BMP character
where NNNN is hexadecimal
`--fast`
@ -141,7 +152,7 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--fullmultibyte`
: Use the multibyte modes of QR Code, Han Xin, and Grid Matrix for non-ASCII data.
: Use the multibyte modes of Grid Matrix, Han Xin and QR Code for non-ASCII data.
`--gs1`
@ -155,7 +166,7 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--gs1parens`
: Process parentheses `"()"` as GS1 AI delimiters, rather than square brackets `"[]"`. The input data must not
contain parentheses.
otherwise contain parentheses.
`--gssep`
@ -182,11 +193,11 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--init`
: Create a reader initialisation/programming symbol.
: Create a Reader Initialisation (Programming) symbol.
`--mask=INTEGER`
: Set the masking pattern to use for QR Code, Han Xin or DotCode to *INTEGER*, overriding the automatic selection.
: Set the masking pattern to use for DotCode, Han Xin or QR Code to *INTEGER*, overriding the automatic selection.
`--mirror`
@ -194,7 +205,22 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--mode=INTEGER`
: For MaxiCode and composite symbols, set the encoding mode to *INTEGER*. The meaning is symbol-specific.
: For MaxiCode and Composite symbols, set the encoding mode to *INTEGER*.
For MaxiCode (SCM is Structured Carrier Message, with 3 fields: postcode, 3-digit ISO 3166-1 country code, 3-digit
service code):
2 SCM with 9-digit numeric postcode
3 SCM with 6-character alphanumeric postcode
4 Enhanced ECC for the primary part of the message
5 Enhanced ECC for all of the message
6 Reader Initialisation (Programming)
For Composite symbols (names end in `_CC`, i.e. EANX_CC, GS1_128_CC, DBAR_OMN_CC etc.):
1 CC-A
2 CC-B
3 CC-C (GS1_128_CC only)
`--nobackground`
@ -206,17 +232,17 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--notext`
: Remove the Human Readable Text.
: Remove the Human Readable Text (HRT).
`-o`, `--output=FILE`
: Send the output to *FILE*. When not in batch mode, the default is "out.png" (or "out.gif" if zint built without
PNG support). When in batch mode (`--batch`), special characters can be used to format the output filenames:
- `~` Insert a number or 0
- `#` Insert a number or space
- `@` Insert a number or `*`
- Any other Insert literally
~ Insert a number or 0
# Insert a number or space
@ Insert a number or *
Any other Insert literally
`--primary=STRING`
@ -224,7 +250,8 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--quietzones`
: Add compliant quiet zones for symbols that specify one.
: Add compliant quiet zones for symbols that specify one. This is in addition to any whitespace specified by `-w` or
`--whitesp` or `--vwhitesp`.
`-r`, `--reverse`
@ -249,7 +276,16 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--secure=INTEGER`
: Set the error correction level (ECC) or check character options to *INTEGER*. The meaning is symbol-specific.
: Set the error correction level (ECC) to *INTEGER*. The meaning is specific to the following matrix symbols:
Aztec Code 1 to 4 (10%, 23%, 36%, 50%) (approx.)
Grid Matrix 1 to 5 (10% to 50%) (approx.)
Han Xin 1 to 4 (8%, 15%, 23%, 30%) (approx.)
Micro QR 1 to 3 (L, M, Q)
PDF417 0 to 8 (2^(INTEGER + 1) codewords)
QR Code 1 to 4 (L, M, Q, H)
rMQR 2 or 4 (M, H)
Ultracode 1 to 6 (0%, 5%, 9%, 17%, 25%, 33%) (approx.)
`--segN=ECI,DATA`
@ -263,7 +299,7 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--small`
: Use small text for Human Readable Text.
: Use small text for Human Readable Text (HRT).
`--square`
@ -272,7 +308,8 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--structapp=I,C[,ID]`
: Set Structured Append info, where `I` is the 1-based index, `C` is the count of total symbols in the sequence, and
`ID`, which is optional, is the identifier that all symbols in the sequence share.
`ID`, which is optional, is the identifier that all symbols in the sequence share. Structured Append is supported
by Aztec Code, Code One, Data Matrix, DotCode, Grid Matrix, MaxiCode, MicroPDF417, PDF417, QR Code and Ultracode.
`-t`, `--types`
@ -280,13 +317,47 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--vers=INTEGER`
: Set the symbol version (size, check digits, other options) to *INTEGER*. The meaning is symbol-specific. For most
matrix symbols, it specifies size. For a number of linear symbols, it specifies check character options. For a
few other symbologies, it specifies other characteristics.
: Set the symbol version (size, check digits, other options) to *INTEGER*. The meaning is symbol-specific.
For most matrix symbols, it specifies size:
Aztec Code 1 to 36 (1 to 4 compact)
Code One 1 to 10
Data Matrix 1 to 48 (31 to 48 DMRE)
Grid Matrix 1 to 13
Han Xin 1 to 84
Micro QR 1 to 4 (M1, M2, M3, M4)
QR Code 1 to 40
rMQR 1 to 38 (33 to 38 automatic width)
For a number of linear symbols, it specifies check character options ("hide" or "hidden" means don't show in HRT,
"show" or "visible" means do display in HRT):
C25IATA 1 or 2 (add visible or hidden check digit)
C25IND ditto
C25INTER ditto
C25LOGIC ditto
C25STANDARD ditto
Codabar 1 or 2 (add hidden or visible check digit)
Code 11 0 or 1 (no or 1 check digit only)
(has 2 check digits by default)
Code 39 1 (add visible check digit)
Code 93 1 (hide the default check characters)
EXCODE39 1 (add visible check digit)
LOGMARS 1 (add visible check digit)
MSI Plessey 0 to 6 (various check digit options)
+10 (hide)
For a few other symbologies, it specifies other characteristics:
Channel Code 3 to 8 (no. of channels)
DAFT 50 to 900 (permille tracker ratio)
Ultracode 2 (revision 2)
VIN 1 (add international prefix)
`-v`, `--version`
: Display the zint version.
: Display zint version.
`--vwhitesp=INTEGER`
@ -302,6 +373,51 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
: Convert all warnings into errors.
# EXIT STATUS
`0`
: Success (including when given informational options `-h`, `--help`, `-e`, `--ecinos`, `-t`, `--types`, `-v`,
`--version`).
`2`
: Invalid option given but overridden by Zint (`ZINT_WARN_INVALID_OPTION`)
`3`
: Automatic ECI inserted by Zint (`ZINT_WARN_USES_ECI`)
`4`
: Symbol created not compliant with standards (`ZINT_WARN_NONCOMPLIANT`)
`5`
: Input data wrong length (`ZINT_ERROR_TOO_LONG`)
`6`
: Input data incorrect (`ZINT_ERROR_INVALID_DATA`)
`7`
: Input check digit incorrect (`ZINT_ERROR_INVALID_CHECK`)
`8`
: Incorrect option given (`ZINT_ERROR_INVALID_OPTION`)
`9`
: Internal error (should not happen) (`ZINT_ERROR_ENCODING_PROBLEM`)
`10`
: Error opening output file (`ZINT_ERROR_FILE_ACCESS`)
`11`
: Memory allocation (malloc) failure (`ZINT_ERROR_MEMORY`)
`12`
: Error writing to output file (`ZINT_ERROR_FILE_WRITE`)
`13`
: Error counterpart of warning if `--werror` given (`ZINT_ERROR_USES_ECI`)
`14`
: Error counterpart of warning if `--werror` given (`ZINT_ERROR_NONCOMPLIANT`)
# EXAMPLES
Create "out.png" (or "out.gif" if zint built without PNG support) in the current directory, as a Code 128 symbol.
@ -316,24 +432,35 @@ Create "qr.svg" in the current directory, as a QR Code symbol.
zint -b QRCode -d 'This Text' -o 'qr.svg'
```
Use batch mode to read from an input file "ean_nos.txt" containing 13-digit GTINs, to create a series of EAN-13
barcodes, formatting the output filenames to "ean001.gif", "ean002.gif" etc. using the special character "~".
```bash
zint -b EANX --batch -i 'ean_nos.txt' -o 'ean~~~.gif'
```
# BUGS
Please send bug reports to https://sourceforge.net/p/zint/tickets/
Please send bug reports to https://sourceforge.net/p/zint/tickets/.
# SEE ALSO
Full documention for `zint` (and the API `libzint` and the GUI `zint-qt`) is available from
http://zint.org.uk/Manual.aspx, and at https://sourceforge.net/p/zint/docs/manual.txt.
# STANDARDS
# CONFORMING TO
Zint is designed to be compliant with a number of international standards, including:
- EN 798:1996, EN 12323:2005, ISO/IEC 15420:2009, ISO/IEC 15417:2007,
- ISO/IEC 15438:2015, ISO/IEC 16022:2006, ISO/IEC 16023:2000,
- ISO/IEC 16388:2007, ISO/IEC 18004:2015, ISO/IEC 20830:2021,
- ISO/IEC 24723:2010, ISO/IEC 24724:2011, ISO/IEC 24728:2006,
- ISO/IEC 24778:2008, ISO/IEC 16390:2007, ISO/IEC 21471:2019,
- ANSI-HIBC 2.6-2016, ANSI/AIM BC12-1998, ANSI/AIM BC6-2000,
- ANSI/AIM BC5-1995, AIM ISS-X-24, AIMD014 (v 1.63), USPS-B-3200,
- USS Code One (1994), GS1 22.0 (2022), AIM ITS/04-023 (2022)
EN 798:1996, EN 12323:2005, ISO/IEC 15420:2009,
ISO/IEC 15417:2007, ISO/IEC 15438:2015, ISO/IEC 16022:2006,
ISO/IEC 16023:2000, ISO/IEC 16388:2007, ISO/IEC 18004:2015,
ISO/IEC 20830:2021, ISO/IEC 24723:2010, ISO/IEC 24724:2011,
ISO/IEC 24728:2006, ISO/IEC 24778:2008, ISO/IEC 16390:2007,
ISO/IEC 21471:2019, AIM USS Code One (1994), ANSI/AIM BC12-1998,
ANSI/AIM BC6-2000, ANSI/AIM BC5-1995, AIM ISS-X-24 (1995),
AIMD014 (v 1.63) (2008), ANSI-HIBC 2.6-2016, AIM ITS/04-023 (2022)
# AUTHORS
Robin Stuart <robin@zint.org.uk>

View File

@ -159,7 +159,7 @@ static void usage(int no_png) {
" --height=NUMBER Set height of symbol in multiples of X-dimension\n"
" --heightperrow Treat height as per-row\n"
" -i, --input=FILE Read input data from FILE\n"
" --init Create reader initialisation/programming symbol\n"
" --init Create Reader Initialisation (Programming) symbol\n"
" --mask=NUMBER Set masking pattern to use (QR/Han Xin/DotCode)\n"
" --mirror Use batch data to determine filename\n"
" --mode=NUMBER Set encoding mode (MaxiCode/Composite)\n"
@ -274,33 +274,84 @@ static void to_lower(char source[]) {
static int get_barcode_name(const char *barcode_name) {
struct name { const int symbology; const char *n; };
static const struct name names[] = { /* Must be sorted for binary search to work */
{ BARCODE_C25LOGIC, "2of5datalogic" }, /* Synonym */
{ BARCODE_C25IATA, "2of5iata" }, /* Synonym */
{ BARCODE_C25IND, "2of5ind" }, /* Synonym */
{ BARCODE_C25IND, "2of5industrial" }, /* Synonym */
{ BARCODE_C25INTER, "2of5inter" }, /* Synonym */
{ BARCODE_C25INTER, "2of5interleaved" }, /* Synonym */
{ BARCODE_C25LOGIC, "2of5logic" }, /* Synonym */
{ BARCODE_C25STANDARD, "2of5matrix" }, /* Synonym */
{ BARCODE_C25STANDARD, "2of5standard" }, /* Synonym */
{ BARCODE_AUSPOST, "auspost" },
{ BARCODE_AUSREDIRECT, "ausredirect" },
{ BARCODE_AUSREPLY, "ausreply" },
{ BARCODE_AUSROUTE, "ausroute" },
{ BARCODE_AZRUNE, "azrune" },
{ BARCODE_AZTEC, "aztec" },
{ BARCODE_AZTEC, "azteccode" }, /* Synonym */
{ BARCODE_AZRUNE, "aztecrune" }, /* Synonym */
{ BARCODE_AZRUNE, "aztecrunes" }, /* Synonym */
{ BARCODE_C25LOGIC, "c25datalogic" }, /* Synonym */
{ BARCODE_C25IATA, "c25iata" },
{ BARCODE_C25IND, "c25ind" },
{ BARCODE_C25IND, "c25industrial" }, /* Synonym */
{ BARCODE_C25INTER, "c25inter" },
{ BARCODE_C25INTER, "c25interleaved" }, /* Synonym */
{ BARCODE_C25LOGIC, "c25logic" },
{ BARCODE_C25STANDARD, "c25matrix" },
{ BARCODE_C25STANDARD, "c25standard" },
{ BARCODE_CHANNEL, "channel" },
{ BARCODE_CHANNEL, "channelcode" }, /* Synonym */
{ BARCODE_CODABAR, "codabar" },
{ BARCODE_CODABLOCKF, "codablockf" },
{ BARCODE_CODE11, "code11" },
{ BARCODE_CODE128, "code128" },
{ BARCODE_CODE128B, "code128b" },
{ BARCODE_CODE16K, "code16k" },
{ BARCODE_C25LOGIC, "code2of5datalogic" }, /* Synonym */
{ BARCODE_C25IATA, "code2of5iata" }, /* Synonym */
{ BARCODE_C25IND, "code2of5ind" }, /* Synonym */
{ BARCODE_C25IND, "code2of5industrial" }, /* Synonym */
{ BARCODE_C25INTER, "code2of5inter" }, /* Synonym */
{ BARCODE_C25INTER, "code2of5interleaved" }, /* Synonym */
{ BARCODE_C25LOGIC, "code2of5logic" }, /* Synonym */
{ BARCODE_C25STANDARD, "code2of5matrix" }, /* Synonym */
{ BARCODE_C25STANDARD, "code2of5standard" }, /* Synonym */
{ BARCODE_CODE32, "code32" },
{ BARCODE_CODE39, "code39" },
{ BARCODE_CODE49, "code49" },
{ BARCODE_CODE93, "code93" },
{ BARCODE_CODEONE, "codeone" },
{ BARCODE_DAFT, "daft" },
{ BARCODE_DBAR_EXP, "databarexp" }, /* Synonym */
{ BARCODE_DBAR_EXP, "databarexpanded" }, /* Synonym */
{ BARCODE_DBAR_EXP_CC, "databarexpandedcc" }, /* Synonym */
{ BARCODE_DBAR_EXPSTK, "databarexpandedstacked" }, /* Synonym */
{ BARCODE_DBAR_EXPSTK_CC, "databarexpandedstackedcc" }, /* Synonym */
{ BARCODE_DBAR_EXPSTK, "databarexpandedstk" }, /* Synonym */
{ BARCODE_DBAR_EXPSTK_CC, "databarexpandedstkcc" }, /* Synonym */
{ BARCODE_DBAR_EXP_CC, "databarexpcc" }, /* Synonym */
{ BARCODE_DBAR_EXPSTK, "databarexpstk" }, /* Synonym */
{ BARCODE_DBAR_EXPSTK_CC, "databarexpstkcc" }, /* Synonym */
{ BARCODE_DBAR_LTD, "databarlimited" }, /* Synonym */
{ BARCODE_DBAR_LTD_CC, "databarlimitedcc" }, /* Synonym */
{ BARCODE_DBAR_LTD, "databarltd" }, /* Synonym */
{ BARCODE_DBAR_LTD_CC, "databarltdcc" }, /* Synonym */
{ BARCODE_DBAR_OMN, "databaromn" }, /* Synonym */
{ BARCODE_DBAR_OMN_CC, "databaromncc" }, /* Synonym */
{ BARCODE_DBAR_OMN, "databaromni" }, /* Synonym */
{ BARCODE_DBAR_OMN_CC, "databaromnicc" }, /* Synonym */
{ BARCODE_DBAR_OMNSTK, "databaromnstk" }, /* Synonym */
{ BARCODE_DBAR_OMNSTK_CC, "databaromnstkcc" }, /* Synonym */
{ BARCODE_DBAR_STK, "databarstacked" }, /* Synonym */
{ BARCODE_DBAR_STK_CC, "databarstackedcc" }, /* Synonym */
{ BARCODE_DBAR_OMNSTK, "databarstackedomn" }, /* Synonym */
{ BARCODE_DBAR_OMNSTK_CC, "databarstackedomncc" }, /* Synonym */
{ BARCODE_DBAR_OMNSTK, "databarstackedomni" }, /* Synonym */
{ BARCODE_DBAR_OMNSTK_CC, "databarstackedomnicc" }, /* Synonym */
{ BARCODE_DBAR_STK, "databarstk" }, /* Synonym */
{ BARCODE_DBAR_STK_CC, "databarstkcc" }, /* Synonym */
{ BARCODE_DATAMATRIX, "datamatrix" },
{ BARCODE_DBAR_EXP, "dbarexp" },
{ BARCODE_DBAR_EXP_CC, "dbarexpcc" },
@ -328,6 +379,7 @@ static int get_barcode_name(const char *barcode_name) {
{ BARCODE_EANX_CC, "eanxcc" },
{ BARCODE_EANX_CHK, "eanxchk" },
{ BARCODE_EXCODE39, "excode39" },
{ BARCODE_EXCODE39, "extendedcode39" }, /* Synonym */
{ BARCODE_FIM, "fim" },
{ BARCODE_FLAT, "flat" },
{ BARCODE_GRIDMATRIX, "gridmatrix" },
@ -350,6 +402,12 @@ static int get_barcode_name(const char *barcode_name) {
{ BARCODE_HIBC_PDF, "hibcpdf417" }, /* Synonym */
{ BARCODE_HIBC_QR, "hibcqr" },
{ BARCODE_HIBC_QR, "hibcqrcode" }, /* Synonym */
{ BARCODE_C25IATA, "iata2of5" }, /* Synonym */
{ BARCODE_C25IATA, "iatacode2of5" }, /* Synonym */
{ BARCODE_C25IND, "industrial2of5" }, /* Synonym */
{ BARCODE_C25IND, "industrialcode2of5" }, /* Synonym */
{ BARCODE_C25INTER, "interleaved2of5" }, /* Synonym */
{ BARCODE_C25INTER, "interleavedcode2of5" }, /* Synonym */
{ BARCODE_ISBNX, "isbnx" },
{ BARCODE_ITF14, "itf14" },
{ BARCODE_JAPANPOST, "japanpost" },
@ -360,6 +418,7 @@ static int get_barcode_name(const char *barcode_name) {
{ BARCODE_MAXICODE, "maxicode" },
{ BARCODE_MICROPDF417, "micropdf417" },
{ BARCODE_MICROQR, "microqr" },
{ BARCODE_MICROQR, "microqrcode" }, /* Synonym */
{ BARCODE_MSI_PLESSEY, "msi" }, /* Synonym */
{ BARCODE_MSI_PLESSEY, "msiplessey" },
{ BARCODE_NVE18, "nve18" },
@ -389,6 +448,7 @@ static int get_barcode_name(const char *barcode_name) {
{ BARCODE_DBAR_EXPSTK_CC, "rssexpstackcc" }, /* Synonym */
{ BARCODE_DBAR_LTD, "rssltd" }, /* Synonym */
{ BARCODE_DBAR_LTD_CC, "rssltdcc" }, /* Synonym */
{ BARCODE_C25STANDARD, "standardcode2of5" },
{ BARCODE_TELEPEN, "telepen" },
{ BARCODE_TELEPEN_NUM, "telepennum" },
{ BARCODE_ULTRA, "ultra" },
@ -619,7 +679,7 @@ static int batch_process(struct zint_symbol *symbol, const char *filename, const
FILE *file;
unsigned char buffer[ZINT_MAX_DATA_LEN] = {0}; // Maximum HanXin input
unsigned char character = 0;
int buf_posn = 0, error_number = 0, line_count = 1;
int buf_posn = 0, error_number = 0, warn_number = 0, line_count = 1;
char output_file[256];
char number[12], reverse_number[12];
int inpos, local_line_count;
@ -790,9 +850,13 @@ static int batch_process(struct zint_symbol *symbol, const char *filename, const
if (character != '\n') {
fprintf(stderr, "Warning 104: No newline at end of file\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION; /* TODO: maybe new warning e.g. ZINT_WARN_INVALID_INPUT? */
}
fclose(file);
if (error_number == 0) {
error_number = warn_number;
}
return error_number;
}
@ -873,6 +937,7 @@ int main(int argc, char **argv) {
struct zint_symbol *my_symbol;
struct zint_seg segs[10] = {0};
int error_number = 0;
int warn_number = 0;
int rotate_angle = 0;
int help = 0;
int data_cnt = 0;
@ -1014,13 +1079,14 @@ int main(int argc, char **argv) {
case OPT_ADDONGAP:
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 139: Invalid add-on gap value (digits only)\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (val >= 7 && val <= 12) {
addon_gap = val;
} else {
fprintf(stderr, "Warning 140: Add-on gap out of range (7 to 12), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_BATCH:
@ -1030,6 +1096,7 @@ int main(int argc, char **argv) {
} else {
fprintf(stderr, "Warning 141: Can't use batch mode if data given, ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_BG:
@ -1047,13 +1114,14 @@ int main(int argc, char **argv) {
case OPT_BORDER:
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 107: Invalid border width value (digits only)\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (val <= 1000) { /* `val` >= 0 always */
my_symbol->border_width = val;
} else {
fprintf(stderr, "Warning 108: Border width out of range (0 to 1000), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_BOX:
@ -1065,13 +1133,14 @@ int main(int argc, char **argv) {
case OPT_COLS:
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 131: Invalid columns value (digits only)\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if ((val >= 1) && (val <= 200)) {
my_symbol->option_2 = val;
} else {
fprintf(stderr, "Warning 111: Number of columns out of range (1 to 200), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_COMPLIANTHEIGHT:
@ -1092,6 +1161,7 @@ int main(int argc, char **argv) {
/* Zero and negative values are not permitted */
fprintf(stderr, "Warning 106: Invalid dot radius value (less than 0.01), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
my_symbol->dot_size = 4.0f / 5.0f;
}
break;
@ -1105,13 +1175,14 @@ int main(int argc, char **argv) {
case OPT_ECI:
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 138: Invalid ECI value (digits only)\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (val <= 999999) { /* `val` >= 0 always */
my_symbol->eci = val;
} else {
fprintf(stderr, "Warning 118: ECI code out of range (0 to 999999), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_ESC:
@ -1132,6 +1203,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "Warning 142: File type '%s' not supported, ignoring\n", optarg);
}
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
} else {
strncpy(filetype, optarg, (size_t) 3);
}
@ -1139,13 +1211,14 @@ int main(int argc, char **argv) {
case OPT_FONTSIZE:
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 130: Invalid font size value (digits only)\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (val <= 100) { /* `val` >= 0 always */
my_symbol->fontsize = val;
} else {
fprintf(stderr, "Warning 126: Font size out of range (0 to 100), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_FULLMULTIBYTE:
@ -1171,6 +1244,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "Warning 155: Guard bar descent '%g' out of range (0 to 50), ignoring\n",
float_opt);
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_HEIGHT:
@ -1181,6 +1255,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "Warning 110: Symbol height '%g' out of range (0.5 to 2000), ignoring\n",
float_opt);
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_HEIGHTPERROW:
@ -1196,12 +1271,13 @@ int main(int argc, char **argv) {
case OPT_MASK:
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 148: Invalid mask value (digits only)\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (val > 7) { /* `val` >= 0 always */
/* mask pattern >= 0 and <= 7 (i.e. values >= 1 and <= 8) only permitted */
fprintf(stderr, "Warning 147: Mask value out of range (0 to 7), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
} else {
mask = val + 1;
}
@ -1209,13 +1285,14 @@ int main(int argc, char **argv) {
case OPT_MODE:
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 136: Invalid mode value (digits only)\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (val <= 6) { /* `val` >= 0 always */
my_symbol->option_1 = val;
} else {
fprintf(stderr, "Warning 116: Mode value out of range (0 to 6), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_NOBACKGROUND:
@ -1233,6 +1310,7 @@ int main(int argc, char **argv) {
} else {
fprintf(stderr, "Warning 115: Primary data string too long (127 character maximum), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_QUIETZONES:
@ -1242,7 +1320,7 @@ int main(int argc, char **argv) {
/* Only certain inputs allowed */
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 117: Invalid rotation value (digits only)\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
switch (val) {
case 90: rotate_angle = 90;
@ -1257,19 +1335,21 @@ int main(int argc, char **argv) {
fprintf(stderr,
"Warning 137: Invalid rotation parameter (0, 90, 180 or 270 only), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
break;
}
break;
case OPT_ROWS:
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 132: Invalid rows value (digits only)\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if ((val >= 1) && (val <= 90)) {
rows = val;
} else {
fprintf(stderr, "Warning 112: Number of rows out of range (1 to 90), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_SCALE:
@ -1278,13 +1358,14 @@ int main(int argc, char **argv) {
/* Zero and negative values are not permitted */
fprintf(stderr, "Warning 105: Invalid scale value (less than 0.01), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
my_symbol->scale = 1.0f;
}
break;
case OPT_SCMVV:
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 149: Invalid Structured Carrier Message version value (digits only)\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (val <= 99) { /* `val` >= 0 always */
my_symbol->option_2 = val + 1;
@ -1293,18 +1374,20 @@ int main(int argc, char **argv) {
fprintf(stderr,
"Warning 150: Structured Carrier Message version out of range (0 to 99), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_SECURE:
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 134: Invalid ECC value (digits only)\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (val <= 8) { /* `val` >= 0 always */
my_symbol->option_1 = val;
} else {
fprintf(stderr, "Warning 114: ECC level out of range (0 to 8), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_SEG1:
@ -1320,10 +1403,10 @@ int main(int argc, char **argv) {
val = c - OPT_SEG1 + 1; /* Segment number */
if (segs[val].source) {
fprintf(stderr, "Error 164: Duplicate segment %d\n", val);
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (!validate_seg(optarg, c - OPT_SEG1 + 1, segs)) {
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (val >= seg_count) {
seg_count = val + 1;
@ -1331,12 +1414,13 @@ int main(int argc, char **argv) {
} else {
fprintf(stderr, "Warning 165: Can't define segments in batch mode, ignoring '%s'\n", optarg);
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_SEPARATOR:
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 128: Invalid separator value (digits only)\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (val <= 4) { /* `val` >= 0 always */
separator = val;
@ -1344,6 +1428,7 @@ int main(int argc, char **argv) {
/* Greater than 4 values are not permitted */
fprintf(stderr, "Warning 127: Separator value out of range (0 to 4), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_SMALL:
@ -1355,7 +1440,7 @@ int main(int argc, char **argv) {
case OPT_STRUCTAPP:
memset(&my_symbol->structapp, 0, sizeof(my_symbol->structapp));
if (!validate_structapp(optarg, &my_symbol->structapp)) {
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
break;
case OPT_VERBOSE:
@ -1364,25 +1449,27 @@ int main(int argc, char **argv) {
case OPT_VERS:
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 133: Invalid version value (digits only)\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if ((val >= 1) && (val <= 999)) {
my_symbol->option_2 = val;
} else {
fprintf(stderr, "Warning 113: Version value out of range (1 to 999), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_VWHITESP:
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 153: Invalid vertical whitespace value '%s' (digits only)\n", optarg);
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (val <= 1000) { /* `val` >= 0 always */
my_symbol->whitespace_height = val;
} else {
fprintf(stderr, "Warning 154: Vertical whitespace value out of range (0 to 1000), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_WERROR:
@ -1412,7 +1499,7 @@ int main(int argc, char **argv) {
case 'b':
if (!validate_int(optarg, &val) && !(val = get_barcode_name(optarg))) {
fprintf(stderr, "Error 119: Invalid barcode type '%s'\n", optarg);
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
my_symbol->symbology = val;
break;
@ -1420,13 +1507,14 @@ int main(int argc, char **argv) {
case 'w':
if (!validate_int(optarg, &val)) {
fprintf(stderr, "Error 120: Invalid horizontal whitespace value '%s' (digits only)\n", optarg);
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (val <= 1000) { /* `val` >= 0 always */
my_symbol->whitespace_width = val;
} else {
fprintf(stderr, "Warning 121: Horizontal whitespace value out of range (0 to 1000), ignoring\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
@ -1439,6 +1527,7 @@ int main(int argc, char **argv) {
} else {
fprintf(stderr, "Warning 122: Can't define data in batch mode, ignoring '%s'\n", optarg);
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
@ -1452,6 +1541,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "Warning 143: Can only define one input file in batch mode, ignoring '%s'\n",
optarg);
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
@ -1515,10 +1605,12 @@ int main(int argc, char **argv) {
if (data_arg_num > 1) {
fprintf(stderr, "Warning 144: Processing first input file '%s' only\n", arg_opts[0].arg);
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
if (seg_count) {
fprintf(stderr, "Warning 169: Ignoring segment arguments\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
if (filetype[0] == '\0') {
outfile_extension = get_extension(my_symbol->outfile);
@ -1534,21 +1626,18 @@ int main(int argc, char **argv) {
fprintf(stderr, "Warning 145: Scaling less than 0.%d will be set to 0.%d for '%s' output\n", min, min,
filetype);
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
error_number = batch_process(my_symbol, arg_opts[0].arg, mirror_mode, filetype, rotate_angle);
if (error_number != 0) {
fprintf(stderr, "%s\n", my_symbol->errtxt);
fflush(stderr);
}
} else {
if (seg_count) {
if (data_arg_num > 1) {
fprintf(stderr, "Error 170: Cannot specify segments and multiple data arguments together\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (arg_opts[0].opt != 'd') { /* For simplicity disallow input args for now */
fprintf(stderr, "Error 171: Cannot use input argument with segment arguments\n");
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
segs[0].eci = my_symbol->eci;
segs[0].source = (unsigned char *) arg_opts[0].arg;
@ -1556,7 +1645,7 @@ int main(int argc, char **argv) {
for (i = 0; i < seg_count; i++) {
if (segs[i].source == NULL) {
fprintf(stderr, "Error 172: Segments must be consecutive - segment %d missing\n", i);
return do_exit(1);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
}
}
@ -1569,6 +1658,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "Warning 146: Scaling less than 0.%d will be set to 0.%d for '%s' output\n", min, min,
get_extension(my_symbol->outfile));
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
for (i = 0; i < data_arg_num; i++) {
if (arg_opts[i].opt == 'd') {
@ -1607,11 +1697,12 @@ int main(int argc, char **argv) {
} else if (help == 0) {
fprintf(stderr, "Warning 124: No data received, no symbol generated\n");
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION;
}
ZBarcode_Delete(my_symbol);
return do_exit(error_number);
return do_exit(error_number ? error_number : warn_number);
}
/* vim: set ts=4 sw=4 et : */

View File

@ -77,9 +77,10 @@ static int escape_cmd(const char *str, char *buf) {
}
#endif
static char *exec(const char *cmd, char *buf, int buf_size, int debug, int index) {
static char *exec(const char *cmd, char *buf, int buf_size, int debug, int index, int *p_exit_status) {
FILE *fp;
int cnt;
int exit_status;
#ifdef _WIN32
wchar_t wchar_cmd[8192];
char esc_cmd[16384];
@ -109,10 +110,22 @@ static char *exec(const char *cmd, char *buf, int buf_size, int debug, int index
cnt = (int) fread(buf, 1, buf_size, fp);
if (fgetc(fp) != EOF) {
fprintf(stderr, "exec: failed to read full stream (%s)\n", cmd);
testutil_pclose(fp);
exit_status = testutil_pclose(fp);
if (p_exit_status) {
if (WIFEXITED(exit_status)) {
exit_status = WEXITSTATUS(exit_status);
}
*p_exit_status = exit_status;
}
return NULL;
}
testutil_pclose(fp);
exit_status = testutil_pclose(fp);
if (p_exit_status) {
if (WIFEXITED(exit_status)) {
exit_status = WEXITSTATUS(exit_status);
}
*p_exit_status = exit_status;
}
if (cnt) {
if (buf[cnt - 1] == '\r' || buf[cnt - 1] == '\n') {
@ -363,7 +376,7 @@ static void test_dump_args(int index, int debug) {
strcat(cmd, " 2>&1");
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i), "i:%d exec(%s) NULL\n", i, cmd);
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i, NULL), "i:%d exec(%s) NULL\n", i, cmd);
assert_zero(strcmp(buf, data[i].expected), "i:%d buf (%s) != expected (%s) (%s)\n", i, buf, data[i].expected, cmd);
if (have_input1) {
@ -441,7 +454,7 @@ static void test_dump_segs(int index, int debug) {
strcat(cmd, " 2>&1");
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i), "i:%d exec(%s) NULL\n", i, cmd);
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i, NULL), "i:%d exec(%s) NULL\n", i, cmd);
assert_zero(strcmp(buf, data[i].expected), "i:%d buf (%s) != expected (%s) (%s)\n", i, buf, data[i].expected, cmd);
}
@ -519,7 +532,7 @@ static void test_input(int index, int debug) {
arg_input(cmd, input_filename, data[i].input);
arg_data(cmd, "-o ", data[i].outfile);
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i), "i:%d exec(%s) NULL\n", i, cmd);
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i, NULL), "i:%d exec(%s) NULL\n", i, cmd);
outfile = data[i].expected;
for (j = 0; j < data[i].num_expected; j++) {
@ -569,7 +582,7 @@ static void test_stdin_input(int index, int debug) {
arg_input(cmd, input_filename, data[i].input);
arg_data(cmd, "-o ", data[i].outfile);
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i), "i:%d exec(%s) NULL\n", i, cmd);
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i, NULL), "i:%d exec(%s) NULL\n", i, cmd);
assert_nonzero(testUtilExists(data[i].outfile), "i:%d testUtilExists(%s) != 1\n", i, data[i].outfile);
assert_zero(remove(data[i].outfile), "i:%d remove(%s) != 0 (%d: %s)\n", i, data[i].outfile, errno, strerror(errno));
@ -624,7 +637,7 @@ static void test_batch_input(int index, int debug) {
strcat(cmd, " 2>&1");
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i), "i:%d exec(%s) NULL\n", i, cmd);
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i, NULL), "i:%d exec(%s) NULL\n", i, cmd);
assert_zero(strcmp(buf, data[i].expected), "i:%d buf (%s) != expected (%s)\n", i, buf, data[i].expected);
if (have_input1) {
@ -688,7 +701,7 @@ static void test_batch_large(int index, int debug) {
strcat(data_buf, "\n");
have_input = arg_input(cmd, input_filename, data_buf);
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i), "i:%d exec(%s) NULL\n", i, cmd);
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i, NULL), "i:%d exec(%s) NULL\n", i, cmd);
if (data[i].expected) {
assert_zero(remove(data[i].expected), "i:%d remove(%s) != 0 (%d: %s)\n", i, data[i].expected, errno, strerror(errno));
} else {
@ -808,7 +821,7 @@ static void test_checks(int index, int debug) {
strcat(cmd, " 2>&1");
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i), "i:%d exec(%s) NULL\n", i, cmd);
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i, NULL), "i:%d exec(%s) NULL\n", i, cmd);
assert_zero(strcmp(buf, data[i].expected), "i:%d buf (%s) != expected (%s)\n", i, buf, data[i].expected);
if (strncmp(data[i].expected, "Warning", 7) == 0) {
@ -838,136 +851,196 @@ static void test_barcode_symbology(int index, int debug) {
/* 5*/ { "BARCODE_CODE11", "1", NULL, 0, "symbology: 1," },
/* 6*/ { "C25 Standard", "1", NULL, 0, "symbology: 2," },
/* 7*/ { "c25matrix", "1", NULL, 0, "symbology: 2," }, // Legacy now supported
/* 8*/ { "C25INTER", "1", NULL, 0, "symbology: 3," },
/* 9*/ { "c25IATA", "1", NULL, 0, "symbology: 4," },
/* 10*/ { "c25 Logic", "1", NULL, 0, "symbology: 6," },
/* 11*/ { "c25 Ind", "1", NULL, 0, "symbology: 7," },
/* 12*/ { "code39", "1", NULL, 0, "symbology: 8," },
/* 13*/ { "excode 39", "1", NULL, 0, "symbology: 9," },
/* 14*/ { "eanx", "1", NULL, 0, "symbology: 13," },
/* 15*/ { "ean", "1", NULL, 0, "symbology: 13," },
/* 16*/ { "eanx chk", "1", NULL, 0, "symbology: 14," },
/* 17*/ { "eanxchk", "1", NULL, 0, "symbology: 14," },
/* 18*/ { "eanchk", "1", NULL, 0, "symbology: 14," },
/* 19*/ { "GS1128", "[01]12345678901231", NULL, 0, "symbology: 16," },
/* 20*/ { "ean 128", "[01]12345678901231", NULL, 0, "symbology: 16," },
/* 21*/ { "coda bar", "A1B", NULL, 0, "symbology: 18," },
/* 22*/ { "DPLEIT", "1", NULL, 0, "symbology: 21," },
/* 23*/ { "DPIDENT", "1", NULL, 0, "symbology: 22," },
/* 24*/ { "code16k", "1", NULL, 0, "symbology: 23," },
/* 25*/ { "CODE49", "1", NULL, 0, "symbology: 24," },
/* 26*/ { "CODE93", "1", NULL, 0, "symbology: 25," },
/* 27*/ { "flat", "1", NULL, 0, "symbology: 28," },
/* 28*/ { "dbar omn", "1", NULL, 0, "symbology: 29," },
/* 29*/ { "rss14", "1", NULL, 0, "symbology: 29," },
/* 30*/ { "dbar ltd", "1", NULL, 0, "symbology: 30," },
/* 31*/ { "rss ltd", "1", NULL, 0, "symbology: 30," },
/* 32*/ { "dbarexp", "[10]12", NULL, 0, "symbology: 31," },
/* 33*/ { "rss exp", "[10]12", NULL, 0, "symbology: 31," },
/* 34*/ { "telepen", "1", NULL, 0, "symbology: 32," },
/* 35*/ { "upc", "1", NULL, 1, "Error 119: Invalid barcode type 'upc'" },
/* 36*/ { "upca", "1", NULL, 0, "symbology: 34," },
/* 37*/ { "upca_chk", "123456789012", NULL, 0, "symbology: 35," },
/* 38*/ { "upce", "1", NULL, 0, "symbology: 37," },
/* 39*/ { "upce chk", "12345670", NULL, 0, "symbology: 38," },
/* 40*/ { "POSTNET ", "12345678901", NULL, 0, "symbology: 40," },
/* 41*/ { "msi", "1", NULL, 0, "symbology: 47," },
/* 42*/ { "MSI Plessey ", "1", NULL, 0, "symbology: 47," },
/* 43*/ { "fim ", "A", NULL, 0, "symbology: 49," },
/* 44*/ { "LOGMARS", "123456", NULL, 0, "symbology: 50," },
/* 45*/ { " pharma", "123456", NULL, 0, "symbology: 51," },
/* 46*/ { " pzn ", "1", NULL, 0, "symbology: 52," },
/* 47*/ { "pharma two", "4", NULL, 0, "symbology: 53," },
/* 48*/ { "BARCODE_PDF417", "1", NULL, 0, "symbology: 55," },
/* 49*/ { "pdf", "1", NULL, 1, "Error 119: Invalid barcode type 'pdf'" },
/* 50*/ { "barcodepdf417comp", "1", NULL, 0, "symbology: 56," },
/* 51*/ { "pdf417trunc", "1", NULL, 0, "symbology: 56," },
/* 52*/ { "MaxiCode", "1", NULL, 0, "symbology: 57," },
/* 53*/ { "QR CODE", "1", NULL, 0, "symbology: 58," },
/* 54*/ { "qr", "1", NULL, 0, "symbology: 58," }, // Synonym
/* 55*/ { "Code 128 B", "1", NULL, 0, "symbology: 60," },
/* 56*/ { "AUS POST", "12345678901234567890123", NULL, 0, "symbology: 63," },
/* 57*/ { "AusReply", "12345678", NULL, 0, "symbology: 66," },
/* 58*/ { "AUSROUTE", "12345678", NULL, 0, "symbology: 67," },
/* 59*/ { "AUS REDIRECT", "12345678", NULL, 0, "symbology: 68," },
/* 60*/ { "isbnx", "123456789", NULL, 0, "symbology: 69," },
/* 61*/ { "rm4scc", "1", NULL, 0, "symbology: 70," },
/* 62*/ { "DataMatrix", "1", NULL, 0, "symbology: 71," },
/* 63*/ { "EAN14", "1", NULL, 0, "symbology: 72," },
/* 64*/ { "vin", "12345678701234567", NULL, 0, "symbology: 73," },
/* 65*/ { "CodaBlock-F", "1", NULL, 0, "symbology: 74," },
/* 66*/ { "NVE18", "1", NULL, 0, "symbology: 75," },
/* 67*/ { "Japan Post", "1", NULL, 0, "symbology: 76," },
/* 68*/ { "Korea Post", "1", NULL, 0, "symbology: 77," },
/* 69*/ { "DBar Stk", "1", NULL, 0, "symbology: 79," },
/* 70*/ { "rss14stack", "1", NULL, 0, "symbology: 79," },
/* 71*/ { "DBar Omn Stk", "1", NULL, 0, "symbology: 80," },
/* 72*/ { "RSS14STACK OMNI", "1", NULL, 0, "symbology: 80," },
/* 73*/ { "DBar Exp Stk", "[20]01", NULL, 0, "symbology: 81," },
/* 74*/ { "rss_expstack", "[20]01", NULL, 0, "symbology: 81," },
/* 75*/ { "planet", "12345678901", NULL, 0, "symbology: 82," },
/* 76*/ { "MicroPDF417", "1", NULL, 0, "symbology: 84," },
/* 77*/ { "USPS IMail", "12345678901234567890", NULL, 0, "symbology: 85," },
/* 78*/ { "OneCode", "12345678901234567890", NULL, 0, "symbology: 85," },
/* 79*/ { "plessey", "1", NULL, 0, "symbology: 86," },
/* 80*/ { "telepen num", "1", NULL, 0, "symbology: 87," },
/* 81*/ { "ITF14", "1", NULL, 0, "symbology: 89," },
/* 82*/ { "KIX", "1", NULL, 0, "symbology: 90," },
/* 83*/ { "Aztec", "1", NULL, 0, "symbology: 92," },
/* 84*/ { "daft", "D", NULL, 0, "symbology: 93," },
/* 85*/ { "DPD", "0123456789012345678901234567", NULL, 0, "symbology: 96," },
/* 86*/ { "Micro QR", "1", NULL, 0, "symbology: 97," },
/* 87*/ { "hibc128", "1", NULL, 0, "symbology: 98," },
/* 88*/ { "hibccode128", "1", NULL, 0, "symbology: 98," }, // Synonym
/* 89*/ { "hibc39", "1", NULL, 0, "symbology: 99," },
/* 90*/ { "hibccode39", "1", NULL, 0, "symbology: 99," }, // Synonym
/* 91*/ { "hibcdatamatrix", "1", NULL, 0, "symbology: 102," }, // Synonym
/* 92*/ { "hibcdm", "1", NULL, 0, "symbology: 102," },
/* 93*/ { "HIBC qr", "1", NULL, 0, "symbology: 104," },
/* 94*/ { "HIBC QR Code", "1", NULL, 0, "symbology: 104," }, // Synonym
/* 95*/ { "HIBCPDF", "1", NULL, 0, "symbology: 106," },
/* 96*/ { "HIBCPDF417", "1", NULL, 0, "symbology: 106," }, // Synonym
/* 97*/ { "HIBCMICPDF", "1", NULL, 0, "symbology: 108," },
/* 98*/ { "HIBC Micro PDF", "1", NULL, 0, "symbology: 108," }, // Synonym
/* 99*/ { "HIBC Micro PDF417", "1", NULL, 0, "symbology: 108," }, // Synonym
/*100*/ { "HIBC BlockF", "1", NULL, 0, "symbology: 110," },
/*101*/ { "HIBC CodaBlock-F", "1", NULL, 0, "symbology: 110," }, // Synonym
/*102*/ { "HIBC Aztec", "1", NULL, 0, "symbology: 112," },
/*103*/ { "DotCode", "1", NULL, 0, "symbology: 115," },
/*104*/ { "Han Xin", "1", NULL, 0, "symbology: 116," },
/*105*/ { "Mailmark", "01000000000000000AA00AA0A", NULL, 0, "symbology: 121," },
/*106*/ { "azrune", "1", NULL, 0, "symbology: 128," },
/*107*/ { "aztecrune", "1", NULL, 0, "symbology: 128," }, // Synonym
/*108*/ { "aztecrunes", "1", NULL, 0, "symbology: 128," }, // Synonym
/*109*/ { "code32", "1", NULL, 0, "symbology: 129," },
/*110*/ { "eanx cc", "[20]01", "1234567890128", 0, "symbology: 130," },
/*111*/ { "eancc", "[20]01", "1234567890128", 0, "symbology: 130," },
/*112*/ { "GS1 128 CC", "[01]12345678901231", "[20]01", 0, "symbology: 131," },
/*113*/ { "EAN128 CC", "[01]12345678901231", "[20]01", 0, "symbology: 131," },
/*114*/ { "dbaromncc", "[20]01", "1234567890123", 0, "symbology: 132," },
/*115*/ { "rss14 cc", "[20]01", "1234567890123", 0, "symbology: 132," },
/*116*/ { "dbarltdcc", "[20]01", "1234567890123", 0, "symbology: 133," },
/*117*/ { "rss ltd cc", "[20]01", "1234567890123", 0, "symbology: 133," },
/*118*/ { "dbarexpcc", "[20]01", "[01]12345678901231", 0, "symbology: 134," },
/*119*/ { "rss exp cc", "[20]01", "[01]12345678901231", 0, "symbology: 134," },
/*120*/ { "upcacc", "[20]01", "12345678901", 0, "symbology: 135," },
/*121*/ { "upcecc", "[20]01", "1234567", 0, "symbology: 136," },
/*122*/ { "dbar stk cc", "[20]01", "1234567890123", 0, "symbology: 137," },
/*123*/ { "rss14stackcc", "[20]01", "1234567890123", 0, "symbology: 137," },
/*124*/ { "dbaromnstkcc", "[20]01", "1234567890123", 0, "symbology: 138," },
/*125*/ { "BARCODE_RSS14_OMNI_CC", "[20]01", "1234567890123", 0, "symbology: 138," },
/*126*/ { "dbarexpstkcc", "[20]01", "[01]12345678901231", 0, "symbology: 139," },
/*127*/ { "RSS EXPSTACK CC", "[20]01", "[01]12345678901231", 0, "symbology: 139," },
/*128*/ { "Channel", "1", NULL, 0, "symbology: 140," },
/*129*/ { "CodeOne", "1", NULL, 0, "symbology: 141," },
/*130*/ { "Grid Matrix", "1", NULL, 0, "symbology: 142," },
/*131*/ { "UPN QR", "1", NULL, 0, "symbology: 143," },
/*132*/ { "UPN QR Code", "1", NULL, 0, "symbology: 143," }, // Synonym
/*133*/ { "ultra", "1", NULL, 0, "symbology: 144," },
/*134*/ { "ultracode", "1", NULL, 0, "symbology: 144," }, // Synonym
/*135*/ { "rMQR", "1", NULL, 0, "symbology: 145," },
/*136*/ { "x", "1", NULL, 1, "Error 119: Invalid barcode type 'x'" },
/*137*/ { "\177", "1", NULL, 1, "Error 119: Invalid barcode type '\177'" },
/* 8*/ { "2 of 5 Standard", "1", NULL, 0, "symbology: 2," }, // Synonym
/* 9*/ { "2 of 5 Matrix", "1", NULL, 0, "symbology: 2," }, // Synonym
/* 10*/ { "Code 2 of 5 Standard", "1", NULL, 0, "symbology: 2," }, // Synonym
/* 11*/ { "Code 2 of 5 Matrix", "1", NULL, 0, "symbology: 2," }, // Synonym
/* 12*/ { "Standard Code 2 of 5", "1", NULL, 0, "symbology: 2," }, // Synonym
/* 13*/ { "C25INTER", "1", NULL, 0, "symbology: 3," },
/* 14*/ { "c25 interleaved", "1", NULL, 0, "symbology: 3," }, // Synonym
/* 15*/ { "code 2 of 5 inter", "1", NULL, 0, "symbology: 3," }, // Synonym
/* 16*/ { "code 2 of 5 interleaved", "1", NULL, 0, "symbology: 3," }, // Synonym
/* 17*/ { "2 of 5 inter", "1", NULL, 0, "symbology: 3," }, // Synonym
/* 18*/ { "2 of 5 interleaved", "1", NULL, 0, "symbology: 3," }, // Synonym
/* 19*/ { "interleaved 2 of 5", "1", NULL, 0, "symbology: 3," }, // Synonym
/* 20*/ { "interleaved code 2 of 5", "1", NULL, 0, "symbology: 3," }, // Synonym
/* 21*/ { "c25IATA", "1", NULL, 0, "symbology: 4," },
/* 22*/ { "2of5IATA", "1", NULL, 0, "symbology: 4," }, // Synonym
/* 23*/ { "code2of5IATA", "1", NULL, 0, "symbology: 4," }, // Synonym
/* 24*/ { "IATA2of5", "1", NULL, 0, "symbology: 4," }, // Synonym
/* 25*/ { "IATAcode2of5", "1", NULL, 0, "symbology: 4," }, // Synonym
/* 26*/ { "c25 Logic", "1", NULL, 0, "symbology: 6," },
/* 27*/ { "c25 Data Logic", "1", NULL, 0, "symbology: 6," }, // Synonym
/* 28*/ { "Code 2 of 5 Logic", "1", NULL, 0, "symbology: 6," }, // Synonym
/* 29*/ { "Code 2 of 5 Data Logic", "1", NULL, 0, "symbology: 6," }, // Synonym
/* 30*/ { "2 of 5 Logic", "1", NULL, 0, "symbology: 6," }, // Synonym
/* 31*/ { "2 of 5 Data Logic", "1", NULL, 0, "symbology: 6," }, // Synonym
/* 32*/ { "c25 Ind", "1", NULL, 0, "symbology: 7," },
/* 33*/ { "c25 Industrial", "1", NULL, 0, "symbology: 7," }, // Synonym
/* 34*/ { "code 2 of 5 Ind", "1", NULL, 0, "symbology: 7," }, // Synonym
/* 35*/ { "code 2 of 5 Industrial", "1", NULL, 0, "symbology: 7," }, // Synonym
/* 36*/ { "2 of 5 Ind", "1", NULL, 0, "symbology: 7," }, // Synonym
/* 37*/ { "2 of 5 Industrial", "1", NULL, 0, "symbology: 7," }, // Synonym
/* 38*/ { "Industrial 2 of 5", "1", NULL, 0, "symbology: 7," }, // Synonym
/* 39*/ { "Industrial code 2 of 5", "1", NULL, 0, "symbology: 7," }, // Synonym
/* 40*/ { "code39", "1", NULL, 0, "symbology: 8," },
/* 41*/ { "excode 39", "1", NULL, 0, "symbology: 9," },
/* 42*/ { "Extended Code 39", "1", NULL, 0, "symbology: 9," },
/* 43*/ { "eanx", "1", NULL, 0, "symbology: 13," },
/* 44*/ { "ean", "1", NULL, 0, "symbology: 13," },
/* 45*/ { "eanx chk", "1", NULL, 0, "symbology: 14," },
/* 46*/ { "eanxchk", "1", NULL, 0, "symbology: 14," },
/* 47*/ { "eanchk", "1", NULL, 0, "symbology: 14," },
/* 48*/ { "GS1128", "[01]12345678901231", NULL, 0, "symbology: 16," },
/* 49*/ { "ean 128", "[01]12345678901231", NULL, 0, "symbology: 16," },
/* 50*/ { "coda bar", "A1B", NULL, 0, "symbology: 18," },
/* 51*/ { "DPLEIT", "1", NULL, 0, "symbology: 21," },
/* 52*/ { "DPIDENT", "1", NULL, 0, "symbology: 22," },
/* 53*/ { "code16k", "1", NULL, 0, "symbology: 23," },
/* 54*/ { "CODE49", "1", NULL, 0, "symbology: 24," },
/* 55*/ { "CODE93", "1", NULL, 0, "symbology: 25," },
/* 56*/ { "flat", "1", NULL, 0, "symbology: 28," },
/* 57*/ { "dbar omn", "1", NULL, 0, "symbology: 29," },
/* 58*/ { "rss14", "1", NULL, 0, "symbology: 29," },
/* 59*/ { "databar omn", "1", NULL, 0, "symbology: 29," },
/* 60*/ { "databar omni", "1", NULL, 0, "symbology: 29," },
/* 61*/ { "dbar ltd", "1", NULL, 0, "symbology: 30," },
/* 62*/ { "rss ltd", "1", NULL, 0, "symbology: 30," },
/* 63*/ { "databar ltd", "1", NULL, 0, "symbology: 30," },
/* 64*/ { "databar limited", "1", NULL, 0, "symbology: 30," },
/* 65*/ { "dbarexp", "[10]12", NULL, 0, "symbology: 31," },
/* 66*/ { "rss exp", "[10]12", NULL, 0, "symbology: 31," },
/* 67*/ { "databarexp", "[10]12", NULL, 0, "symbology: 31," },
/* 68*/ { "databarexpanded", "[10]12", NULL, 0, "symbology: 31," },
/* 69*/ { "telepen", "1", NULL, 0, "symbology: 32," },
/* 70*/ { "upc", "1", NULL, 1, "Error 119: Invalid barcode type 'upc'" },
/* 71*/ { "upca", "1", NULL, 0, "symbology: 34," },
/* 72*/ { "upca_chk", "123456789012", NULL, 0, "symbology: 35," },
/* 73*/ { "upce", "1", NULL, 0, "symbology: 37," },
/* 74*/ { "upce chk", "12345670", NULL, 0, "symbology: 38," },
/* 75*/ { "POSTNET ", "12345678901", NULL, 0, "symbology: 40," },
/* 76*/ { "msi", "1", NULL, 0, "symbology: 47," },
/* 77*/ { "MSI Plessey ", "1", NULL, 0, "symbology: 47," },
/* 78*/ { "fim ", "A", NULL, 0, "symbology: 49," },
/* 79*/ { "LOGMARS", "123456", NULL, 0, "symbology: 50," },
/* 80*/ { " pharma", "123456", NULL, 0, "symbology: 51," },
/* 81*/ { " pzn ", "1", NULL, 0, "symbology: 52," },
/* 82*/ { "pharma two", "4", NULL, 0, "symbology: 53," },
/* 83*/ { "BARCODE_PDF417", "1", NULL, 0, "symbology: 55," },
/* 84*/ { "pdf", "1", NULL, 1, "Error 119: Invalid barcode type 'pdf'" },
/* 85*/ { "barcodepdf417comp", "1", NULL, 0, "symbology: 56," },
/* 86*/ { "pdf417trunc", "1", NULL, 0, "symbology: 56," },
/* 87*/ { "MaxiCode", "1", NULL, 0, "symbology: 57," },
/* 88*/ { "QR CODE", "1", NULL, 0, "symbology: 58," },
/* 89*/ { "qr", "1", NULL, 0, "symbology: 58," }, // Synonym
/* 90*/ { "Code 128 B", "1", NULL, 0, "symbology: 60," },
/* 91*/ { "AUS POST", "12345678901234567890123", NULL, 0, "symbology: 63," },
/* 92*/ { "AusReply", "12345678", NULL, 0, "symbology: 66," },
/* 93*/ { "AUSROUTE", "12345678", NULL, 0, "symbology: 67," },
/* 94*/ { "AUS REDIRECT", "12345678", NULL, 0, "symbology: 68," },
/* 95*/ { "isbnx", "123456789", NULL, 0, "symbology: 69," },
/* 96*/ { "rm4scc", "1", NULL, 0, "symbology: 70," },
/* 97*/ { "DataMatrix", "1", NULL, 0, "symbology: 71," },
/* 98*/ { "EAN14", "1", NULL, 0, "symbology: 72," },
/* 99*/ { "vin", "12345678701234567", NULL, 0, "symbology: 73," },
/*100*/ { "CodaBlock-F", "1", NULL, 0, "symbology: 74," },
/*101*/ { "NVE18", "1", NULL, 0, "symbology: 75," },
/*102*/ { "Japan Post", "1", NULL, 0, "symbology: 76," },
/*103*/ { "Korea Post", "1", NULL, 0, "symbology: 77," },
/*104*/ { "DBar Stk", "1", NULL, 0, "symbology: 79," },
/*105*/ { "rss14stack", "1", NULL, 0, "symbology: 79," },
/*106*/ { "DataBar Stk", "1", NULL, 0, "symbology: 79," },
/*107*/ { "DataBar Stacked", "1", NULL, 0, "symbology: 79," },
/*108*/ { "DBar Omn Stk", "1", NULL, 0, "symbology: 80," },
/*109*/ { "RSS14STACK OMNI", "1", NULL, 0, "symbology: 80," },
/*110*/ { "DataBar Omn Stk", "1", NULL, 0, "symbology: 80," },
/*111*/ { "DataBar Stacked Omn", "1", NULL, 0, "symbology: 80," },
/*112*/ { "DataBar Stacked Omni", "1", NULL, 0, "symbology: 80," },
/*113*/ { "DBar Exp Stk", "[20]01", NULL, 0, "symbology: 81," },
/*114*/ { "rss_expstack", "[20]01", NULL, 0, "symbology: 81," },
/*115*/ { "DataBar Exp Stk", "[20]01", NULL, 0, "symbology: 81," },
/*116*/ { "DataBar Expanded Stk", "[20]01", NULL, 0, "symbology: 81," },
/*117*/ { "DataBar Expanded Stacked", "[20]01", NULL, 0, "symbology: 81," },
/*118*/ { "planet", "12345678901", NULL, 0, "symbology: 82," },
/*119*/ { "MicroPDF417", "1", NULL, 0, "symbology: 84," },
/*120*/ { "USPS IMail", "12345678901234567890", NULL, 0, "symbology: 85," },
/*121*/ { "OneCode", "12345678901234567890", NULL, 0, "symbology: 85," },
/*122*/ { "plessey", "1", NULL, 0, "symbology: 86," },
/*123*/ { "telepen num", "1", NULL, 0, "symbology: 87," },
/*124*/ { "ITF14", "1", NULL, 0, "symbology: 89," },
/*125*/ { "KIX", "1", NULL, 0, "symbology: 90," },
/*126*/ { "Aztec", "1", NULL, 0, "symbology: 92," },
/*127*/ { "Aztec Code", "1", NULL, 0, "symbology: 92," }, // Synonym
/*128*/ { "daft", "D", NULL, 0, "symbology: 93," },
/*129*/ { "DPD", "0123456789012345678901234567", NULL, 0, "symbology: 96," },
/*130*/ { "Micro QR", "1", NULL, 0, "symbology: 97," },
/*131*/ { "Micro QR Code", "1", NULL, 0, "symbology: 97," },
/*132*/ { "hibc128", "1", NULL, 0, "symbology: 98," },
/*133*/ { "hibccode128", "1", NULL, 0, "symbology: 98," }, // Synonym
/*134*/ { "hibc39", "1", NULL, 0, "symbology: 99," },
/*135*/ { "hibccode39", "1", NULL, 0, "symbology: 99," }, // Synonym
/*136*/ { "hibcdatamatrix", "1", NULL, 0, "symbology: 102," }, // Synonym
/*137*/ { "hibcdm", "1", NULL, 0, "symbology: 102," },
/*138*/ { "HIBC qr", "1", NULL, 0, "symbology: 104," },
/*139*/ { "HIBC QR Code", "1", NULL, 0, "symbology: 104," }, // Synonym
/*140*/ { "HIBCPDF", "1", NULL, 0, "symbology: 106," },
/*141*/ { "HIBCPDF417", "1", NULL, 0, "symbology: 106," }, // Synonym
/*142*/ { "HIBCMICPDF", "1", NULL, 0, "symbology: 108," },
/*143*/ { "HIBC Micro PDF", "1", NULL, 0, "symbology: 108," }, // Synonym
/*144*/ { "HIBC Micro PDF417", "1", NULL, 0, "symbology: 108," }, // Synonym
/*145*/ { "HIBC BlockF", "1", NULL, 0, "symbology: 110," },
/*146*/ { "HIBC CodaBlock-F", "1", NULL, 0, "symbology: 110," }, // Synonym
/*147*/ { "HIBC Aztec", "1", NULL, 0, "symbology: 112," },
/*148*/ { "DotCode", "1", NULL, 0, "symbology: 115," },
/*149*/ { "Han Xin", "1", NULL, 0, "symbology: 116," },
/*150*/ { "Mailmark", "01000000000000000AA00AA0A", NULL, 0, "symbology: 121," },
/*151*/ { "azrune", "1", NULL, 0, "symbology: 128," },
/*152*/ { "aztecrune", "1", NULL, 0, "symbology: 128," }, // Synonym
/*153*/ { "aztecrunes", "1", NULL, 0, "symbology: 128," }, // Synonym
/*154*/ { "code32", "1", NULL, 0, "symbology: 129," },
/*155*/ { "eanx cc", "[20]01", "1234567890128", 0, "symbology: 130," },
/*156*/ { "eancc", "[20]01", "1234567890128", 0, "symbology: 130," },
/*157*/ { "GS1 128 CC", "[01]12345678901231", "[20]01", 0, "symbology: 131," },
/*158*/ { "EAN128 CC", "[01]12345678901231", "[20]01", 0, "symbology: 131," },
/*159*/ { "dbaromncc", "[20]01", "1234567890123", 0, "symbology: 132," },
/*160*/ { "rss14 cc", "[20]01", "1234567890123", 0, "symbology: 132," },
/*161*/ { "databaromncc", "[20]01", "1234567890123", 0, "symbology: 132," },
/*162*/ { "databaromnicc", "[20]01", "1234567890123", 0, "symbology: 132," },
/*163*/ { "dbarltdcc", "[20]01", "1234567890123", 0, "symbology: 133," },
/*164*/ { "rss ltd cc", "[20]01", "1234567890123", 0, "symbology: 133," },
/*165*/ { "databarltdcc", "[20]01", "1234567890123", 0, "symbology: 133," },
/*166*/ { "databarlimitedcc", "[20]01", "1234567890123", 0, "symbology: 133," },
/*167*/ { "dbarexpcc", "[20]01", "[01]12345678901231", 0, "symbology: 134," },
/*168*/ { "rss exp cc", "[20]01", "[01]12345678901231", 0, "symbology: 134," },
/*169*/ { "databarexpcc", "[20]01", "[01]12345678901231", 0, "symbology: 134," },
/*170*/ { "databar expanded cc", "[20]01", "[01]12345678901231", 0, "symbology: 134," },
/*171*/ { "upcacc", "[20]01", "12345678901", 0, "symbology: 135," },
/*172*/ { "upcecc", "[20]01", "1234567", 0, "symbology: 136," },
/*173*/ { "dbar stk cc", "[20]01", "1234567890123", 0, "symbology: 137," },
/*174*/ { "rss14stackcc", "[20]01", "1234567890123", 0, "symbology: 137," },
/*175*/ { "databar stk cc", "[20]01", "1234567890123", 0, "symbology: 137," },
/*176*/ { "databar stacked cc", "[20]01", "1234567890123", 0, "symbology: 137," },
/*177*/ { "dbaromnstkcc", "[20]01", "1234567890123", 0, "symbology: 138," },
/*178*/ { "BARCODE_RSS14_OMNI_CC", "[20]01", "1234567890123", 0, "symbology: 138," },
/*179*/ { "databaromnstkcc", "[20]01", "1234567890123", 0, "symbology: 138," },
/*180*/ { "databar stacked omncc", "[20]01", "1234567890123", 0, "symbology: 138," },
/*181*/ { "databar stacked omni cc", "[20]01", "1234567890123", 0, "symbology: 138," },
/*182*/ { "dbarexpstkcc", "[20]01", "[01]12345678901231", 0, "symbology: 139," },
/*183*/ { "RSS EXPSTACK CC", "[20]01", "[01]12345678901231", 0, "symbology: 139," },
/*184*/ { "databarexpstkcc", "[20]01", "[01]12345678901231", 0, "symbology: 139," },
/*185*/ { "databar expanded stkcc", "[20]01", "[01]12345678901231", 0, "symbology: 139," },
/*186*/ { "databar expanded stacked cc", "[20]01", "[01]12345678901231", 0, "symbology: 139," },
/*187*/ { "Channel", "1", NULL, 0, "symbology: 140," },
/*188*/ { "Channel Code", "1", NULL, 0, "symbology: 140," },
/*189*/ { "CodeOne", "1", NULL, 0, "symbology: 141," },
/*190*/ { "Grid Matrix", "1", NULL, 0, "symbology: 142," },
/*191*/ { "UPN QR", "1", NULL, 0, "symbology: 143," },
/*192*/ { "UPN QR Code", "1", NULL, 0, "symbology: 143," }, // Synonym
/*193*/ { "ultra", "1", NULL, 0, "symbology: 144," },
/*194*/ { "ultracode", "1", NULL, 0, "symbology: 144," }, // Synonym
/*195*/ { "rMQR", "1", NULL, 0, "symbology: 145," },
/*196*/ { "x", "1", NULL, 1, "Error 119: Invalid barcode type 'x'" },
/*197*/ { "\177", "1", NULL, 1, "Error 119: Invalid barcode type '\177'" },
};
int data_size = ARRAY_SIZE(data);
int i;
@ -991,7 +1064,7 @@ static void test_barcode_symbology(int index, int debug) {
strcat(cmd, " 2>&1");
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i), "i:%d exec(%s) NULL\n", i, cmd);
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i, NULL), "i:%d exec(%s) NULL\n", i, cmd);
assert_nonnull(strstr(buf, data[i].expected), "i:%d strstr(%s, %s) == NULL (%s)\n", i, buf, data[i].expected, cmd);
if (!data[i].fail) {
assert_zero(remove(outfilename), "i:%d remove(%s) != 0 (%d: %s) (%s)\n", i, outfilename, errno, strerror(errno), cmd);
@ -1088,7 +1161,7 @@ static void test_other_opts(int index, int debug) {
strcat(cmd, " 2>&1");
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i), "i:%d exec(%s) NULL\n", i, cmd);
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i, NULL), "i:%d exec(%s) NULL\n", i, cmd);
if (data[i].strstr_cmp) {
assert_nonnull(strstr(buf, data[i].expected), "i:%d strstr buf (%s) != expected (%s) (%s)\n", i, buf, data[i].expected, cmd);
} else {
@ -1099,6 +1172,59 @@ static void test_other_opts(int index, int debug) {
testFinish();
}
static void test_exit_status(int index, int debug) {
struct item {
int b;
char *data;
int input_mode;
char *opt;
char *opt_data;
int expected;
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_CODE128, "1", -1, " --bg=", "EF9900", 0 },
/* 1*/ { BARCODE_CODE128, "1", -1, " --bg=", "GF9900", ZINT_ERROR_INVALID_OPTION }, // Caught by libzint
/* 2*/ { BARCODE_CODE128, "1", -1, " --border=", "1001", ZINT_WARN_INVALID_OPTION }, // Caught by CLI
/* 3*/ { BARCODE_CODE128, "1", -1, " --data=", "\200", ZINT_ERROR_INVALID_DATA }, // Caught by libzint
/* 4*/ { BARCODE_CODE128, "1", -1, " --separator=", "-1", ZINT_ERROR_INVALID_OPTION }, // Caught by CLI
};
int data_size = ARRAY_SIZE(data);
int i;
int exit_status;
char cmd[4096];
char buf[8192];
testStart("test_exit_status");
for (i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
strcpy(cmd, "zint");
*buf = '\0';
arg_int(cmd, "-b ", data[i].b);
arg_input_mode(cmd, data[i].input_mode);
arg_data(cmd, "-d ", data[i].data);
if (data[i].opt_data != NULL) {
arg_data(cmd, data[i].opt, data[i].opt_data);
} else {
strcat(cmd, data[i].opt);
}
strcat(cmd, " 2>&1");
assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i, &exit_status), "i:%d exec(%s) NULL\n", i, cmd);
assert_equal(exit_status, data[i].expected, "i:%d exit_status %d != expected (%d) (%s), (cmd: %s)\n", i, exit_status, data[i].expected, buf, cmd);
}
testFinish();
}
int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */
@ -1111,6 +1237,7 @@ int main(int argc, char *argv[]) {
{ "test_checks", test_checks, 1, 0, 1 },
{ "test_barcode_symbology", test_barcode_symbology, 1, 0, 1 },
{ "test_other_opts", test_other_opts, 1, 0, 1 },
{ "test_exit_status", test_exit_status, 1, 0, 1 },
};
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));

View File

@ -53,6 +53,7 @@ FORMS += extCLI.ui \
grpUltra.ui \
grpUPCA.ui \
grpUPCEAN.ui \
grpUPNQR.ui \
grpVIN.ui \
mainWindow.ui

View File

@ -43,6 +43,7 @@ FORMS += extCLI.ui \
grpUltra.ui \
grpUPCA.ui \
grpUPCEAN.ui \
grpUPNQR.ui \
grpVIN.ui \
mainWindow.ui

View File

@ -120,7 +120,7 @@ static const struct bstyle_item bstyle_items[] = {
{ QSL("PLANET"), BARCODE_PLANET },
{ QSL("POSTNET"), BARCODE_POSTNET },
{ QSL("QR Code (ISO 18004) (and HIBC)"), BARCODE_QRCODE },
{ QSL("Rectangular Micro QR (rMQR)"), BARCODE_RMQR },
{ QSL("Rectangular Micro QR (rMQR) (ISO 23941)"), BARCODE_RMQR },
{ QSL("Royal Mail 4-state Barcode (RM4SCC)"), BARCODE_RM4SCC },
{ QSL("Royal Mail 4-state Mailmark"), BARCODE_MAILMARK },
{ QSL("Telepen"), BARCODE_TELEPEN },
@ -532,13 +532,14 @@ void MainWindow::about()
"\"QR Code\" is a Registered Trademark of Denso Corp.<br>"
"\"Telepen\" is a Registered Trademark of SB Electronics.</p>"
"<p><table border=1><tr><td><small>Currently supported standards include:<br>"
"EN 798:1996, EN 12323:2005, ISO/IEC 15420:2009, ISO/IEC 15417:2007,<br>"
"ISO/IEC 15438:2015, ISO/IEC 16022:2006, ISO/IEC 16023:2000,<br>"
"ISO/IEC 16388:2007, ISO/IEC 18004:2015, ISO/IEC 20830:2021,<br>"
"ISO/IEC 24723:2010, ISO/IEC 24724:2011, ISO/IEC 24728:2006,<br>"
"ISO/IEC 24778:2008, ISO/IEC 16390:2007, ISO/IEC 21471:2019,<br>"
"ANSI-HIBC 2.6-2016, ANSI/AIM BC12-1998, ANSI/AIM BC6-2000,<br>"
"ANSI/AIM BC5-1995, AIM ISS-X-24, AIMD014 (v 1.63), USPS-B-3200"
"EN 798:1996, EN 12323:2005, ISO/IEC 15420:2009,<br>"
"ISO/IEC 15417:2007, ISO/IEC 15438:2015, ISO/IEC 16022:2006,<br>"
"ISO/IEC 16023:2000, ISO/IEC 16388:2007, ISO/IEC 18004:2015,<br>"
"ISO/IEC 20830:2021, ISO/IEC 24723:2010, ISO/IEC 24724:2011,<br>"
"ISO/IEC 24728:2006, ISO/IEC 24778:2008, ISO/IEC 16390:2007,<br>"
"ISO/IEC 21471:2019, AIM USS Code One (1994), ANSI-HIBC 2.6-2016,<br>"
"ANSI/AIM BC12-1998, ANSI/AIM BC6-2000, ANSI/AIM BC5-1995,<br>"
"AIM ISS-X-24, AIMD014 (v 1.63), AIM ITS/04-023 (2022)"
"</small></td></tr></table></p>").arg(zint_version).arg(QT_VERSION_STR));
}

View File

@ -28,9 +28,9 @@
<file>grpQR.ui</file>
<file>grpRMQR.ui</file>
<file>grpUltra.ui</file>
<file>grpUPNQR.ui</file>
<file>grpUPCA.ui</file>
<file>grpUPCEAN.ui</file>
<file>grpUPNQR.ui</file>
<file>grpVIN.ui</file>
<file>res/zint-qt.ico</file>
<file>res/zint_black.ico</file>