[hackers] [scc] fix parsing end of comment || Hiltjo Posthuma
commit ede7ba5d7698410287308633d191039d7e795092 Author: Hiltjo Posthuma hil...@codemadness.org AuthorDate: Wed Jul 15 23:06:07 2015 +0200 Commit: Roberto E. Vargas Caballero k...@shike2.com CommitDate: Thu Jul 16 07:31:42 2015 +0200 fix parsing end of comment Hi, This patch fixes parsing the end of a comment, there was a missing ; Kind regards, Hiltjo From 2dc0d42b51973d0e9106a2fd487d9f485178ac34 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma hil...@codemadness.org Date: Wed, 15 Jul 2015 22:34:42 +0200 Subject: [PATCH] lex: fix parsing end of comment diff --git a/cc1/lex.c b/cc1/lex.c index c35e401..111c6f8 100644 --- a/cc1/lex.c +++ b/cc1/lex.c @@ -184,8 +184,8 @@ comment(char type) { if (type == '*') { while (!eof) { - while (readchar() != '*' !eof) - /* nothing */ + while (readchar() != '*' !eof) + /* nothing */; if (readchar() == '/') break; }
[hackers] [scc] minor fixes (whitespace and such) || Hiltjo Posthuma
commit 937a1686e98b70e427e12de8b9b635d245d7e05c Author: Hiltjo Posthuma hil...@codemadness.org AuthorDate: Wed Jul 15 22:22:02 2015 +0200 Commit: Roberto E. Vargas Caballero k...@shike2.com CommitDate: Thu Jul 16 07:31:34 2015 +0200 minor fixes (whitespace and such) Hi, Just some minor fixes (whitespace and such). Kind regards, Hiltjo From c79b4339fc477e2d0212d442f38c50326e430f2a Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma hil...@codemadness.org Date: Wed, 15 Jul 2015 21:37:32 +0200 Subject: [PATCH] whitespace + typo fixes change exit(-1) to exit(1), just use 1 instead of EXIT_FAILURE diff --git a/README b/README index a4c9337..a99676a 100644 --- a/README +++ b/README @@ -23,8 +23,8 @@ friends). This is the reason why I begin to develop this compiler, and I hope it will be useful for you. -Changes from standar C -== +Changes from standard C +=== This compiler is near of being full compatible with C99 standard, but it has some differences: diff --git a/cc1/cpp.c b/cc1/cpp.c index 13ec31b..8552f80 100644 --- a/cc1/cpp.c +++ b/cc1/cpp.c @@ -534,7 +534,7 @@ usererr(char *s) if (cppoff) return; printerr(#error %s, s); - exit(-1); + exit(1); } static void diff --git a/cc1/error.c b/cc1/error.c index 2160c3a..68880d1 100644 --- a/cc1/error.c +++ b/cc1/error.c @@ -25,7 +25,7 @@ warn_helper(int flag, char *fmt, va_list va) putc('\n', stderr); if (flag 0 nerrors++ == MAXERRNUM) { fputs(too many errors\n, stderr); - exit(-1); + exit(1); } } @@ -62,6 +62,6 @@ printerr(char *fmt, ...) void unexpected(void) -{ +{ error(unexpected '%s', yytext); } diff --git a/cc1/lex.c b/cc1/lex.c index 26d9b14..c35e401 100644 --- a/cc1/lex.c +++ b/cc1/lex.c @@ -651,7 +651,7 @@ discard(void) break; } if (c == '\0' !moreinput()) - exit(-1); + exit(1); } jump: yytoken = c; diff --git a/cc2/main.c b/cc2/main.c index 846f81e..3aec235 100644 --- a/cc2/main.c +++ b/cc2/main.c @@ -22,7 +22,7 @@ error(unsigned nerror, ...) vfprintf(stderr, errlist[nerror], va); va_end(va); putc('\n', stderr); - exit(EXIT_FAILURE); + exit(1); } bool diff --git a/cc2/optm.c b/cc2/optm.c index f755023..83a634a 100644 --- a/cc2/optm.c +++ b/cc2/optm.c @@ -34,7 +34,7 @@ repeat: np-left = optcasts(np-left, tp); np-right = optcasts(np-right, tp); - return np; + return np; } static Node * diff --git a/cc2/parser.c b/cc2/parser.c index cfdff4b..99f9d8d 100644 --- a/cc2/parser.c +++ b/cc2/parser.c @@ -464,7 +464,7 @@ oreturn(char *token) if (token = strtok(NULL, \t)) { expr(token); lp = pop(); - np -left = lp; + np-left = lp; np-type = lp-type; } else { np-left = NULL; diff --git a/lib/die.c b/lib/die.c index 6752848..974dd2c 100644 --- a/lib/die.c +++ b/lib/die.c @@ -16,5 +16,5 @@ die(const char *fmt, ...) va_start(va, fmt); fprintf(stderr, fmt, va); va_end(va); - exit(EXIT_FAILURE); + exit(1); }
Re: [hackers] [patch][scc] fix parsing end of comment
Hi, On Thu, Jul 16, 2015 at 12:19:45AM +0100, Dimitris Papastamos wrote: diff --git a/cc1/lex.c b/cc1/lex.c index c35e401..111c6f8 100644 --- a/cc1/lex.c +++ b/cc1/lex.c @@ -184,8 +184,8 @@ comment(char type) { if (type == '*') { while (!eof) { - while (readchar() != '*' !eof) - /* nothing */ wow, I cannot believe this was written in this way. I suppose there are millions of errors in the code now, because I was in an expansion phase. I usually work in this projects in two phases, one phase of adding functionality, without checking too much, and then another phase of checking and rewriting. If I try to keep it working perfectly and well written, it is impossible to advance. I would have put the semicolon on the same line as the while. This is something of style. I took this style from the source code of git, and I think it is also used in the kernel, isn't it?. I don't have problems if it is changed. Regards
[hackers] [surf] Fix ssl failure detection || Quentin Rameau
commit 9343744a6d163409b06bd8dcd26a988ada991b76 Author: Quentin Rameau quinq@fifth.space AuthorDate: Tue Jul 14 13:58:57 2015 +0200 Commit: Quentin Rameau quinq@fifth.space CommitDate: Tue Jul 14 13:58:57 2015 +0200 Fix ssl failure detection Thanks to hendry hen...@webconverger.com for testing. diff --git a/surf.c b/surf.c index bad380c..40384e8 100644 --- a/surf.c +++ b/surf.c @@ -624,7 +624,8 @@ loadchanged(WebKitWebView *view, WebKitLoadEvent event, Client *c) { break; case WEBKIT_LOAD_COMMITTED: uri = geturi(c); - if (webkit_web_view_get_tls_info(c-view, NULL, tlsflags)) { + if (webkit_web_view_get_tls_info(c-view, NULL, tlsflags) + tlsflags) { c-sslfailed = TRUE; } setatom(c, AtomUri, uri);
[hackers] [PATCH] [scc] Default to -ansi and declare at top of block
See attached. From 9732116e19ad933925fa37fc1bbf603bea47dcc6 Mon Sep 17 00:00:00 2001 From: sin s...@2f30.org Date: Wed, 15 Jul 2015 19:52:21 +0100 Subject: [PATCH] Default to -ansi and declare at top of block Without -ansi, the typeof() function was throwing errors. --- cc1/Makefile | 2 +- cc1/cpp.c| 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cc1/Makefile b/cc1/Makefile index c073ae6..ed8ac07 100644 --- a/cc1/Makefile +++ b/cc1/Makefile @@ -1,4 +1,4 @@ - +CFLAGS = -ansi OBJS = types.o decl.o lex.o error.o symbol.o main.o expr.o \ code.o stmt.o cpp.o diff --git a/cc1/cpp.c b/cc1/cpp.c index cb2ce98..13ec31b 100644 --- a/cc1/cpp.c +++ b/cc1/cpp.c @@ -218,7 +218,7 @@ int expand(Symbol *sym) { unsigned len; - int r; + int r, n; char *arglist[NR_MACROARG], arguments[INPUTSIZ], buffer[BUFSIZE]; char prevc, c, *bp, *lim, *arg, *s = sym-u.s; @@ -236,7 +236,7 @@ expand(Symbol *sym) if ((r = parsepars(arguments, arglist, atoi(s))) 1) return r; - for (int n = 0; n atoi(s); ++n) + for (n = 0; n atoi(s); ++n) fprintf(stderr, PAR%d:%s\n, n, arglist[n]); len = INPUTSIZ-1; -- 2.4.5
Re: [hackers] [surf] Fix ssl failure detection || Quentin Rameau
g...@suckless.org wrote: + if (webkit_web_view_get_tls_info(c-view, NULL, tlsflags) + tlsflags) { Heyho, I would switch the test around and check for `tlsflags` first. It probably doesn't affect the binary, but is easier to read for humans. --Markus
[hackers] [scc] Remove inline from hash() || Roberto E. Vargas Caballero
commit 5e295214e4eddad0eb9be0b88398ed4137269694 Author: Roberto E. Vargas Caballero k...@shike2.com AuthorDate: Wed Jul 15 22:15:52 2015 +0200 Commit: Roberto E. Vargas Caballero k...@shike2.com CommitDate: Wed Jul 15 22:15:52 2015 +0200 Remove inline from hash() Who need it? diff --git a/cc1/symbol.c b/cc1/symbol.c index 22efd69..c5c6b5e 100644 --- a/cc1/symbol.c +++ b/cc1/symbol.c @@ -36,7 +36,7 @@ dumpstab(char *msg) } #endif -static inline unsigned +static unsigned hash(const char *s) { unsigned c, h;
[hackers] [dvtm] create in $CWD not working
Hi, The create() function can take a third argument in order to use the directory of the current client, sel, when it creates a new client. This command is mapped to MOD+C by default. To implement this, the function uses the /proc/ tree to find the current directory of process sel-pid. The problem, at least for me, is that sel-pid is the generic sh that spawns the actual user shell, so when I cd in my shell, the cwd of the calling sh process doesn't change. $ pstree -p 2199 dvtm(2199)─┬─sh(2239)───bash(2240)───mutt(11096) ├─sh(2324)───bash(2325) ├─sh(12015)───bash(12016)───vim(17544) └─sh(12116)───bash(12117)───pstree(21626) For example, sel-pid is 2324, and I'm interacting with shell pid 2325. The cwd of process 2324 is ~/, but I've changed the cwd of process 2325 to ~/local/repos/dvtm/. When I press MOD+C in my shell, dvtm creates a new client with cwd of ~/, same as sel-pid 2324, not where I expect it to in ~/local/repos/dvtm/. Do others also have this issue? I'm not very familiar with /proc/; is there something in there that could be used to identify the user shell instead? But that might not work for everyone. Thanks -Ross