badwords: check indented lines in source code, fix fallouts

- badwords.pl: add `-a` option to check all lines in source code files.
  Before this patch indented lines were skipped (to avoid Markdown code
  fences.)
- GHA/checksrc: use `-a` when verifying the source code.
- GHA/checksrc: disable `So` and `But` rules for source code.
- GHA/checksrc: add docs/examples to the verified sources.
- badwords.txt: delete 4 duplicates.
- badwords.txt: group and sort contractions.
- badwords.txt: allow ` url = `, `DIR`, `<file name`.

Closes #19536
This commit is contained in:
Viktor Szakats 2025-11-14 17:55:33 +01:00
parent 8a968095df
commit 2dc71ba8bf
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
73 changed files with 146 additions and 144 deletions

View file

@ -152,7 +152,7 @@ int main(int argc, char **argv)
data twice!!! */
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
/* set user name and password for the authentication */
/* set username and password for the authentication */
curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
/* Now run off and do what you have been told! */

View file

@ -40,7 +40,7 @@ int main(void)
/*
Each single string should be written using the format
HOST:PORT:CONNECT-TO-HOST:CONNECT-TO-PORT where HOST is the host of the
request, PORT is the port of the request, CONNECT-TO-HOST is the host name
request, PORT is the port of the request, CONNECT-TO-HOST is the hostname
to connect to, and CONNECT-TO-PORT is the port to connect to.
*/
/* instead of curl.se:443, it resolves and uses example.com:443 but in other
@ -53,12 +53,12 @@ int main(void)
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_URL, "https://curl.se/");
/* since this connects to the wrong host, checking the host name in the
/* since this connects to the wrong host, checking the hostname in the
server certificate fails, so unless we disable the check libcurl
returns CURLE_PEER_FAILED_VERIFICATION */
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
/* Letting the wrong host name in the certificate be okay, the transfer
/* Letting the wrong hostname in the certificate be okay, the transfer
goes through but (most likely) causes a 404 or similar because it sends
an unknown name in the Host: header field */
res = curl_easy_perform(curl);

View file

@ -47,7 +47,7 @@ static int print_cookies(CURL *curl)
printf("Cookies, curl knows:\n");
res = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies);
if(res != CURLE_OK) {
fprintf(stderr, "Curl curl_easy_getinfo failed: %s\n",
fprintf(stderr, "curl curl_easy_getinfo failed: %s\n",
curl_easy_strerror(res));
return 1;
}
@ -85,7 +85,7 @@ main(void)
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); /* start cookie engine */
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
fprintf(stderr, "Curl perform failed: %s\n", curl_easy_strerror(res));
fprintf(stderr, "curl perform failed: %s\n", curl_easy_strerror(res));
return 1;
}
@ -105,7 +105,7 @@ main(void)
"PREF", "hello example, I like you!");
res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline);
if(res != CURLE_OK) {
fprintf(stderr, "Curl curl_easy_setopt failed: %s\n",
fprintf(stderr, "curl curl_easy_setopt failed: %s\n",
curl_easy_strerror(res));
return 1;
}
@ -120,7 +120,7 @@ main(void)
"expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.example.com");
res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline);
if(res != CURLE_OK) {
fprintf(stderr, "Curl curl_easy_setopt failed: %s\n",
fprintf(stderr, "curl curl_easy_setopt failed: %s\n",
curl_easy_strerror(res));
return 1;
}
@ -129,14 +129,14 @@ main(void)
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
fprintf(stderr, "Curl perform failed: %s\n", curl_easy_strerror(res));
fprintf(stderr, "curl perform failed: %s\n", curl_easy_strerror(res));
return 1;
}
curl_easy_cleanup(curl);
}
else {
fprintf(stderr, "Curl init failed!\n");
fprintf(stderr, "curl init failed!\n");
return 1;
}

View file

