Skip to content

Commit

Permalink
updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
schoeggu committed Feb 19, 2011
1 parent 9bfba77 commit 181fcfc
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 36 deletions.
51 changes: 32 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,35 @@ Optional:
Usage (Sample Program)
----------------------

qrgen [-m mode] [-e errorCorrectionLevel] [-v version] [-w] [-f file] [-s size] [-h] data ...
[-m mode] Encoding Mode. Use 'a' for alphanumeric, 'n' for numeric or 'b' for binary encodation.
Default: binary
[-e ecLevel] Error Correction Level. Use 'l' for low, 'm' for medium, 'q' for more or 'h' for high.
Default: high
[-v version] Version. The specified version must be between and including 1 and 40.
If the version is 0, the programm chooses the smallest possible version itself.
Default: 0
[-w] Displays the qrcode in a window.
[-f file] Save the qrcode to the specified file.
If -f is not set, the programm displays the qrcode in a window.
NOTE: Only png and svg are supported.
[-s size] Qrcode Size in Pixels.
Default 200.
[-h] Print this help.
data The data to encode.
qrgen [-m mode] [-e errorCorrectionLevel] [-v version] [-w] [-f file] [-s size] [-h] [--] data ...

-m, --mode Encoding Mode. Use 'a' for alphanumeric, 'n' for numeric or 'b' for binary encodation.
Default: binary

-e, --eclevel Error Correction Level. Use 'l' for low, 'm' for medium, 'q' for more or 'h' for high.
Default: high

-v, --symbol-version Version. The specified version must be between and including 1 and 40.
If the version is 0, the programm chooses the smallest possible version itself.
Default: 0

-w, --window Displays the qrcode in a window.

-f, --file Save the qrcode to the specified file.
If -f is not set, the programm displays the qrcode in a window.
NOTE: Only png and svg are supported.

-s, --size Qrcode Size in Pixels.
Default 200.

-h, --help Print this help.

--version Print version number.

-- Ignore all options after this.

data The data to encode.


For Example:

Expand Down Expand Up @@ -111,7 +124,7 @@ Example:

Will generate this:

