mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-06-20 09:48:12 +02:00
Fix a small bug when parsing the padding command line argument (-p)
When an empty string was passed as padding spec, this was not properly flagged as an error.
This commit is contained in:
parent
84d051f1e5
commit
eab1e13df2
@ -344,10 +344,11 @@ static int killblank(opt_t *result, char *optarg)
|
|||||||
*/
|
*/
|
||||||
static int padding(opt_t *result, char *optarg)
|
static int padding(opt_t *result, char *optarg)
|
||||||
{
|
{
|
||||||
int errfl = 0;
|
int errfl = 1;
|
||||||
char *p = optarg;
|
char *p = optarg;
|
||||||
|
|
||||||
while (*p) {
|
while (*p) {
|
||||||
|
errfl = 0;
|
||||||
if (p[1] == '\0') {
|
if (p[1] == '\0') {
|
||||||
errfl = 1;
|
errfl = 1;
|
||||||
break;
|
break;
|
||||||
@ -395,7 +396,7 @@ static int padding(opt_t *result, char *optarg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (errfl) {
|
if (errfl) {
|
||||||
fprintf(stderr, "%s: invalid padding specification - %s\n", PROJECT, optarg);
|
bx_fprintf(stderr, "%s: invalid padding specification - %s\n", PROJECT, optarg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user