@ -69,7 +69,7 @@ static void dump(const char *text, FILE *stream, unsigned char *ptr,
}
fprintf(stream, "%c",
(ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.');
/* check again for 0D0A, to avoid an extra \n if it's at width */
/* check again for 0D0A, to avoid an extra \n if it is at width */
if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
ptr[i + c + 2] == 0x0A) {
i += (c + 3 - width);

View file

@ -133,7 +133,7 @@ static void mcode_or_die(const char *where, CURLMcode code)
static void timer_cb(struct GlobalInfo *g, int revents);
/* Update the timer after curl_multi library does its thing. Curl informs the
/* Update the timer after curl_multi library does its thing. curl informs the
* application through this callback what it wants the new timeout to be,
* after it does some work. */
static int multi_timer_cb(CURLM *multi, long timeout_ms, struct GlobalInfo *g)
@ -219,7 +219,7 @@ static void timer_cb(struct GlobalInfo *g, int revents)
err = read(g->tfd, &count, sizeof(uint64_t));
if(err == -1) {
/* Note that we may call the timer callback even if the timerfd is not
* readable. It's possible that there are multiple events stored in the
* readable. It is possible that there are multiple events stored in the
* epoll buffer (i.e. the timer may have fired multiple times). The event
* count is cleared after the first call so future events in the epoll
* buffer fails to read from the timer. */

View file

@ -90,7 +90,7 @@ int main(void)
/* get a FILE * of the file */
hd_src = fopen(LOCAL_FILE, "rb");
if(!hd_src) {
printf("Couldn't open '%s': %s\n", LOCAL_FILE, strerror(errno));
printf("Could not open '%s': %s\n", LOCAL_FILE, strerror(errno));
return 2;
}

View file

@ -50,7 +50,7 @@ void dumpNode(TidyDoc doc, TidyNode tnod, int indent)
for(child = tidyGetChild(tnod); child; child = tidyGetNext(child) ) {
ctmbstr name = tidyNodeGetName(child);
if(name) {
/* if it has a name, then it's an HTML tag ... */
/* if it has a name, then it is an HTML tag ... */
TidyAttr attr;
printf("%*.*s%s ", indent, indent, "<", name);
/* walk the attribute list */
@ -62,7 +62,7 @@ void dumpNode(TidyDoc doc, TidyNode tnod, int indent)
printf(">\n");
}
else {
/* if it does not have a name, then it's probably text, cdata, etc... */
/* if it does not have a name, then it is probably text, cdata, etc... */
TidyBuffer buf;
tidyBufInit(&buf);
tidyNodeGetText(doc, child, &buf);

View file

@ -22,7 +22,7 @@
*
***************************************************************************/
/* <DESC>
* Get a web page, extract the title with libxml.
* Get a webpage, extract the title with libxml.
* </DESC>
Written by Lars Nilsson

View file

@ -90,7 +90,7 @@ static void dump(const char *text, int num, unsigned char *ptr,
}
fprintf(stderr, "%c",
(ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.');
/* check again for 0D0A, to avoid an extra \n if it's at width */
/* check again for 0D0A, to avoid an extra \n if it is at width */
if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
ptr[i + c + 2] == 0x0A) {
i += (c + 3 - width);

View file

@ -78,7 +78,7 @@ static void dump(const char *text, unsigned char *ptr, size_t size, char nohex)
}
fprintf(stderr, "%c",
(ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.');
/* check again for 0D0A, to avoid an extra \n if it's at width */
/* check again for 0D0A, to avoid an extra \n if it is at width */
if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
ptr[i + c + 2] == 0x0A) {
i += (c + 3 - width);

View file

@ -128,7 +128,7 @@ static void dump(const char *text, int num, unsigned char *ptr,
}
fprintf(stderr, "%c",
(ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.');
/* check again for 0D0A, to avoid an extra \n if it's at width */
/* check again for 0D0A, to avoid an extra \n if it is at width */
if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
ptr[i + c + 2] == 0x0A) {
i += (c + 3 - width);
@ -305,7 +305,7 @@ int main(int argc, char **argv)
num_transfers = 3; /* a suitable low default */
if(argc > 2)
/* if given a file name, upload this! */
/* if given a filename, upload this! */
filename = argv[2];
}
else

View file

@ -22,7 +22,7 @@
*
***************************************************************************/
/* <DESC>
* Very simple HTTP/3 GET
* Simple HTTP/3 GET
* </DESC>
*/
#include <stdio.h>

View file

@ -56,7 +56,7 @@ int main(void)
#ifdef SKIP_HOSTNAME_VERIFICATION
/*
* If the site you are connecting to uses a different host name that what
* If the site you are connecting to uses a different hostname that what
* they have mentioned in their server certificate's commonName (or
* subjectAltName) fields, libcurl refuses to connect. You can skip this
* check, but it makes the connection insecure.

View file

@ -68,7 +68,7 @@ int main(void)
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
#endif
/* If the site you are connecting to uses a different host name that what
/* If the site you are connecting to uses a different hostname that what
* they have mentioned in their server certificate's commonName (or
* subjectAltName) fields, libcurl refuses to connect. You can skip this
* check, but it makes the connection insecure. */

View file

@ -140,8 +140,8 @@ static int mem_addf(struct mem *mem, const char *format, ...)
/* we need about 100 chars or less to write 95% of lines */
x = 128;
/* first try: there's probably enough memory to write everything.
second try: there's definitely enough memory to write everything. */
/* first try: there is probably enough memory to write everything.
second try: there is definitely enough memory to write everything. */
for(i = 0; i < 2; ++i) {
if(x < 0 || mem_need(mem, (size_t)x + 1) < 0)
break;

View file

@ -71,7 +71,7 @@ static void dump(const char *text, FILE *stream, unsigned char *ptr,
}
fprintf(stream, "%c",
(ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.');
/* check again for 0D0A, to avoid an extra \n if it's at width */
/* check again for 0D0A, to avoid an extra \n if it is at width */
if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D &&
ptr[i + c + 2] == 0x0A) {
i += (c + 3 - width);

View file

@ -51,7 +51,7 @@ int main(void)
CURL_IGNORE_DEPRECATION(
/* Fill in the file upload field. This makes libcurl load data from
the given file name when curl_easy_perform() is called. */
the given filename when curl_easy_perform() is called. */
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "sendfile",

View file

@ -97,7 +97,7 @@ int main(void)
pull_one_url,
(void *)&targs[i]);
if(error)
fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
fprintf(stderr, "Could not run thread number %d, errno %d\n", i, error);
else
fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]);
}

View file

@ -51,7 +51,7 @@ int main(void)
/* extract hostname from the parsed URL */
uc = curl_url_get(h, CURLUPART_HOST, &host, 0);
if(!uc) {
printf("Host name: %s\n", host);
printf("Hostname: %s\n", host);
curl_free(host);
}

View file

@ -67,7 +67,7 @@ int main(void)
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
#endif
/* If the site you are connecting to uses a different host name that what
/* If the site you are connecting to uses a different hostname that what
* they have mentioned in their server certificate's commonName (or
* subjectAltName) fields, libcurl refuses to connect. You can skip this
* check, but it makes the connection insecure. */

View file

@ -22,7 +22,7 @@
*
***************************************************************************/
/* <DESC>
* Very simple RTSP request sending OPTIONS.
* Simple RTSP request sending OPTIONS.
* </DESC>
*/
#include <stdio.h>

View file

@ -22,7 +22,7 @@
*
***************************************************************************/
/* <DESC>
* Very simple HTTP GET
* Simple HTTP GET
* </DESC>
*/
#include <stdio.h>

View file

@ -22,7 +22,7 @@
*
***************************************************************************/
/* <DESC>
* Very simple HTTP POST
* Simple HTTP POST
* </DESC>
*/
#include <stdio.h>

View file

@ -133,7 +133,7 @@ void *create_thread(void *progress_bar)
pull_one_url,
NULL);
if(error)
fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
fprintf(stderr, "Could not run thread number %d, errno %d\n", i, error);
else
fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]);
}

View file

@ -116,7 +116,7 @@ int main(void)
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
#endif
/* If the site you are connecting to uses a different host name that what
/* If the site you are connecting to uses a different hostname that what
* they have mentioned in their server certificate's commonName (or
* subjectAltName) fields, libcurl refuses to connect. You can skip this
* check, but it makes the connection insecure. */

View file

@ -91,7 +91,7 @@ int main(int argc, char **argv)
pull_one_url,
(void *)&i);
if(error)
fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
fprintf(stderr, "Could not run thread number %d, errno %d\n", i, error);
else
fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]);
}

View file

@ -42,7 +42,7 @@ int main(void)
if(res)
return (int)res;
/* init Curl URL */
/* init curl URL */
urlp = curl_url();
uc = curl_url_set(urlp, CURLUPART_URL,
"http://example.com/path/index.html", 0);