Codebase list mg / 16bb1f0
Updated version 20171014 from 'upstream/20171014' with Debian dir dee10101aec00e51aae4cbaee2532d1654d8194c Harald Dunkel 6 years ago
5 changed file(s) with 48 addition(s) and 33 deletion(s). Raw diff Collapse all Expand all
99 /chrdef.h/1.10/Thu Sep 1 15:28:17 2016//
1010 /cinfo.c/1.18/Thu Sep 1 15:28:17 2016//
1111 /cmode.c/1.16/Thu Sep 1 15:28:17 2016//
12 /cscope.c/1.16/Thu Sep 1 15:28:17 2016//
1312 /dired.c/1.83/Sat Nov 26 10:20:10 2016//
1413 /echo.c/1.66/Sat Nov 26 10:20:10 2016//
1514 /extend.c/1.64/Mon Sep 12 16:36:26 2016//
1615 /file.c/1.100/Thu Sep 1 15:28:17 2016//
1716 /funmap.c/1.53/Thu Sep 1 15:30:59 2016//
1817 /funmap.h/1.7/Thu Sep 1 15:28:17 2016//
19 /grep.c/1.44/Thu Sep 1 15:28:17 2016//
2018 /help.c/1.35/Thu Sep 1 15:28:17 2016//
2119 /kbd.c/1.30/Thu Sep 1 15:28:17 2016//
2220 /kbd.h/1.19/Thu Sep 1 15:28:17 2016//
2321 /key.h/1.5/Thu Sep 1 15:28:17 2016//
2422 /keymap.c/1.58/Thu Sep 1 15:28:17 2016//
25 /line.c/1.58/Thu Sep 1 15:28:17 2016//
2623 /macro.c/1.16/Thu Sep 1 15:28:17 2016//
2724 /macro.h/1.7/Thu Sep 1 15:28:17 2016//
2825 /match.c/1.19/Thu Sep 1 15:28:17 2016//
4744 /search.c/1.46/Mon Aug 28 07:58:36 2017//
4845 /tags.c/1.16/Result of merge//
4946 /tutorial/1.17/Mon Aug 28 07:58:36 2017//
47 /cscope.c/1.17/Sat Oct 14 12:00:53 2017//
48 /grep.c/1.45/Sat Oct 14 12:00:53 2017//
49 /line.c/1.59/Sat Oct 14 12:00:53 2017//
5050 D
4040 ```
4141 cvs diff -uw
4242 ```
43
44 ## ABOUT fgetln()
45
46 Incase you are wondering about that deprecation warning, here is a nice explanation about why it is hard to fix:
47
48 http://niallohiggins.com/2009/10/03/read-a-file-line-by-line-in-c-secure-fgets-idiom/
0 /* $OpenBSD: cscope.c,v 1.16 2016/01/19 14:51:00 sunil Exp $ */
0 /* $OpenBSD: cscope.c,v 1.17 2017/10/12 14:12:00 florian Exp $ */
11
22 /*
33 * This file is in the public domain.
165165 struct stat sb;
166166 FILE *fpipe;
167167 char dir[NFILEN], cmd[BUFSIZ], title[BUFSIZ], *line, *bufp;
168 size_t len;
168 size_t sz;
169 ssize_t len;
169170 int clen;
171
172 line = NULL;
173 sz = 0;
170174
171175 if (getbufcwd(dir, sizeof(dir)) == FALSE)
172176 dir[0] = '\0';
220224 }
221225 addline(bp, title);
222226 addline(bp, "");
223 /* All lines are NUL terminated */
224 while ((line = fgetln(fpipe, &len)) != NULL) {
225 line[len - 1] = '\0';
227 while ((len = getline(&line, &sz, fpipe)) != -1) {
228 if (line[len - 1] == '\n')
229 line[len - 1] = '\0';
226230 addline(bp, line);
227231 }
232 free(line);
233 if (ferror(fpipe))
234 ewprintf("Problem reading pipe");
228235 pclose(fpipe);
229236 return (popbuftop(bp, WNONE));
230237 }
396403 char pattern[MAX_TOKEN], cmd[BUFSIZ], title[BUFSIZ];
397404 char *p, *buf;
398405 int clen, nores = 0;
399 size_t len;
406 size_t sz;
407 ssize_t len;
408
409 buf = NULL;
410 sz = 0;
400411
401412 /* If current buffer isn't a source file just return */
402413 if (fnmatch("*.[chy]", curbp->b_fname, 0) != 0) {
446457 addline(bp, title);
447458 addline(bp, "");
448459 addline(bp, "-------------------------------------------------------------------------------");
449 /* All lines are NUL terminated */
450 while ((buf = fgetln(fpipe, &len)) != NULL) {
451 buf[len - 1] = '\0';
452 if (addentry(bp, buf) != TRUE)
453 return (FALSE);
460 while ((len = getline(&buf, &sz, fpipe)) != -1) {
461 if (buf[len - 1] == '\n')
462 buf[len - 1] = '\0';
463 if (addentry(bp, buf) != TRUE) {
464 free(buf);
465 return (FALSE);
466 }
454467 nores = 1;
455 };
468 }
469 free(buf);
470 if (ferror(fpipe))
471 ewprintf("Problem reading pipe");
456472 pclose(fpipe);
457473 addline(bp, "-------------------------------------------------------------------------------");
458474 if (nores == 0)
0 /* $OpenBSD: grep.c,v 1.44 2015/03/19 21:48:05 bcallah Exp $ */
0 /* $OpenBSD: grep.c,v 1.45 2017/10/12 14:12:00 florian Exp $ */
11
22 /* This file is in the public domain */
33
177177 struct buffer *bp;
178178 FILE *fpipe;
179179 char *buf;
180 size_t len;
180 size_t sz;
181 ssize_t len;
181182 int ret, n;
182183 char cwd[NFILEN], qcmd[NFILEN];
183184 char timestr[NTIME];
184185 time_t t;
185186
187 buf = NULL;
188 sz = 0;
189
186190 n = snprintf(qcmd, sizeof(qcmd), "%s 2>&1", command);
187191 if (n < 0 || n >= sizeof(qcmd))
188192 return (NULL);
209213 ewprintf("Problem opening pipe");
210214 return (NULL);
211215 }
212 /*
213 * We know that our commands are nice and the last line will end with
214 * a \n, so we don't need to try to deal with the last line problem
215 * in fgetln.
216 */
217 while ((buf = fgetln(fpipe, &len)) != NULL) {
218 buf[len - 1] = '\0';
216 while ((len = getline(&buf, &sz, fpipe)) != -1) {
217 if (buf[len - 1] == '\n')
218 buf[len - 1] = '\0';
219219 addline(bp, buf);
220220 }
221 free(buf);
222 if (ferror(fpipe))
223 ewprintf("Problem reading pipe");
221224 ret = pclose(fpipe);
222225 t = time(NULL);
223226 strftime(timestr, sizeof(timestr), "%a %b %e %T %Y", localtime(&t));
0 /* $OpenBSD: line.c,v 1.58 2015/12/11 20:21:23 mmcc Exp $ */
0 /* $OpenBSD: line.c,v 1.59 2017/09/09 13:10:28 florian Exp $ */
11
22 /* This file is in the public domain. */
33
263263 for (wp = wheadp; wp != NULL; wp = wp->w_wndp) {
264264 if (wp->w_linep == lp1)
265265 wp->w_linep = lp2;
266 if (wp->w_dotline >= tcurwpdotline)
266 if (wp->w_dotline >= tcurwpdotline &&
267 wp->w_bufp == curwp->w_bufp)
267268 wp->w_dotline++;
268269 }
269270 undo_add_boundary(FFRAND, 1);
291292 wp->w_dotp = lp2;
292293 wp->w_doto -= doto;
293294 wp->w_dotline++;
294 } else if (wp->w_dotline > tcurwpdotline)
295 } else if (wp->w_dotline > tcurwpdotline &&
296 wp->w_bufp == curwp->w_bufp)
295297 wp->w_dotline++;
296298 if (wp->w_markp == lp1 && wp->w_marko >= doto) {
297299 wp->w_markp = lp2;