FreeBSD Bugzilla – Attachment 173125 Details for
Bug 211399
usr.sbin/etcupdate/preworld_test:main because of r303047
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix and then some
p-211399 (text/plain), 2.73 KB, created by
Mikhail T.
on 2016-07-30 18:26:19 UTC
(
hide
)
Description:
Fix and then some
Filename:
MIME Type:
Creator:
Mikhail T.
Created:
2016-07-30 18:26:19 UTC
Size:
2.73 KB
patch
obsolete
>Index: compile.c >=================================================================== >--- compile.c (revision 303554) >+++ compile.c (working copy) >@@ -70,11 +70,11 @@ > static const char *compile_flags(const char *, struct s_subst *); > static const regex_t *compile_re(const char *, int); > static const char *compile_subst(const char *, struct s_subst *); >-static char *compile_text(size_t *); >+static char *compile_text(int *); > static const char *compile_tr(const char *, struct s_tr **); > static struct s_command > **compile_stream(struct s_command **); >-static char *duptoeol(const char *, const char *, size_t *); >+static char *duptoeol(const char *, const char *, int *); > static void enterlabel(struct s_command *); > static struct s_command > *findlabel(const char *); >@@ -723,7 +723,7 @@ > * Compile the text following an a, c, or i command. > */ > static char * >-compile_text(size_t *ptlen) >+compile_text(int *ptlen) > { > int asize, esc_nl, size; > char *text, *s; >@@ -753,7 +753,10 @@ > err(1, "realloc"); > } > } >- text[size] = '\0'; >+ /* Ensure, there is a new line at the end: */ >+ if (text[size - 1] != '\n') { >+ text[size++] = '\n'; >+ } > if ((text = realloc(text, size + 1)) == NULL) > err(1, "realloc"); > *ptlen = size; >@@ -819,7 +822,7 @@ > * Return a copy of all the characters up to \n or \0. > */ > static char * >-duptoeol(const char *s, const char *ctype, size_t *ptlen) >+duptoeol(const char *s, const char *ctype, int *ptlen) > { > size_t len; > int ws; >Index: defs.h >=================================================================== >--- defs.h (revision 303554) >+++ defs.h (working copy) >@@ -94,7 +94,7 @@ > struct s_addr *a1, *a2; /* Start and end address */ > u_long startline; /* Start line number or zero */ > char *t; /* Text for : a c i r w */ >- size_t tlen; >+ int tlen; > union { > struct s_command *c; /* Command(s) for b t { */ > struct s_subst *s; /* Substitute command */ >Index: process.c >=================================================================== >--- process.c (revision 303554) >+++ process.c (working copy) >@@ -126,7 +126,7 @@ > err(1, "realloc"); > appends[appendx].type = AP_STRING; > appends[appendx].s = cp->t; >- appends[appendx].len = strlen(cp->t); >+ appends[appendx].len = cp->tlen; > appendx++; > break; > case 'b': >@@ -136,7 +136,7 @@ > pd = 1; > psl = 0; > if (cp->a2 == NULL || lastaddr || lastline()) >- (void)fprintf(outfile, "%s", cp->t); >+ (void)fprintf(outfile, "%*s", cp->tlen, cp->t); > break; > case 'd': > pd = 1; >@@ -168,7 +168,7 @@ > cspace(&HS, ps, psl, APPEND); > break; > case 'i': >- (void)fprintf(outfile, "%s", cp->t); >+ (void)fprintf(outfile, "%*s", cp->tlen, cp->t); > break; > case 'l': > lputs(ps, psl);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 211399
:
173122
| 173125