Whitespace cleanup

This commit is contained in:
Dag-Erling Smørgrav 2003-11-04 12:16:47 +00:00
parent e6478125c8
commit 9cde9a2e85
2 changed files with 21 additions and 21 deletions

View File

@ -171,14 +171,14 @@ compile_stream(struct s_command **link)
}
semicolon: EATSPACE();
if (p) {
if (*p == '#' || *p == '\0')
continue;
else if (*p == ';') {
p++;
goto semicolon;
}
}
if (p) {
if (*p == '#' || *p == '\0')
continue;
else if (*p == ';') {
p++;
goto semicolon;
}
}
if ((*link = cmd = malloc(sizeof(struct s_command))) == NULL)
err(1, "malloc");
link = &cmd->next;
@ -284,7 +284,7 @@ nonsel: /* Now parse the command */
cmd->t = duptoeol(p, "w command");
if (aflag)
cmd->u.fd = -1;
else if ((cmd->u.fd = open(p,
else if ((cmd->u.fd = open(p,
O_WRONLY|O_APPEND|O_CREAT|O_TRUNC,
DEFFILEMODE)) == -1)
err(1, "%s", p);
@ -317,7 +317,7 @@ nonsel: /* Now parse the command */
p++;
if (*p == '\0' || *p == '\\')
errx(1,
"%lu: %s: substitute pattern can not be delimited by newline or backslash",
"%lu: %s: substitute pattern can not be delimited by newline or backslash",
linenum, fname);
if ((cmd->u.s = malloc(sizeof(struct s_subst))) == NULL)
err(1, "malloc");

View File

@ -337,14 +337,14 @@ substitute(struct s_command *cp)
if (!regexec_e(re, s, 0, 0, psl))
return (0);
SS.len = 0; /* Clean substitute space. */
slen = psl;
n = cp->u.s->n;
SS.len = 0; /* Clean substitute space. */
slen = psl;
n = cp->u.s->n;
lastempty = 1;
switch (n) {
case 0: /* Global */
do {
switch (n) {
case 0: /* Global */
do {
if (lastempty || match[0].rm_so != match[0].rm_eo) {
/* Locate start of replaced string. */
re_off = match[0].rm_so;
@ -371,7 +371,7 @@ substitute(struct s_command *cp)
/* Copy trailing retained string. */
if (slen > 0)
cspace(&SS, s, slen, APPEND);
break;
break;
default: /* Nth occurrence */
while (--n) {
if (match[0].rm_eo == match[0].rm_so)
@ -567,12 +567,12 @@ regsub(SPACE *sp, char *string, char *src)
else
no = -1;
if (no < 0) { /* Ordinary character. */
if (c == '\\' && (*src == '\\' || *src == '&'))
c = *src++;
if (c == '\\' && (*src == '\\' || *src == '&'))
c = *src++;
NEEDSP(1);
*dst++ = c;
*dst++ = c;
++sp->len;
} else if (match[no].rm_so != -1 && match[no].rm_eo != -1) {
} else if (match[no].rm_so != -1 && match[no].rm_eo != -1) {
len = match[no].rm_eo - match[no].rm_so;
NEEDSP(len);
memmove(dst, string + match[no].rm_so, len);