summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2009-07-03 00:53:20 +0200
committerTor Andersson <tor@ghostscript.com>2009-07-03 00:53:20 +0200
commite3a7b20c1d25019175718e66ed95b56a08d57807 (patch)
treecf50228c16148f4262af6bbb317ce24f93a6a405 /apps
parent322f289734b045fd2d14de0f8cef89658001be01 (diff)
downloadmupdf-e3a7b20c1d25019175718e66ed95b56a08d57807.tar.xz
Use fz_getopt & co.
Diffstat (limited to 'apps')
-rw-r--r--apps/pdfclean.c26
-rw-r--r--apps/pdfdraw.c22
-rw-r--r--apps/pdfextract.c16
-rw-r--r--apps/pdfinfo.c16
-rw-r--r--apps/pdfshow.c20
-rw-r--r--apps/unix/x11pdf.c12
6 files changed, 56 insertions, 56 deletions
diff --git a/apps/pdfclean.c b/apps/pdfclean.c
index 211c461d..f008992f 100644
--- a/apps/pdfclean.c
+++ b/apps/pdfclean.c
@@ -357,39 +357,39 @@ int main(int argc, char **argv)
int lastfree;
- while ((c = getopt(argc, argv, "d:egn:o:p:u:x")) != -1)
+ while ((c = fz_getopt(argc, argv, "d:egn:o:p:u:x")) != -1)
{
switch (c)
{
case 'p':
/* see TABLE 3.15 User access permissions */
perms = 0xfffff0c0;
- if (strchr(optarg, 'p')) /* print */
+ if (strchr(fz_optarg, 'p')) /* print */
perms |= (1 << 2) | (1 << 11);
- if (strchr(optarg, 'm')) /* modify */
+ if (strchr(fz_optarg, 'm')) /* modify */
perms |= (1 << 3) | (1 << 10);
- if (strchr(optarg, 'c')) /* copy */
+ if (strchr(fz_optarg, 'c')) /* copy */
perms |= (1 << 4) | (1 << 9);
- if (strchr(optarg, 'a')) /* annotate / forms */
+ if (strchr(fz_optarg, 'a')) /* annotate / forms */
perms |= (1 << 5) | (1 << 8);
break;
- case 'd': password = optarg; break;
+ case 'd': password = fz_optarg; break;
case 'e': doencrypt ++; break;
case 'g': dogarbage ++; break;
- case 'n': keylen = atoi(optarg); break;
- case 'o': ownerpw = optarg; break;
- case 'u': userpw = optarg; break;
+ case 'n': keylen = atoi(fz_optarg); break;
+ case 'o': ownerpw = fz_optarg; break;
+ case 'u': userpw = fz_optarg; break;
case 'x': doexpand ++; break;
default: cleanusage(); break;
}
}
- if (argc - optind < 1)
+ if (argc - fz_optind < 1)
cleanusage();
- infile = argv[optind++];
- if (argc - optind > 0)
- outfile = argv[optind++];
+ infile = argv[fz_optind++];
+ if (argc - fz_optind > 0)
+ outfile = argv[fz_optind++];
openxref(infile, password);
diff --git a/apps/pdfdraw.c b/apps/pdfdraw.c
index d26d4b9b..1c1dcf74 100644
--- a/apps/pdfdraw.c
+++ b/apps/pdfdraw.c
@@ -427,14 +427,14 @@ int main(int argc, char **argv)
int c;
enum { NO_FILE_OPENED, NO_PAGES_DRAWN, DREW_PAGES } state;
- while ((c = getopt(argc, argv, "b:d:o:r:txm")) != -1)
+ while ((c = fz_getopt(argc, argv, "b:d:o:r:txm")) != -1)
{
switch (c)
{
- case 'b': drawbands = atoi(optarg); break;
- case 'd': password = optarg; break;
- case 'o': drawpattern = optarg; break;
- case 'r': drawzoom = atof(optarg) / 72.0; break;
+ case 'b': drawbands = atoi(fz_optarg); break;
+ case 'd': password = fz_optarg; break;
+ case 'o': drawpattern = fz_optarg; break;
+ case 'r': drawzoom = atof(fz_optarg) / 72.0; break;
case 't': drawmode = DRAWTXT; break;
case 'x': drawmode = DRAWXML; break;
case 'm': benchmark = 1; break;
@@ -444,7 +444,7 @@ int main(int argc, char **argv)
}
}
- if (optind == argc)
+ if (fz_optind == argc)
drawusage();
error = fz_newrenderer(&drawgc, pdf_devicergb, 0, 1024 * 512);
@@ -452,22 +452,22 @@ int main(int argc, char **argv)
die(error);
state = NO_FILE_OPENED;
- while (optind < argc)
+ while (fz_optind < argc)
{
- if (strstr(argv[optind], ".pdf") || strstr(argv[optind], ".PDF"))
+ if (strstr(argv[fz_optind], ".pdf") || strstr(argv[fz_optind], ".PDF"))
{
if (state == NO_PAGES_DRAWN)
drawpages("1-");
- openxref(argv[optind], password);
+ openxref(argv[fz_optind], password);
state = NO_PAGES_DRAWN;
}
else
{
- drawpages(argv[optind]);
+ drawpages(argv[fz_optind]);
state = DREW_PAGES;
}
- optind++;
+ fz_optind++;
}
if (state == NO_PAGES_DRAWN)
diff --git a/apps/pdfextract.c b/apps/pdfextract.c
index 1e7e9473..21d665af 100644
--- a/apps/pdfextract.c
+++ b/apps/pdfextract.c
@@ -290,30 +290,30 @@ int main(int argc, char **argv)
char *password = "";
int c, o;
- while ((c = getopt(argc, argv, "d:")) != -1)
+ while ((c = fz_getopt(argc, argv, "d:")) != -1)
{
switch (c)
{
- case 'd': password = optarg; break;
+ case 'd': password = fz_optarg; break;
default:
showusage();
break;
}
}
- if (optind == argc)
+ if (fz_optind == argc)
showusage();
- openxref(argv[optind++], password);
+ openxref(argv[fz_optind++], password);
- if (optind == argc)
+ if (fz_optind == argc)
for (o = 0; o < xref->len; o++)
showobject(o, 0);
else
- while (optind < argc)
+ while (fz_optind < argc)
{
- showobject(atoi(argv[optind]), 0);
- optind++;
+ showobject(atoi(argv[fz_optind]), 0);
+ fz_optind++;
}
closexref();
diff --git a/apps/pdfinfo.c b/apps/pdfinfo.c
index a1cb3fcd..253e3267 100644
--- a/apps/pdfinfo.c
+++ b/apps/pdfinfo.c
@@ -1086,7 +1086,7 @@ int main(int argc, char **argv)
int show = ALL;
int c;
- while ((c = getopt(argc, argv, "mfispxd:")) != -1)
+ while ((c = fz_getopt(argc, argv, "mfispxd:")) != -1)
{
switch (c)
{
@@ -1096,20 +1096,20 @@ int main(int argc, char **argv)
case 's': if (show == ALL) show = SHADINGS; else show |= SHADINGS; break;
case 'p': if (show == ALL) show = PATTERNS; else show |= PATTERNS; break;
case 'x': if (show == ALL) show = XOBJS; else show |= XOBJS; break;
- case 'd': password = optarg; break;
+ case 'd': password = fz_optarg; break;
default:
infousage();
break;
}
}
- if (optind == argc)
+ if (fz_optind == argc)
infousage();
state = NO_FILE_OPENED;
- while (optind < argc)
+ while (fz_optind < argc)
{
- if (strstr(argv[optind], ".pdf") || strstr(argv[optind], ".PDF"))
+ if (strstr(argv[fz_optind], ".pdf") || strstr(argv[fz_optind], ".PDF"))
{
if (state == NO_INFO_GATHERED)
{
@@ -1117,7 +1117,7 @@ int main(int argc, char **argv)
showinfo(filename, show, "1-");
}
- filename = argv[optind];
+ filename = argv[fz_optind];
opensrc(filename, password, 1);
gatherglobalinfo();
state = NO_INFO_GATHERED;
@@ -1126,11 +1126,11 @@ int main(int argc, char **argv)
{
if (state == NO_INFO_GATHERED)
printglobalinfo(filename);
- showinfo(filename, show, argv[optind]);
+ showinfo(filename, show, argv[fz_optind]);
state = INFO_SHOWN;
}
- optind++;
+ fz_optind++;
}
if (state == NO_INFO_GATHERED)
diff --git a/apps/pdfshow.c b/apps/pdfshow.c
index 994a885c..44d50774 100644
--- a/apps/pdfshow.c
+++ b/apps/pdfshow.c
@@ -181,11 +181,11 @@ int main(int argc, char **argv)
char *password = "";
int c;
- while ((c = getopt(argc, argv, "d:bx")) != -1)
+ while ((c = fz_getopt(argc, argv, "d:bx")) != -1)
{
switch (c)
{
- case 'd': password = optarg; break;
+ case 'd': password = fz_optarg; break;
case 'b': showbinary ++; break;
case 'x': showdecode ++; break;
default:
@@ -194,23 +194,23 @@ int main(int argc, char **argv)
}
}
- if (optind == argc)
+ if (fz_optind == argc)
showusage();
- openxref(argv[optind++], password);
+ openxref(argv[fz_optind++], password);
- if (optind == argc)
+ if (fz_optind == argc)
showtrailer();
- while (optind < argc)
+ while (fz_optind < argc)
{
- if (!strcmp(argv[optind], "trailer"))
+ if (!strcmp(argv[fz_optind], "trailer"))
showtrailer();
- else if (!strcmp(argv[optind], "xref"))
+ else if (!strcmp(argv[fz_optind], "xref"))
showxref();
else
- showobject(atoi(argv[optind]), 0);
- optind++;
+ showobject(atoi(argv[fz_optind]), 0);
+ fz_optind++;
}
closexref();
diff --git a/apps/unix/x11pdf.c b/apps/unix/x11pdf.c
index f2290388..d19e902f 100644
--- a/apps/unix/x11pdf.c
+++ b/apps/unix/x11pdf.c
@@ -516,21 +516,21 @@ int main(int argc, char **argv)
int wasshowingpage;
struct timeval tmo, tmo_at;
- while ((c = getopt(argc, argv, "d:z:p:")) != -1)
+ while ((c = fz_getopt(argc, argv, "d:z:p:")) != -1)
{
switch (c)
{
- case 'd': password = optarg; break;
- case 'z': zoom = atof(optarg); break;
- case 'p': pageno = atoi(optarg); break;
+ case 'd': password = fz_optarg; break;
+ case 'z': zoom = atof(fz_optarg); break;
+ case 'p': pageno = atoi(fz_optarg); break;
default: usage();
}
}
- if (argc - optind == 0)
+ if (argc - fz_optind == 0)
usage();
- filename = argv[optind++];
+ filename = argv[fz_optind++];
fz_cpudetect();
fz_accelerate();