commit ad039c64481c34a6188e18d2669ff841d6a06368
parent bdc246277847e76391580b8e7f63f24633f25b80
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Wed, 23 Dec 2020 13:32:15 -0800
Rename badargs() to warg()
Diffstat:
M | main.c | | | 22 | +++++++++++----------- |
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/main.c b/main.c
@@ -89,7 +89,7 @@ wfclose(FILE *fp)
}
int
-badargs(int min, int max, int argc, const char **ap)
+warg(int min, int max, int argc, const char **ap)
{
if (max > 0 && argc > max) {
warnx("warning: '%s' and %d more arguments unused.", ap[max], argc - (max + 1));
@@ -361,7 +361,7 @@ findex(int argc, const char **argv, unsigned int index, const char **item)
{
unsigned int n;
- if (badargs(1, -1, argc, argv))
+ if (warg(1, -1, argc, argv))
return -1;
if (strtorange(&n, 0, UINT_MAX, argv[0]))
return -1;
@@ -377,7 +377,7 @@ frange(int argc, const char **argv, unsigned int index, const char **item)
unsigned int range[2];
int i;
- if (badargs(2, -1, argc, argv))
+ if (warg(2, -1, argc, argv))
return -1;
for (i = 0; i < 2; ++i)
@@ -391,7 +391,7 @@ frange(int argc, const char **argv, unsigned int index, const char **item)
int
fstring(int argc, const char **argv, unsigned int index, const char **item)
{
- if (badargs(1, -1, argc, argv))
+ if (warg(1, -1, argc, argv))
return -1;
if (strcasestr(item[GI_INFO], argv[0]) != NULL)
return 1;
@@ -401,7 +401,7 @@ fstring(int argc, const char **argv, unsigned int index, const char **item)
int
ftype(int argc, const char **argv, unsigned int index, const char **item)
{
- if (badargs(1, -1, argc, argv))
+ if (warg(1, -1, argc, argv))
return -1;
if (strchr(argv[0], *item[GI_INFO]) != NULL)
return 1;
@@ -413,7 +413,7 @@ sgoto(int argc, const char **argv, int depth, const char **addr)
{
const char *newaddr[AR_NULL];
- if (badargs(0, 3, argc, argv))
+ if (warg(0, 3, argc, argv))
return 1;
newaddr[AR_HOST] = addr[AR_HOST];
@@ -437,7 +437,7 @@ sunwind(int argc, const char **argv, int depth, const char **addr)
{
unsigned int n;
- if (badargs(0, 1, argc, argv))
+ if (warg(0, 1, argc, argv))
return 1;
if (argc == 0)
@@ -450,14 +450,14 @@ sunwind(int argc, const char **argv, int depth, const char **addr)
int
sexit(int argc, const char **argv, int depth, const char **addr)
{
- badargs(0, 0, argc, argv);
+ warg(0, 0, argc, argv);
return depth;
}
int
cprint(int argc, const char **argv, int i, const char **s)
{
- badargs(0, 0, argc, argv);
+ warg(0, 0, argc, argv);
if (**s == 'i')
printf(" %s\n", s[GI_INFO] + 1);
@@ -478,7 +478,7 @@ cfetch(int argc, const char **argv, int i, const char **request)
{
const char *output;
- if (badargs(0, 1, argc, argv))
+ if (warg(0, 1, argc, argv))
return 1;
if (argc > 0)
@@ -501,7 +501,7 @@ cextern(int argc, const char **argv, int index, const char **item)
char url[MY_URL_MAX];
int i;
- if (badargs(1, -1, argc, argv))
+ if (warg(1, -1, argc, argv))
return 1;
snprintf(url, sizeof(url), "%s/%s", item[GI_HOST], item[GI_PATH]);