Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .editorconfig to make indents align correctly. Also add .gitattributes #299

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf encoding=utf-8
24 changes: 12 additions & 12 deletions display.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -179,7 +179,7 @@ fmTerm(void)
}


/*
/*
* Initialize routine.
*/
void
Expand All @@ -197,7 +197,7 @@ fmInit(void)
fmInitialized = TRUE;
}

/*
/*
* Display some lines.
*/
static Line *cline = NULL;
Expand Down Expand Up @@ -1200,7 +1200,7 @@ record_err_message(char *s)
}
}

/*
/*
* List of error messages
*/
Buffer *
Expand Down Expand Up @@ -1458,7 +1458,7 @@ cursorHome(Buffer *buf)
}


/*
/*
* Arrange line,column and cursor position according to current line and
* current position.
*/
Expand Down
68 changes: 34 additions & 34 deletions file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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* */
Expand Down Expand Up @@ -475,7 +475,7 @@ acceptableEncoding(void)
return encodings->ptr;
}

/*
/*
* convert line
*/
#ifdef USE_M17N
Expand Down Expand Up @@ -1189,7 +1189,7 @@ AuthBasicCred(struct http_auth *ha, Str uname, Str pw, ParsedURL *pu,
#include <openssl/md5.h>

/* RFC2617: 3.2.2 The Authorization Request Header
*
*
* credentials = "Digest" digest-response
* digest-response = 1#( username | realm | nonce | digest-uri
* | response | [ algorithm ] | [cnonce] |
Expand Down Expand Up @@ -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] )
Expand Down Expand Up @@ -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);
Expand All @@ -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 */ ;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -3669,10 +3669,10 @@ process_input(struct parsed_tag *tag)
case FORM_INPUT_RESET:
q = "RESET";
break;
/* if no VALUE attribute is specified in
* <INPUT TYPE=CHECKBOX> 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
* <INPUT TYPE=CHECKBOX> 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";
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -5725,7 +5725,7 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
#endif
}
else if (*str == '&') {
/*
/*
* & escape processing
*/
p = getescapecmd(&str);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 <table>..</table>, all input tokens
* are fed to the table renderer, and then the renderer
* makes HTML output.
Expand Down Expand Up @@ -6909,7 +6909,7 @@ addnewline(Buffer *buf, char *line, Lineprop *prop, Linecolor *color, int pos,
}
}

/*
/*
* loadHTMLBuffer: read file and make new buffer
*/
Buffer *
Expand Down Expand Up @@ -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 *
Expand Down Expand Up @@ -7484,7 +7484,7 @@ loadHTMLString(Str page)

#ifdef USE_GOPHER

/*
/*
* loadGopherDir: get gopher directory
*/
#ifdef USE_M17N
Expand Down Expand Up @@ -7643,7 +7643,7 @@ loadGopherSearch0(URLFile *uf, ParsedURL *pu)
}
#endif /* USE_GOPHER */

/*
/*
* loadBuffer: read file and make new buffer
*/
Buffer *
Expand Down Expand Up @@ -7851,7 +7851,7 @@ conv_symbol(Line *l)
return Strnew_charp_n(l->lineBuf, l->len);
}

/*
/*
* saveBuffer: write buffer to file
*/
static void
Expand Down Expand Up @@ -7922,7 +7922,7 @@ loadcmdout(char *cmd,
return buf;
}

/*
/*
* getshell: execute shell command and get the result into a buffer
*/
Buffer *
Expand All @@ -7939,7 +7939,7 @@ getshell(char *cmd)
return buf;
}

/*
/*
* getpipe: execute shell command and connect pipe to the buffer
*/
Buffer *
Expand All @@ -7965,7 +7965,7 @@ getpipe(char *cmd)
return buf;
}

/*
/*
* Open pager buffer
*/
Buffer *
Expand Down Expand Up @@ -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
Expand Down