Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
e0ef1224
Commit
e0ef1224
authored
Oct 05, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sfnt2fon: Avoid using getopt_long().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3eb1855c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
46 deletions
+39
-46
sfnt2fon.c
tools/sfnt2fon/sfnt2fon.c
+39
-46
No files found.
tools/sfnt2fon/sfnt2fon.c
View file @
e0ef1224
...
...
@@ -27,9 +27,6 @@
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_GETOPT_H
# include <getopt.h>
#endif
#ifdef HAVE_FREETYPE
...
...
@@ -438,9 +435,11 @@ static const char *output_name;
static
FT_Library
ft_library
;
static
void
usage
(
char
**
argv
)
static
const
char
*
argv0
;
static
void
usage
(
void
)
{
fprintf
(
stderr
,
"%s [options] input.ttf ppem,enc,avg_width ...
\n
"
,
argv
[
0
]
);
fprintf
(
stderr
,
"%s [options] input.ttf ppem,enc,avg_width ...
\n
"
,
argv
0
);
fprintf
(
stderr
,
"Options:
\n
"
);
fprintf
(
stderr
,
" -h Display help
\n
"
);
fprintf
(
stderr
,
" -d char Set the font default char
\n
"
);
...
...
@@ -825,41 +824,36 @@ static void write_fontinfo( const struct fontinfo *info, FILE *fp )
fwrite
(
info
->
data
,
info
->
hdr
.
dfSize
-
info
->
hdr
.
fi
.
dfBitsOffset
,
1
,
fp
);
}
/* parse options from the argv array and remove all the recognized ones */
static
char
**
parse_options
(
int
argc
,
char
**
argv
)
static
void
option_callback
(
int
optc
,
char
*
optarg
)
{
int
optc
;
while
((
optc
=
getopt_long
(
argc
,
argv
,
"d:ho:qr:s"
,
NULL
,
NULL
))
!=
-
1
)
switch
(
optc
)
{
switch
(
optc
)
{
case
'd'
:
option_defchar
=
atoi
(
optarg
);
break
;
case
'o'
:
option_output
=
xstrdup
(
optarg
);
break
;
case
'q'
:
option_quiet
=
1
;
break
;
case
'r'
:
option_dpi
=
atoi
(
optarg
);
break
;
case
's'
:
option_fnt_mode
=
1
;
break
;
case
'h'
:
usage
(
argv
);
exit
(
0
);
case
'?'
:
usage
(
argv
);
exit
(
1
);
}
case
'd'
:
option_defchar
=
atoi
(
optarg
);
break
;
case
'o'
:
option_output
=
xstrdup
(
optarg
);
break
;
case
'q'
:
option_quiet
=
1
;
break
;
case
'r'
:
option_dpi
=
atoi
(
optarg
);
break
;
case
's'
:
option_fnt_mode
=
1
;
break
;
case
'h'
:
usage
();
exit
(
0
);
case
'?'
:
fprintf
(
stderr
,
"%s: %s
\n\n
"
,
argv0
,
optarg
);
usage
();
exit
(
1
);
}
return
&
argv
[
optind
];
}
int
main
(
int
argc
,
char
**
argv
)
{
int
i
,
j
;
...
...
@@ -875,18 +869,19 @@ int main(int argc, char **argv)
NE_TYPEINFO
rc_type
;
NE_NAMEINFO
rc_name
;
struct
fontinfo
**
info
;
char
*
input_file
;
char
**
args
;
c
onst
c
har
*
input_file
;
struct
strarray
args
;
short
tmp16
;
args
=
parse_options
(
argc
,
argv
);
argv0
=
argv
[
0
];
args
=
parse_options
(
argc
,
argv
,
"d:ho:qr:s"
,
NULL
,
0
,
option_callback
);
input_file
=
*
args
++
;
if
(
!
input_file
||
!*
args
)
if
(
!
args
.
count
)
{
usage
(
argv
);
usage
();
exit
(
1
);
}
input_file
=
args
.
str
[
0
];
if
(
FT_Init_FreeType
(
&
ft_library
))
error
(
"ft init failure
\n
"
);
...
...
@@ -894,9 +889,7 @@ int main(int argc, char **argv)
FT_Version
.
major
=
FT_Version
.
minor
=
FT_Version
.
patch
=-
1
;
FT_Library_Version
(
ft_library
,
&
FT_Version
.
major
,
&
FT_Version
.
minor
,
&
FT_Version
.
patch
);
num_files
=
0
;
while
(
args
[
num_files
])
num_files
++
;
num_files
=
args
.
count
-
1
;
if
(
option_fnt_mode
&&
num_files
>
1
)
error
(
"can only specify one font in .fnt mode
\n
"
);
...
...
@@ -906,9 +899,9 @@ int main(int argc, char **argv)
int
ppem
,
enc
,
avg_width
;
const
char
*
name
;
if
(
sscanf
(
args
[
i
],
"%d,%d,%d"
,
&
ppem
,
&
enc
,
&
avg_width
)
!=
3
)
if
(
sscanf
(
args
.
str
[
i
+
1
],
"%d,%d,%d"
,
&
ppem
,
&
enc
,
&
avg_width
)
!=
3
)
{
usage
(
argv
);
usage
();
exit
(
1
);
}
if
(
!
(
info
[
i
]
=
fill_fontinfo
(
input_file
,
ppem
,
enc
,
option_dpi
,
option_defchar
,
avg_width
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment