mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-06-21 10:18:17 +02:00
fixes a bug with strtol on mac
This commit is contained in:
parent
71e9f4f0af
commit
4576f966af
25
src/boxes.c
25
src/boxes.c
@ -656,25 +656,20 @@ static int process_commandline (int argc, char *argv[])
|
||||
*/
|
||||
pdummy = strchr (optarg, 'x');
|
||||
if (!pdummy) pdummy = strchr (optarg, 'X');
|
||||
errno = 0;
|
||||
opt.reqwidth = strtol (optarg, NULL, 10);
|
||||
idummy = errno;
|
||||
if (idummy) {
|
||||
fprintf (stderr, "%s: invalid box size specification: %s\n",
|
||||
PROJECT, strerror(idummy));
|
||||
return 1;
|
||||
if(pdummy) {
|
||||
*pdummy = '\0';
|
||||
}
|
||||
errno = 0;
|
||||
if (optarg != pdummy) opt.reqwidth = strtol (optarg, NULL, 10);
|
||||
if (pdummy) {
|
||||
errno = 0;
|
||||
opt.reqheight = strtol (pdummy+1, NULL, 10);
|
||||
idummy = errno;
|
||||
if (idummy) {
|
||||
fprintf (stderr, "%s: invalid box size specification: %s\n",
|
||||
PROJECT, strerror(idummy));
|
||||
*pdummy = 'x';
|
||||
}
|
||||
if(errno){
|
||||
fprintf (stderr, "%s: box size: %s, '%s'\n",
|
||||
PROJECT, strerror(idummy), optarg);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if ((opt.reqwidth == 0 && opt.reqheight == 0)
|
||||
} else if ((opt.reqwidth == 0 && opt.reqheight == 0)
|
||||
|| opt.reqwidth < 0 || opt.reqheight < 0) {
|
||||
fprintf (stderr, "%s: invalid box size specification -- %s\n",
|
||||
PROJECT, optarg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user