![generated_QR_Code](http://img26.imageshack.us/img26/5615/qrgen2.png)
![generated QR Code](http://img26.imageshack.us/img26/5615/qrgen2.png)

Building
--------
Expand All @@ -127,7 +140,7 @@ _NOTE:_ There is a directory called *rc*. The programm only works if you call it
License
-------

Copyright (C) 2011 Joel Sutter
Copyright (C) 2011 Joel Sutter (joel.sutter.dev@gmail.com)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -144,4 +157,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

See LICENCE.txt and GPL.txt

NOTE: The term 'QR code' is a registered trademark of Denso Wave Incorporated.
NOTE: The term 'QR code' is a registered trademark of Denso Wave Incorporated.
98 changes: 98 additions & 0 deletions doc/man1/qrgen.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
.TH qrgen 1 "February 2011"
.SH NAME
qrgen - a QR Code generator
.SH SYNOPSIS
.B qrgen
.RB [ \-m
.IR "mode" ]
.RB [ \-e
.IR "errorCorrectionLevel" ]
.RB [ \-v
.IR "version" ]
.RB [ \-w ]
.RB [ \-f
.IR "filename" ]
.RB [ \-s
.IR "size" ]
.RB [ \-h ]
.RB [ \-v ]
.IR data\ ...

.SH DESCRIPTION
.PP
XX
.PP
XX

.SH OPTIONS

.TP
.BI \-m\ encode_mode ,\ --mode\ encode_mode
Encoding Mode. Use
.I a
for alphanumeric,
.I n
for numeric or
.I b
for binary encodation.
Default:
.IR b .


.TP
.BI \-e\ level ,\ --eclevel\ level
Error Correction Level. Use
.I l
(7%) for low,
.I m
(15%) for medium
.I q
(25%) for more or
.I h
(30%) for high.
Default:
.IR h .


.TP
.BI \-v\ version ,\ --symbol-version\ version
Version. The specified version must be between and including 1 and 40.
If the version is 0, the programm chooses the smallest possible version itself.
Version 1 has a size of 21x21, with every step the size size of a version increases by 4. Version 2 has a size of 25x25, version 3 is 29x29 and version 40 is 144x144.
Default:
.IR 0 .

.TP
.BR \-w ,\ --window
Displays the qrcode in a window

.TP
.BR \-f\ file ,\ --file\ file
Save the qrcode to the specified
.I file
.RB If\ -f
is not set, the programm displays the qrcode in a window.
NOTE: Only png and svg are supported.

.TP
.BR \-s\ size ,\ --size\ size
Size of the qrcode in pixels.
Default: 200.

.TP
.BR \--
Ignore the rest of the labeled arguments following this flag.

.TP
.B --version
Display version information and exit.
.TP
.BR \-h ,\ --help
Display usage information and exit.

.SH EXAMPLES
.SH FILES
.PP
.SH BUGS
.SH AUTHOR
Joel Sutter (joel.sutter.dev@gmail.com)
53 changes: 36 additions & 17 deletions src/app/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>

#include <cairo.h>
#include <cairo-svg.h>
Expand All @@ -26,9 +27,21 @@ int main(int argc, char** argv)
int displaySize = 200;
int len;

struct option options[] = {
{"mode", 1, NULL, 'm'},
{"eclevel", 1, NULL, 'e'},
{"symbol-version", 1, NULL, 'v'},
{"window", 0, NULL, 'w'},
{"file", 1, NULL, 'f'},
{"size", 1, NULL, 's'},
{"help", 0, NULL, 'h'},
{"version", 0, NULL, 'x'},
{0, 0, 0, 0}
};

int opt;
while ((opt = getopt(argc, argv, "m:e:v:wf:s:h")) != -1) {
int idx;
while ((opt = getopt_long(argc, argv, "m:e:v:wf:s:hx", options, &idx)) != -1) {
switch (opt) {

case 'm':
Expand Down Expand Up @@ -121,6 +134,10 @@ int main(int argc, char** argv)
case 'h':
printHelp(argv[0]);
return 0;

case 'x':
printf("%s 0.1\n", argv[0]);
return 0;

default:
fprintf(stderr, "Error: Unknown option: %c", (char)opt);
Expand Down Expand Up @@ -219,22 +236,24 @@ int main(int argc, char** argv)

void printHelp(char* progname)
{
printf("usage: %s [-m mode] [-e errorCorrectionLevel] [-v version] [-w] [-f file] [-s size] [-h] data ...\n"
printf("%s 0.1\nusage: %s [-m mode] [-e errorCorrectionLevel] [-v version] [-w] [-f file] [-s size] [-h] [--] data ...\n"

"\n"
"[-m mode] Encoding Mode. Use 'a' for alphanumeric, 'n' for numeric or 'b' for binary encodation.\n"
" Default: binary\n\n"
"[-e ecLevel] Error Correction Level. Use 'l' for low, 'm' for medium, 'q' for more or 'h' for high.\n"
" Default: high\n\n"
"[-v version] Version. The specified version must be between and including 1 and 40.\n"
" If the version is 0, the programm chooses the smallest possible version itself.\n"
" Default: 0\n\n"
"[-w] Displays the qrcode in a window.\n\n"
"[-f file] Save the qrcode to the specified file.\n"
" If -f is not set, the programm displays the qrcode in a window.\n"
" NOTE: Only png and svg are supported.\n\n"
"[-s size] Qrcode Size in Pixels.\n"
" Default 200.\n\n"
"[-h] Print this help.\n\n"
"data The data to encode.\n", progname);
"-m, --mode Encoding Mode. Use 'a' for alphanumeric, 'n' for numeric or 'b' for binary encodation.\n"
" Default: binary\n\n"
"-e, --eclevel Error Correction Level. Use 'l' for low, 'm' for medium, 'q' for more or 'h' for high.\n"
" Default: high\n\n"
"-v, --symbol-version Version. The specified version must be between and including 1 and 40.\n"
" If the version is 0, the programm chooses the smallest possible version itself.\n"
" Default: 0\n\n"
"-w, --window Displays the qrcode in a window.\n\n"
"-f, --file Save the qrcode to the specified file.\n"
" If -f is not set, the programm displays the qrcode in a window.\n"
" NOTE: Only png and svg are supported.\n\n"
"-s, --size Qrcode Size in Pixels.\n"
" Default 200.\n\n"
"-h, --help Print this help.\n\n"
"--version Print version number.\n\n"
"-- Ignore all options after this.\n\n"
"data The data to encode.\n", progname, progname);
}

0 comments on commit 181fcfc

Please sign in to comment.