From e57693d859de76e735506a7b269deb1f6a225e94 Mon Sep 17 00:00:00 2001 From: Elmo Todurov Date: Thu, 16 May 2024 13:37:13 +0300 Subject: [PATCH 1/2] Add .editorconfig and .gitattributes, following the existing style --- .editorconfig | 10 ++++++++++ .gitattributes | 1 + 2 files changed, 11 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..2f6511293 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +[*] +root = true +indent_style = space +indent_size = 4 +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true + +# unfortunately, existing code assumes tw=8 for formatting. Until someone renormalizes the whole repo, let's use this. +tab_width = 8 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..b8afbf657 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf encoding=utf-8 From 7d8670fdae5e578f3b82f99410c2325f9a1d750f Mon Sep 17 00:00:00 2001 From: Elmo Todurov Date: Thu, 16 May 2024 13:44:13 +0300 Subject: [PATCH 2/2] Remove some trailing whitespaces --- display.c | 24 ++++++++++---------- file.c | 68 +++++++++++++++++++++++++++---------------------------- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/display.c b/display.c index f3df215f4..9d2f1aba5 100644 --- a/display.c +++ b/display.c @@ -21,15 +21,15 @@ #define EFFECT_MARK_END effect_mark_end() /*- - * color: - * 0 black - * 1 red - * 2 green + * color: + * 0 black + * 1 red + * 2 green * 3 yellow - * 4 blue - * 5 magenta - * 6 cyan - * 7 white + * 4 blue + * 5 magenta + * 6 cyan + * 7 white */ #define EFFECT_ANCHOR_START_C setfcolor(anchor_color) @@ -179,7 +179,7 @@ fmTerm(void) } -/* +/* * Initialize routine. */ void @@ -197,7 +197,7 @@ fmInit(void) fmInitialized = TRUE; } -/* +/* * Display some lines. */ static Line *cline = NULL; @@ -1200,7 +1200,7 @@ record_err_message(char *s) } } -/* +/* * List of error messages */ Buffer * @@ -1458,7 +1458,7 @@ cursorHome(Buffer *buf) } -/* +/* * Arrange line,column and cursor position according to current line and * current position. */ diff --git a/file.c b/file.c index 9f8e97e30..7a7a184c2 100644 --- a/file.c +++ b/file.c @@ -167,20 +167,20 @@ static struct compression_decoder { int use_d_arg; } compression_decoders[] = { { CMP_COMPRESS, ".gz", "application/x-gzip", - 0, GUNZIP_CMDNAME, GUNZIP_NAME, "gzip", - {"gzip", "x-gzip", NULL}, 0 }, + 0, GUNZIP_CMDNAME, GUNZIP_NAME, "gzip", + {"gzip", "x-gzip", NULL}, 0 }, { CMP_COMPRESS, ".Z", "application/x-compress", 0, GUNZIP_CMDNAME, GUNZIP_NAME, "compress", - {"compress", "x-compress", NULL}, 0 }, + {"compress", "x-compress", NULL}, 0 }, { CMP_BZIP2, ".bz2", "application/x-bzip", 0, BUNZIP2_CMDNAME, BUNZIP2_NAME, "bzip, bzip2", - {"x-bzip", "bzip", "bzip2", NULL}, 0 }, + {"x-bzip", "bzip", "bzip2", NULL}, 0 }, { CMP_DEFLATE, ".deflate", "application/x-deflate", 1, INFLATE_CMDNAME, INFLATE_NAME, "deflate", - {"deflate", "x-deflate", NULL}, 0 }, + {"deflate", "x-deflate", NULL}, 0 }, { CMP_BROTLI, ".br", "application/x-br", 0, BROTLI_CMDNAME, BROTLI_NAME, "br", - {"br", "x-br", NULL}, 1 }, + {"br", "x-br", NULL}, 1 }, { CMP_NOCOMPRESS, NULL, NULL, 0, NULL, NULL, NULL, {NULL}, 0}, }; /* *INDENT-ON* */ @@ -475,7 +475,7 @@ acceptableEncoding(void) return encodings->ptr; } -/* +/* * convert line */ #ifdef USE_M17N @@ -1189,7 +1189,7 @@ AuthBasicCred(struct http_auth *ha, Str uname, Str pw, ParsedURL *pu, #include /* RFC2617: 3.2.2 The Authorization Request Header - * + * * credentials = "Digest" digest-response * digest-response = 1#( username | realm | nonce | digest-uri * | response | [ algorithm ] | [cnonce] | @@ -1427,7 +1427,7 @@ struct auth_param basic_auth_param[] = { #ifdef USE_DIGEST_AUTH /* RFC2617: 3.2.1 The WWW-Authenticate Response Header * challenge = "Digest" digest-challenge - * + * * digest-challenge = 1#( realm | [ domain ] | nonce | * [ opaque ] |[ stale ] | [ algorithm ] | * [ qop-options ] | [auth-param] ) @@ -1541,7 +1541,7 @@ getAuthCookie(struct http_auth *hauth, char *auth_header, auth_header_len); if (a_found) { /* This means that *-Authenticate: header is received after - * Authorization: header is sent to the server. + * Authorization: header is sent to the server. */ if (fmInitialized) { message("Wrong username or password", 0, 0); @@ -1557,7 +1557,7 @@ getAuthCookie(struct http_auth *hauth, char *auth_header, *uname = NULL; *pwd = NULL; - if (!a_found && find_auth_user_passwd(pu, realm, (Str*)uname, (Str*)pwd, + if (!a_found && find_auth_user_passwd(pu, realm, (Str*)uname, (Str*)pwd, proxy)) { /* found username & password in passwd file */ ; } @@ -1596,7 +1596,7 @@ getAuthCookie(struct http_auth *hauth, char *auth_header, realm); exit(1); } - + /* FIXME: gettextize? */ printf(proxy ? "Proxy Username for %s: " : "Username for %s: ", realm); @@ -1691,7 +1691,7 @@ getLinkNumberStr(int correction) return Sprintf("[%d]", cur_hseq + correction); } -/* +/* * loadGeneralFile: load file to buffer */ #define DO_EXTERNAL ((Buffer *(*)(URLFile *, Buffer *))doExternal) @@ -1900,7 +1900,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, t = "text/plain"; if (add_auth_cookie_flag && realm && uname && pwd) { /* If authorization is required and passed */ - add_auth_user_passwd(&pu, qstr_unquote(realm)->ptr, uname, pwd, + add_auth_user_passwd(&pu, qstr_unquote(realm)->ptr, uname, pwd, 0); add_auth_cookie_flag = 0; } @@ -1933,7 +1933,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, && (realm = get_auth_param(hauth.param, "realm")) != NULL) { auth_pu = schemeToProxy(pu.scheme); getAuthCookie(&hauth, "Proxy-Authorization:", - extra_header, auth_pu, &hr, request, + extra_header, auth_pu, &hr, request, &uname, &pwd); if (uname == NULL) { /* abort */ @@ -2114,7 +2114,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, /* XXX: can we use guess_type to give the type to loadHTMLstream * to support default utf8 encoding for XHTML here? */ f.guess_type = t; - + page_loaded: if (page) { FILE *src; @@ -2241,7 +2241,7 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, #endif else if (w3m_backend) ; else if (!(w3m_dump & ~DUMP_FRAME) || is_dump_text_type(t)) { - if (!do_download && + if (!do_download && #ifdef USE_GOPHER !gopher_download && #endif @@ -3669,10 +3669,10 @@ process_input(struct parsed_tag *tag) case FORM_INPUT_RESET: q = "RESET"; break; - /* if no VALUE attribute is specified in - * tag, then the value "on" is used - * as a default value. It is not a part of HTML4.0 - * specification, but an imitation of Netscape behaviour. + /* if no VALUE attribute is specified in + * tag, then the value "on" is used + * as a default value. It is not a part of HTML4.0 + * specification, but an imitation of Netscape behaviour. */ case FORM_INPUT_CHECKBOX: q = "on"; @@ -4355,7 +4355,7 @@ process_idattr(struct readbuffer *obuf, int cmd, struct parsed_tag *tag) char *id = NULL, *framename = NULL; Str idtag = NULL; - /* + /* * HTML_TABLE is handled by the other process. */ if (cmd == HTML_TABLE) @@ -5725,7 +5725,7 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit) #endif } else if (*str == '&') { - /* + /* * & escape processing */ p = getescapecmd(&str); @@ -6474,7 +6474,7 @@ HTMLlineproc0(char *line, struct html_feed_environ *h_env, int internal) tbl_mode->end_tag : obuf->end_tag; if (*line == '<' || obuf->status != R_ST_NORMAL) { - /* + /* * Tag processing */ if (obuf->status == R_ST_EOL) @@ -6559,7 +6559,7 @@ HTMLlineproc0(char *line, struct html_feed_environ *h_env, int internal) proc_normal: if (obuf->table_level >= 0 && tbl && tbl_mode) { - /* + /* * within table: in ..
, all input tokens * are fed to the table renderer, and then the renderer * makes HTML output. @@ -6909,7 +6909,7 @@ addnewline(Buffer *buf, char *line, Lineprop *prop, Linecolor *color, int pos, } } -/* +/* * loadHTMLBuffer: read file and make new buffer */ Buffer * @@ -7441,7 +7441,7 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal) HTMLlineproc2(newBuf, htmlenv1.buf); } -/* +/* * loadHTMLString: read string and make new buffer */ Buffer * @@ -7484,7 +7484,7 @@ loadHTMLString(Str page) #ifdef USE_GOPHER -/* +/* * loadGopherDir: get gopher directory */ #ifdef USE_M17N @@ -7643,7 +7643,7 @@ loadGopherSearch0(URLFile *uf, ParsedURL *pu) } #endif /* USE_GOPHER */ -/* +/* * loadBuffer: read file and make new buffer */ Buffer * @@ -7851,7 +7851,7 @@ conv_symbol(Line *l) return Strnew_charp_n(l->lineBuf, l->len); } -/* +/* * saveBuffer: write buffer to file */ static void @@ -7922,7 +7922,7 @@ loadcmdout(char *cmd, return buf; } -/* +/* * getshell: execute shell command and get the result into a buffer */ Buffer * @@ -7939,7 +7939,7 @@ getshell(char *cmd) return buf; } -/* +/* * getpipe: execute shell command and connect pipe to the buffer */ Buffer * @@ -7965,7 +7965,7 @@ getpipe(char *cmd) return buf; } -/* +/* * Open pager buffer */ Buffer * @@ -8526,7 +8526,7 @@ doFileSave(URLFile uf, char *defstr) char *p, *q; pid_t pid; char *lock; - char *tmpf = NULL; + char *tmpf = NULL; #if !(defined(HAVE_SYMLINK) && defined(HAVE_LSTAT)) FILE *f; #endif