diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-12-06 21:03:14 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-12-06 21:03:14 +0000 |
commit | ff9bafeb0d201ee9eff719dedd6a13b355b27931 (patch) | |
tree | 3a91fdf291b4ec44c6472eaa2edc48adfda4ed92 | |
parent | 06cd0b351bf2244fbb9c05110c01487916237fcc (diff) |
tighten vertical spacing for else; jfb ok
-rw-r--r-- | usr.bin/cvs/add.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/buf.c | 12 | ||||
-rw-r--r-- | usr.bin/cvs/commit.c | 5 | ||||
-rw-r--r-- | usr.bin/cvs/cvs.c | 5 | ||||
-rw-r--r-- | usr.bin/cvs/cvsd.c | 24 | ||||
-rw-r--r-- | usr.bin/cvs/diff.c | 23 | ||||
-rw-r--r-- | usr.bin/cvs/entries.c | 5 | ||||
-rw-r--r-- | usr.bin/cvs/file.c | 23 | ||||
-rw-r--r-- | usr.bin/cvs/getlog.c | 14 | ||||
-rw-r--r-- | usr.bin/cvs/hist.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/history.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/init.c | 5 | ||||
-rw-r--r-- | usr.bin/cvs/log.c | 5 | ||||
-rw-r--r-- | usr.bin/cvs/logmsg.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/msg.c | 14 | ||||
-rw-r--r-- | usr.bin/cvs/proto.c | 14 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.c | 62 | ||||
-rw-r--r-- | usr.bin/cvs/req.c | 5 | ||||
-rw-r--r-- | usr.bin/cvs/resp.c | 26 | ||||
-rw-r--r-- | usr.bin/cvs/root.c | 14 | ||||
-rw-r--r-- | usr.bin/cvs/status.c | 14 | ||||
-rw-r--r-- | usr.bin/cvs/update.c | 14 | ||||
-rw-r--r-- | usr.bin/cvs/util.c | 20 |
23 files changed, 120 insertions, 216 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c index d847076eb93..ea69323dc79 100644 --- a/usr.bin/cvs/add.c +++ b/usr.bin/cvs/add.c @@ -1,4 +1,4 @@ -/* $OpenBSD: add.c,v 1.6 2004/12/06 02:19:54 jfb Exp $ */ +/* $OpenBSD: add.c,v 1.7 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -105,8 +105,7 @@ cvs_add_file(CVSFILE *cf, void *arg) if (cf->cf_type == DT_DIR) { if (cf->cf_cvstat == CVS_FST_UNKNOWN) { - } - else { + } else { root = cf->cf_ddat->cd_root; if ((cf->cf_parent == NULL) || (root != cf->cf_parent->cf_ddat->cd_root)) { @@ -123,8 +122,7 @@ cvs_add_file(CVSFILE *cf, void *arg) if (root->cr_method != CVS_METHOD_LOCAL) { cvs_sendreq(root, CVS_REQ_ISMODIFIED, CVS_FILE_NAME(cf)); - } - else { + } else { cvs_log(LP_INFO, "scheduling file `%s' for addition", cf->cf_name); cvs_log(LP_INFO, "use `%s commit' to add this file permanently", diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c index 016ef2977b5..7efbec219a4 100644 --- a/usr.bin/cvs/buf.c +++ b/usr.bin/cvs/buf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.c,v 1.4 2004/11/28 15:12:17 pat Exp $ */ +/* $OpenBSD: buf.c,v 1.5 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -143,8 +143,7 @@ cvs_buf_load(const char *path, u_int flags) (void)close(fd); cvs_buf_free(bp); return (NULL); - } - else if (ret == 0) + } else if (ret == 0) break; buf->cb_len += (size_t)ret; @@ -244,9 +243,7 @@ cvs_buf_set(BUF *b, const void *src, size_t len, size_t off) return (-1); else rlen = b->cb_size - off; - - } - else + } else rlen = len; memcpy((b->cb_buf + off), src, rlen); @@ -316,8 +313,7 @@ cvs_buf_append(BUF *b, const void *data, size_t len) if (cvs_buf_grow(b, len - left) < 0) return (-1); bp = b->cb_cur + b->cb_len; - } - else + } else rlen = bep - bp; } diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c index dd0a4bb8dd0..64510de8243 100644 --- a/usr.bin/cvs/commit.c +++ b/usr.bin/cvs/commit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: commit.c,v 1.7 2004/12/02 19:23:44 jfb Exp $ */ +/* $OpenBSD: commit.c,v 1.8 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -103,8 +103,7 @@ cvs_commit(int argc, char **argv) if (argc == 0) { cvs_files = cvs_file_get(".", flags); - } - else { + } else { cvs_files = cvs_file_getspec(argv, argc, flags); } if (cvs_files == NULL) diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c index 86dc138a844..318cd7d823c 100644 --- a/usr.bin/cvs/cvs.c +++ b/usr.bin/cvs/cvs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.c,v 1.14 2004/11/09 23:06:01 krapht Exp $ */ +/* $OpenBSD: cvs.c,v 1.15 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -517,8 +517,7 @@ cvs_readrc(void) *(lp++) = '\0'; if (strcmp(linebuf, "cvs") == 0) { /* global options */ - } - else { + } else { cmdp = cvs_findcmd(linebuf); if (cmdp == NULL) { cvs_log(LP_NOTICE, diff --git a/usr.bin/cvs/cvsd.c b/usr.bin/cvs/cvsd.c index 7a8ebd69734..b80b9180bc7 100644 --- a/usr.bin/cvs/cvsd.c +++ b/usr.bin/cvs/cvsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cvsd.c,v 1.12 2004/11/28 15:12:17 pat Exp $ */ +/* $OpenBSD: cvsd.c,v 1.13 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -511,13 +511,11 @@ cvsd_child_reap(void) cvs_log(LP_WARN, "child %d exited with status %d", pid, WEXITSTATUS(status)); - } - else if (WIFSIGNALED(status)) { + } else if (WIFSIGNALED(status)) { cvs_log(LP_WARN, "child %d terminated with signal %d", pid, WTERMSIG(status)); - } - else { + } else { cvs_log(LP_ERR, "HOLY SHIT!"); } @@ -634,10 +632,10 @@ cvsd_parent_loop(void) if (pfd[0].revents & (POLLERR|POLLNVAL)) { cvs_log(LP_ERR, "poll error on request socket"); - } - else if (pfd[0].revents & POLLIN) { + } else if (pfd[0].revents & POLLIN) { uid_t uid; gid_t gid; + cfd = cvsd_sock_accept(pfd[0].fd); if (cfd == -1) chp = cvsd_child_get(); @@ -663,8 +661,7 @@ cvsd_parent_loop(void) cvs_log(LP_ERR, "poll error on child socket (PID %d)", chp->ch_pid); - } - else if (pfd[i].revents & POLLIN) + } else if (pfd[i].revents & POLLIN) cvsd_msghdlr(chp, pfd[i].fd); chp = TAILQ_NEXT(chp, ch_list); @@ -718,8 +715,7 @@ cvsd_child_main(void) continue; cvs_log(LP_ERRNO, "poll error"); break; - } - else if (ret == 0) + } else if (ret == 0) continue; if (pfd[0].revents & (POLLERR|POLLNVAL)) { @@ -731,8 +727,7 @@ cvsd_child_main(void) ret = cvsd_recvmsg(pfd[0].fd, &mtype, mbuf, &mlen); if (ret == -1) { continue; - } - else if (ret == 0) + } else if (ret == 0) break; switch (mtype) { @@ -776,8 +771,7 @@ cvsd_msghdlr(struct cvsd_child *child, int fd) if (ret == -1) { cvs_log(LP_ERRNO, "failed to read CVS message"); return (-1); - } - else if (ret == 0) { + } else if (ret == 0) { cvs_log(LP_WARN, "child closed socket pair"); return (0); } diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c index 0308b01b1cd..5c4782ab0b9 100644 --- a/usr.bin/cvs/diff.c +++ b/usr.bin/cvs/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.9 2004/12/06 02:46:47 jfb Exp $ */ +/* $OpenBSD: diff.c,v 1.10 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -418,8 +418,7 @@ cvs_diff(int argc, char **argv) if (argc == 0) { cvs_files = cvs_file_get(".", flags); - } - else + } else cvs_files = cvs_file_getspec(argv, argc, 0); if (cvs_files == NULL) return (EX_DATAERR); @@ -453,16 +452,14 @@ cvs_diff_sendflags(struct cvsroot *root, struct diff_arg *dap) if (dap->rev1 != NULL) { cvs_sendarg(root, "-r", 0); cvs_sendarg(root, dap->rev1, 1); - } - else if (dap->date1 != NULL) { + } else if (dap->date1 != NULL) { cvs_sendarg(root, "-D", 0); cvs_sendarg(root, dap->date1, 1); } if (dap->rev2 != NULL) { cvs_sendarg(root, "-r", 0); cvs_sendarg(root, dap->rev2, 1); - } - else if (dap->date2 != NULL) { + } else if (dap->date2 != NULL) { cvs_sendarg(root, "-D", 0); cvs_sendarg(root, dap->date2, 1); } @@ -496,8 +493,7 @@ cvs_diff_file(struct cvs_file *cfp, void *arg) root = cfp->cf_parent->cf_ddat->cd_root; cvs_sendreq(root, CVS_REQ_QUESTIONABLE, CVS_FILE_NAME(cfp)); - } - else { + } else { root = cfp->cf_ddat->cd_root; if ((cfp->cf_parent == NULL) || (root != cfp->cf_parent->cf_ddat->cd_root)) { @@ -518,8 +514,7 @@ cvs_diff_file(struct cvs_file *cfp, void *arg) dir = cvs_file_getpath(cfp->cf_parent, dfpath, sizeof(dfpath)); root = cfp->cf_parent->cf_ddat->cd_root; repo = cfp->cf_parent->cf_ddat->cd_repo; - } - else { + } else { dir = "."; root = NULL; repo = NULL; @@ -557,8 +552,7 @@ cvs_diff_file(struct cvs_file *cfp, void *arg) if (root->cr_method != CVS_METHOD_LOCAL) { cvs_sendreq(root, CVS_REQ_MODIFIED, CVS_FILE_NAME(cfp)); cvs_sendfile(root, diff_file); - } - else { + } else { snprintf(rcspath, sizeof(rcspath), "%s/%s/%s%s", root->cr_dir, repo, diff_file, RCS_FILE_EXT); @@ -587,8 +581,7 @@ cvs_diff_file(struct cvs_file *cfp, void *arg) r2 = rcsnum_alloc(); rcsnum_aton(dap->rev2, NULL, r2); b2 = rcs_getrev(rf, r2); - } - else { + } else { b2 = cvs_buf_load(diff_file, BUF_AUTOEXT); } diff --git a/usr.bin/cvs/entries.c b/usr.bin/cvs/entries.c index 4d4470e1939..d9eb0c6b705 100644 --- a/usr.bin/cvs/entries.c +++ b/usr.bin/cvs/entries.c @@ -1,4 +1,4 @@ -/* $OpenBSD: entries.c,v 1.18 2004/11/09 20:49:17 krapht Exp $ */ +/* $OpenBSD: entries.c,v 1.19 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -456,8 +456,7 @@ cvs_ent_write(CVSENTRIES *ef) putc('D', ef->cef_file); timebuf[0] = '\0'; revbuf[0] = '\0'; - } - else { + } else { rcsnum_tostr(ent->ce_rev, revbuf, sizeof(revbuf)); if (ent->ce_mtime == CVS_DATE_DMSEC) strlcpy(timebuf, CVS_DATE_DUMMY, diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index e5df497ae97..97efd5587f8 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.37 2004/12/06 07:28:15 jfb Exp $ */ +/* $OpenBSD: file.c,v 1.38 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -154,8 +154,7 @@ cvs_file_init(void) if (errno != ENOENT) cvs_log(LP_ERRNO, "failed to open user's cvsignore", path); - } - else { + } else { while (fgets(buf, sizeof(buf), ifp) != NULL) { len = strlen(buf); if (len == 0) @@ -232,8 +231,7 @@ cvs_file_chkign(const char *file) if (ip->ip_flags & CVS_IGN_STATIC) { if (cvs_file_cmpname(file, ip->ip_pat) == 0) return (1); - } - else if (fnmatch(ip->ip_pat, file, flags) == 0) + } else if (fnmatch(ip->ip_pat, file, flags) == 0) return (1); } @@ -279,8 +277,7 @@ cvs_file_create(CVSFILE *parent, const char *path, u_int type, mode_t mode) } cfp->cf_ddat->cd_ent = cvs_ent_open(path, O_RDWR); - } - else { + } else { fd = open(path, O_WRONLY|O_CREAT|O_EXCL, mode); if (fd == -1) { cvs_file_free(cfp); @@ -440,8 +437,7 @@ cvs_file_find(CVSFILE *hier, const char *path) } cf = cf->cf_parent; continue; - } - else if (*(pp + 1) == '\0') + } else if (*(pp + 1) == '\0') continue; } @@ -622,8 +618,7 @@ cvs_file_getdir(CVSFILE *cf, int flags) if (cfp->cf_type == DT_DIR) { TAILQ_INSERT_TAIL(&dirs, cfp, cf_list); ndirs++; - } - else { + } else { TAILQ_INSERT_TAIL(&(cdp->cd_files), cfp, cf_list); cdp->cd_nfiles++; @@ -691,8 +686,7 @@ cvs_file_examine(CVSFILE *cf, int (*exam)(CVSFILE *, void *), void *arg) if (ret == -1) break; } - } - else + } else ret = (*exam)(cf, arg); return (ret); @@ -889,8 +883,7 @@ cvs_file_lget(const char *path, int flags, CVSFILE *parent) if (ent == NULL) { cfp->cf_cvstat = (cwd == 1) ? CVS_FST_UPTODATE : CVS_FST_UNKNOWN; - } - else { + } else { /* always show directories as up-to-date */ if (ent->ce_type == CVS_ENT_DIR) cfp->cf_cvstat = CVS_FST_UPTODATE; diff --git a/usr.bin/cvs/getlog.c b/usr.bin/cvs/getlog.c index 02f3261ef94..cb267f44f0b 100644 --- a/usr.bin/cvs/getlog.c +++ b/usr.bin/cvs/getlog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getlog.c,v 1.8 2004/12/06 03:13:52 jfb Exp $ */ +/* $OpenBSD: getlog.c,v 1.9 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -96,8 +96,7 @@ cvs_getlog(int argc, char **argv) if (argc == 0) { cvs_files = cvs_file_get(".", flags); - } - else { + } else { cvs_files = cvs_file_getspec(argv, argc, flags); } if (cvs_files == NULL) @@ -140,8 +139,7 @@ cvs_getlog_file(CVSFILE *cf, void *arg) root = cf->cf_parent->cf_ddat->cd_root; cvs_sendreq(root, CVS_REQ_QUESTIONABLE, CVS_FILE_NAME(cf)); - } - else { + } else { root = cf->cf_ddat->cd_root; if ((cf->cf_parent == NULL) || (root != cf->cf_parent->cf_ddat->cd_root)) { @@ -152,15 +150,13 @@ cvs_getlog_file(CVSFILE *cf, void *arg) } return (0); - } - else + } else root = cf->cf_parent->cf_ddat->cd_root; rf = NULL; if (cf->cf_parent != NULL) { repo = cf->cf_parent->cf_ddat->cd_repo; - } - else { + } else { repo = NULL; } diff --git a/usr.bin/cvs/hist.c b/usr.bin/cvs/hist.c index 71598f4cd9a..c3ee3283869 100644 --- a/usr.bin/cvs/hist.c +++ b/usr.bin/cvs/hist.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hist.c,v 1.1 2004/07/13 22:02:40 jfb Exp $ */ +/* $OpenBSD: hist.c,v 1.2 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -187,8 +187,7 @@ cvs_hist_fillbuf(CVSHIST *histp) if (ret == -1) { cvs_log(LP_ERRNO, "failed to buffer CVS history file"); return (-1); - } - else { + } else { histp->chf_bused = (size_t)ret; } @@ -222,8 +221,7 @@ cvs_hist_parse(CVSHIST *histp) */ histp->chf_off += (off_t)(sp - histp->chf_buf); break; - } - else if (ep == bep) { + } else if (ep == bep) { histp->chf_off += (off_t)histp->chf_bused; } *(ep++) = '\0'; diff --git a/usr.bin/cvs/history.c b/usr.bin/cvs/history.c index 7fbb808b8f2..294926da387 100644 --- a/usr.bin/cvs/history.c +++ b/usr.bin/cvs/history.c @@ -1,4 +1,4 @@ -/* $OpenBSD: history.c,v 1.3 2004/07/30 01:49:23 jfb Exp $ */ +/* $OpenBSD: history.c,v 1.4 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -143,8 +143,7 @@ cvs_history(int argc, char **argv) cvs_log(LP_ERR, "Only one report type allowed from: \"-Tcomxe\""); return (EX_USAGE); - } - else if (rep == 0) + } else if (rep == 0) flags |= CVS_HF_O; /* use -o as default */ root = cvsroot_get("."); @@ -160,8 +159,7 @@ cvs_history(int argc, char **argv) cvs_history_print(hent); } cvs_hist_close(hp); - } - else { + } else { if (flags & CVS_HF_C) cvs_sendarg(root, "-c", 0); diff --git a/usr.bin/cvs/init.c b/usr.bin/cvs/init.c index c104b2f0cdd..108f33b2a6d 100644 --- a/usr.bin/cvs/init.c +++ b/usr.bin/cvs/init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init.c,v 1.6 2004/08/12 20:09:58 jfb Exp $ */ +/* $OpenBSD: init.c,v 1.7 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -110,8 +110,7 @@ cvs_init(int argc, char **argv) path); return (EX_CANTCREAT); } - } - else if (cvsroot_files[i].cf_type == CFT_FILE) { + } else if (cvsroot_files[i].cf_type == CFT_FILE) { fd = open(path, O_WRONLY|O_CREAT|O_EXCL, cvsroot_files[i].cf_mode); if (fd == -1) { diff --git a/usr.bin/cvs/log.c b/usr.bin/cvs/log.c index a5d19d7bcba..720ca205d13 100644 --- a/usr.bin/cvs/log.c +++ b/usr.bin/cvs/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.5 2004/11/28 15:12:17 pat Exp $ */ +/* $OpenBSD: log.c,v 1.6 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -235,8 +235,7 @@ cvs_vlog(u_int level, const char *fmt, va_list vap) else snprintf(prefix, sizeof(prefix), "%s %s", __progname, cvs_command); - } - else /* just use the standard strlcpy */ + } else /* just use the standard strlcpy */ #endif strlcpy(prefix, __progname, sizeof(prefix)); diff --git a/usr.bin/cvs/logmsg.c b/usr.bin/cvs/logmsg.c index b3a11b41fdc..1b727abd9d8 100644 --- a/usr.bin/cvs/logmsg.c +++ b/usr.bin/cvs/logmsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: logmsg.c,v 1.5 2004/12/03 19:01:02 jfb Exp $ */ +/* $OpenBSD: logmsg.c,v 1.6 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -92,8 +92,7 @@ cvs_logmsg_open(const char *path) ((lbuf[0] != 'y') && (lbuf[0] != 'n'))) { fprintf(stderr, "invalid input\n"); continue; - } - else if (lbuf[0] == 'y') + } else if (lbuf[0] == 'y') break; else if (lbuf[0] == 'n') { cvs_log(LP_ERR, "aborted by user"); @@ -253,8 +252,7 @@ cvs_logmsg_get(const char *dir, struct cvs_flist *files) if ((len == 0) || (len > 2)) { fprintf(stderr, "invalid input\n"); continue; - } - else if (buf[0] == 'a') { + } else if (buf[0] == 'a') { cvs_log(LP_ERR, "aborted by user"); break; } else if ((buf[0] == '\n') || (buf[0] == 'c')) { diff --git a/usr.bin/cvs/msg.c b/usr.bin/cvs/msg.c index 620f1fbefb1..2134b394032 100644 --- a/usr.bin/cvs/msg.c +++ b/usr.bin/cvs/msg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msg.c,v 1.4 2004/09/27 17:11:07 jfb Exp $ */ +/* $OpenBSD: msg.c,v 1.5 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2002 Matthieu Herrb * Copyright (c) 2001 Niels Provos <provos@citi.umich.edu> @@ -154,8 +154,7 @@ cvsd_sendmsg(int fd, u_int type, const void *data, size_t len) iov[1].iov_base = (void *)data; iov[1].iov_len = len; cnt = 2; - } - else + } else msg.cm_len = sizeof(int); /* dummy */ if (writev(fd, iov, cnt) == -1) { @@ -193,8 +192,7 @@ cvsd_recvmsg(int fd, u_int *type, void *dst, size_t *len) if ((ret = read(fd, &msg, sizeof(msg))) == -1) { cvs_log(LP_ERRNO, "failed to read message header"); return (-1); - } - else if (ret == 0) + } else if (ret == 0) return (0); if (*len < msg.cm_len) { @@ -209,14 +207,12 @@ cvsd_recvmsg(int fd, u_int *type, void *dst, size_t *len) *(int *)dst = sfd; *len = sizeof(sfd); - } - else { + } else { ret = read(fd, dst, msg.cm_len); if (ret == -1) { cvs_log(LP_ERRNO, "failed to read message"); return (-1); - } - else if (ret == 0) { + } else if (ret == 0) { } *len = (size_t)ret; diff --git a/usr.bin/cvs/proto.c b/usr.bin/cvs/proto.c index 12dee9f229e..0b844bec45d 100644 --- a/usr.bin/cvs/proto.c +++ b/usr.bin/cvs/proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proto.c,v 1.29 2004/12/02 19:23:44 jfb Exp $ */ +/* $OpenBSD: proto.c,v 1.30 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -227,8 +227,7 @@ cvs_connect(struct cvsroot *root) if (cvs_subproc_pid == -1) { cvs_log(LP_ERRNO, "failed to fork for cvs server connection"); return (-1); - } - else if (cvs_subproc_pid == 0) { + } else if (cvs_subproc_pid == 0) { if ((dup2(infd[0], STDIN_FILENO) == -1) || (dup2(outfd[1], STDOUT_FILENO) == -1)) { cvs_log(LP_ERRNO, @@ -735,8 +734,7 @@ cvs_getresp(struct cvsroot *root) if ((len = strlen(cvs_proto_buf)) != 0) { if (cvs_proto_buf[len - 1] != '\n') { /* truncated line */ - } - else + } else cvs_proto_buf[--len] = '\0'; } @@ -812,8 +810,7 @@ cvs_sendresp(u_int rid, const char *arg) ret = fputs(resp->resp_str, stdout); if (ret == EOF) { cvs_log(LP_ERRNO, "failed to send response to client"); - } - else { + } else { if (arg != NULL) { putc(' ', stdout); fputs(arg, stdout); @@ -852,8 +849,7 @@ cvs_getreq(void) if ((len = strlen(cvs_proto_buf)) != 0) { if (cvs_proto_buf[len - 1] != '\n') { /* truncated line */ - } - else + } else cvs_proto_buf[--len] = '\0'; } diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index 0ff844890c5..6a486467188 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.13 2004/09/27 15:33:44 jfb Exp $ */ +/* $OpenBSD: rcs.c,v 1.14 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -506,8 +506,7 @@ rcs_patch_lines(struct rcs_foo *dlines, struct rcs_foo *plines) break; if (dlp->rl_lineno > lineno) { dlp = TAILQ_PREV(dlp, rcs_tqh, rl_list); - } - else if (dlp->rl_lineno < lineno) { + } else if (dlp->rl_lineno < lineno) { ndlp = TAILQ_NEXT(dlp, rl_list); if (ndlp->rl_lineno > lineno) break; @@ -526,8 +525,7 @@ rcs_patch_lines(struct rcs_foo *dlines, struct rcs_foo *plines) TAILQ_REMOVE(&(dlines->rl_lines), dlp, rl_list); dlp = ndlp; } - } - else if (op == 'a') { + } else if (op == 'a') { for (i = 0; i < nbln; i++) { ndlp = lp; lp = TAILQ_NEXT(lp, rl_list); @@ -545,8 +543,7 @@ rcs_patch_lines(struct rcs_foo *dlines, struct rcs_foo *plines) lp = ndlp; } - } - else { + } else { cvs_log(LP_ERR, "unknown RCS patch operation `%c'", op); return (-1); } @@ -588,8 +585,7 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *rev) if (res == 1) { cvs_log(LP_ERR, "sorry, can't travel in the future yet"); return (NULL); - } - else { + } else { rdp = rcs_findrev(rfp, rfp->rf_head); if (rdp == NULL) { cvs_log(LP_ERR, "failed to get RCS HEAD revision"); @@ -809,8 +805,7 @@ rcs_parse_admin(RCSFILE *rfp) if (tok == RCS_TOK_ERR) { cvs_log(LP_ERR, "parse error in RCS admin section"); return (-1); - } - else if (tok == RCS_TOK_NUM) { + } else if (tok == RCS_TOK_NUM) { /* assume this is the start of the first delta */ rcs_pushtok(rfp, RCS_TOKSTR(rfp), tok); return (0); @@ -844,20 +839,17 @@ rcs_parse_admin(RCSFILE *rfp) if (tok == RCS_TOK_HEAD) { rcsnum_aton(RCS_TOKSTR(rfp), NULL, rfp->rf_head); - } - else if (tok == RCS_TOK_BRANCH) { + } else if (tok == RCS_TOK_BRANCH) { rcsnum_aton(RCS_TOKSTR(rfp), NULL, rfp->rf_branch); - } - else if (tok == RCS_TOK_COMMENT) { + } else if (tok == RCS_TOK_COMMENT) { rfp->rf_comment = strdup(RCS_TOKSTR(rfp)); if (rfp->rf_comment == NULL) { cvs_log(LP_ERRNO, "failed to duplicate rcs token"); return (-1); } - } - else if (tok == RCS_TOK_EXPAND) { + } else if (tok == RCS_TOK_EXPAND) { rfp->rf_expand = strdup(RCS_TOKSTR(rfp)); if (rfp->rf_expand == NULL) { cvs_log(LP_ERRNO, @@ -954,8 +946,7 @@ rcs_parse_delta(RCSFILE *rfp) cvs_log(LP_ERR, "parse error in RCS delta section"); rcs_freedelta(rdp); return (-1); - } - else if (tok == RCS_TOK_NUM || tok == RCS_TOK_DESC) { + } else if (tok == RCS_TOK_NUM || tok == RCS_TOK_DESC) { rcs_pushtok(rfp, RCS_TOKSTR(rfp), tok); ret = (tok == RCS_TOK_NUM ? 1 : 0); break; @@ -1041,16 +1032,13 @@ rcs_parse_delta(RCSFILE *rfp) rdp->rd_date.tm_min = datenum->rn_id[4]; rdp->rd_date.tm_sec = datenum->rn_id[5]; rcsnum_free(datenum); - } - else if (tok == RCS_TOK_AUTHOR) { + } else if (tok == RCS_TOK_AUTHOR) { rdp->rd_author = tokstr; tokstr = NULL; - } - else if (tok == RCS_TOK_STATE) { + } else if (tok == RCS_TOK_STATE) { rdp->rd_state = tokstr; tokstr = NULL; - } - else if (tok == RCS_TOK_NEXT) { + } else if (tok == RCS_TOK_NEXT) { rcsnum_aton(tokstr, NULL, rdp->rd_next); } break; @@ -1330,8 +1318,7 @@ rcs_parse_locks(RCSFILE *rfp) type = rcs_gettok(rfp); if (type != RCS_TOK_STRICT) { rcs_pushtok(rfp, RCS_TOKSTR(rfp), type); - } - else { + } else { rfp->rf_flags |= RCS_RF_SLOCK; type = rcs_gettok(rfp); @@ -1484,14 +1471,11 @@ rcs_gettok(RCSFILE *rfp) if (ch == EOF) { type = RCS_TOK_EOF; - } - else if (ch == ';') { + } else if (ch == ';') { type = RCS_TOK_SCOLON; - } - else if (ch == ':') { + } else if (ch == ':') { type = RCS_TOK_COLON; - } - else if (isalpha(ch)) { + } else if (isalpha(ch)) { *(bp++) = ch; while (bp <= bep - 1) { ch = getc(pdp->rp_file); @@ -1514,8 +1498,7 @@ rcs_gettok(RCSFILE *rfp) if (type == RCS_TOK_ERR) type = RCS_TOK_STRING; - } - else if (ch == '@') { + } else if (ch == '@') { /* we have a string */ for (;;) { ch = getc(pdp->rp_file); @@ -1525,8 +1508,7 @@ rcs_gettok(RCSFILE *rfp) ungetc(ch, pdp->rp_file); break; } - } - else if (ch == '\n') + } else if (ch == '\n') pdp->rp_line++; *(bp++) = ch; @@ -1536,8 +1518,7 @@ rcs_gettok(RCSFILE *rfp) *bp = '\0'; type = RCS_TOK_STRING; - } - else if (isdigit(ch)) { + } else if (isdigit(ch)) { *(bp++) = ch; last = ch; type = RCS_TOK_NUM; @@ -1614,8 +1595,7 @@ rcs_stresc(int esc, const char *str, char *buf, size_t *blen) if (bp > (bep - 2)) break; *(bp++) = '@'; - } - else { + } else { sp++; if (*sp != '@') { cvs_log(LP_WARN, diff --git a/usr.bin/cvs/req.c b/usr.bin/cvs/req.c index 624fbde9554..294ef8adc88 100644 --- a/usr.bin/cvs/req.c +++ b/usr.bin/cvs/req.c @@ -1,4 +1,4 @@ -/* $OpenBSD: req.c,v 1.5 2004/08/06 14:49:03 jfb Exp $ */ +/* $OpenBSD: req.c,v 1.6 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -271,8 +271,7 @@ cvs_req_argument(int reqid, char *line) return (-1); } cvs_req_nargs++; - } - else if (reqid == CVS_REQ_ARGUMENTX) { + } else if (reqid == CVS_REQ_ARGUMENTX) { if (cvs_req_nargs == 0) cvs_log(LP_WARN, "no argument to append to"); else { diff --git a/usr.bin/cvs/resp.c b/usr.bin/cvs/resp.c index 477a5a6e003..4948e9da502 100644 --- a/usr.bin/cvs/resp.c +++ b/usr.bin/cvs/resp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resp.c,v 1.10 2004/12/06 04:10:06 jfb Exp $ */ +/* $OpenBSD: resp.c,v 1.11 2004/12/06 21:03:12 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -159,8 +159,7 @@ cvs_resp_handle(struct cvsroot *root, char *line) resp = cvs_resp_getbyname(cmd); if (resp == NULL) { return (-1); - } - else if (cvs_resp_swtab[resp->resp_id].hdlr == NULL) { + } else if (cvs_resp_swtab[resp->resp_id].hdlr == NULL) { cvs_log(LP_ERRNO, "handler for `%s' not implemented", cmd); return (-1); } @@ -247,20 +246,17 @@ cvs_resp_m(struct cvsroot *root, int type, char *line) if (cvs_mt_stack[cvs_mtstk_depth] == NULL) return (-1); cvs_mtstk_depth++; - } - else if (*line == '-') { + } else if (*line == '-') { if (cvs_mtstk_depth == 0) { cvs_log(LP_ERR, "MT scope stack underflow"); return (-1); - } - else if (strcmp(line + 1, + } else if (strcmp(line + 1, cvs_mt_stack[cvs_mtstk_depth - 1]) != 0) { cvs_log(LP_ERR, "mismatch in MT scope stack"); return (-1); } free(cvs_mt_stack[cvs_mtstk_depth--]); - } - else { + } else { if (strcmp(line, "newline") == 0) putc('\n', stdout); else if (strncmp(line, "fname ", 6) == 0) @@ -338,8 +334,7 @@ cvs_resp_statdir(struct cvsroot *root, int type, char *line) cvs_log(LP_ERRNO, "failed to unlink %s file", CVS_PATH_STATICENTRIES); return (-1); - } - else if (type == CVS_RESP_SETSTATDIR) { + } else if (type == CVS_RESP_SETSTATDIR) { fd = open(statpath, O_CREAT|O_TRUNC|O_WRONLY, 0400); if (fd == -1) { cvs_log(LP_ERRNO, @@ -441,8 +436,7 @@ cvs_resp_newentry(struct cvsroot *root, int type, char *line) return (-1); if (type == CVS_RESP_NEWENTRY) { cvs_ent_addln(entfile, entbuf); - } - else if (type == CVS_RESP_CHECKEDIN) { + } else if (type == CVS_RESP_CHECKEDIN) { ent = cvs_ent_parse(entbuf); if (ent == NULL) { cvs_log(LP_ERR, "failed to parse entry"); @@ -553,10 +547,8 @@ cvs_resp_updated(struct cvsroot *root, int type, char *line) /* set the timestamp as the last one received from Mod-time */ ep->ce_mtime = cvs_modtime; cvs_ent_add(cf->cf_ddat->cd_ent, ep); - } - else if (type == CVS_RESP_UPDEXIST) { - } - else if (type == CVS_RESP_UPDATED) { + } else if (type == CVS_RESP_UPDEXIST) { + } else if (type == CVS_RESP_UPDATED) { } fbuf = cvs_recvfile(root, &fmode); diff --git a/usr.bin/cvs/root.c b/usr.bin/cvs/root.c index b8c68b45b67..de8d8e14b43 100644 --- a/usr.bin/cvs/root.c +++ b/usr.bin/cvs/root.c @@ -1,4 +1,4 @@ -/* $OpenBSD: root.c,v 1.11 2004/08/31 11:54:35 jfb Exp $ */ +/* $OpenBSD: root.c,v 1.12 2004/12/06 21:03:13 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -183,8 +183,7 @@ cvsroot_parse(const char *str) } root->cr_user = cp; - } - else + } else sp = cp; pp = strchr(sp, ':'); @@ -215,8 +214,7 @@ cvsroot_parse(const char *str) if (tmp == NULL) { /* just forget about the cache and return anyways */ root->cr_ref--; - } - else { + } else { cvs_rcache = (struct cvsroot **)tmp; cvs_rcache[cvs_rcsz++] = root; } @@ -278,8 +276,7 @@ cvsroot_get(const char *dir) return cvsroot_parse(rootstr); else return (NULL); - } - else { + } else { cvs_log(LP_ERRNO, "failed to open CVS/Root"); return (NULL); } @@ -295,8 +292,7 @@ cvsroot_get(const char *dir) len = strlen(line); if (len == 0) { cvs_log(LP_WARN, "empty CVS/Root file"); - } - else if (line[len - 1] == '\n') + } else if (line[len - 1] == '\n') line[--len] = '\0'; return cvsroot_parse(line); diff --git a/usr.bin/cvs/status.c b/usr.bin/cvs/status.c index d7ab962bcdf..7c1d2db3438 100644 --- a/usr.bin/cvs/status.c +++ b/usr.bin/cvs/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.2 2004/11/26 16:23:50 jfb Exp $ */ +/* $OpenBSD: status.c,v 1.3 2004/12/06 21:03:13 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -89,8 +89,7 @@ cvs_status(int argc, char **argv) } cvs_file_examine(cf, cvs_status_file, NULL); - } - else { + } else { for (i = 0; i < argc; i++) { cf = cvs_file_get(argv[i], flags); } @@ -126,15 +125,13 @@ cvs_status_file(CVSFILE *cfp, void *arg) cvs_senddir(root, cfp); return (0); - } - else + } else root = cfp->cf_parent->cf_ddat->cd_root; rf = NULL; if (cfp->cf_parent != NULL) { repo = cfp->cf_parent->cf_ddat->cd_repo; - } - else { + } else { repo = NULL; } @@ -170,8 +167,7 @@ cvs_status_file(CVSFILE *cfp, void *arg) if (root->cr_method != CVS_METHOD_LOCAL) { cvs_sendreq(root, CVS_REQ_MODIFIED, CVS_FILE_NAME(cfp)); cvs_sendfile(root, fpath); - } - else { + } else { snprintf(rcspath, sizeof(rcspath), "%s/%s/%s%s", root->cr_dir, repo, CVS_FILE_NAME(cfp), RCS_FILE_EXT); diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c index 398cb6bd0a4..6e6c6413e0b 100644 --- a/usr.bin/cvs/update.c +++ b/usr.bin/cvs/update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.9 2004/11/26 16:23:50 jfb Exp $ */ +/* $OpenBSD: update.c,v 1.10 2004/12/06 21:03:13 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -92,8 +92,7 @@ cvs_update(int argc, char **argv) if (argc == 0) { cvs_files = cvs_file_get(".", flags); - } - else { + } else { /* don't perform ignore on explicitly listed files */ flags &= ~(CF_IGNORE | CF_RECURSE | CF_SORT); cvs_files = cvs_file_getspec(argv, argc, flags); @@ -131,8 +130,7 @@ cvs_update_file(CVSFILE *cf, void *arg) root = cf->cf_parent->cf_ddat->cd_root; cvs_sendreq(root, CVS_REQ_QUESTIONABLE, CVS_FILE_NAME(cf)); - } - else { + } else { root = cf->cf_ddat->cd_root; if ((cf->cf_parent == NULL) || (root != cf->cf_parent->cf_ddat->cd_root)) { @@ -143,15 +141,13 @@ cvs_update_file(CVSFILE *cf, void *arg) } return (0); - } - else + } else root = cf->cf_parent->cf_ddat->cd_root; rf = NULL; if (cf->cf_parent != NULL) { repo = cf->cf_parent->cf_ddat->cd_repo; - } - else { + } else { repo = NULL; } diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c index 3461796b5fa..949d882ec45 100644 --- a/usr.bin/cvs/util.c +++ b/usr.bin/cvs/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.14 2004/12/03 20:24:37 weingart Exp $ */ +/* $OpenBSD: util.c,v 1.15 2004/12/06 21:03:13 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -160,8 +160,7 @@ cvs_datesec(const char *date, int type, int adj) cvs_log(LP_ERR, "parse error in GMT hours specification `%s'", hr); cvs_tm.tm_gmtoff = 0; - } - else { + } else { /* get seconds */ cvs_tm.tm_gmtoff *= 3600; @@ -173,15 +172,13 @@ cvs_datesec(const char *date, int type, int adj) cvs_log(LP_ERR, "parse error in GMT minutes " "specification `%s'", min); - } - else + } else cvs_tm.tm_gmtoff += off * 60; } } if (sign == '-') cvs_tm.tm_gmtoff = -cvs_tm.tm_gmtoff; - } - else if (type == CVS_DATE_CTIME) { + } else if (type == CVS_DATE_CTIME) { /* gmt is used for the weekday */ sscanf(date, "%3s %3s %d %2d:%2d:%2d %d", gmt, mon, &cvs_tm.tm_mday, &cvs_tm.tm_hour, &cvs_tm.tm_min, @@ -252,8 +249,7 @@ cvs_strtomode(const char *str, mode_t *mode) (cvs_modes[(int)type][*sp - 'a'] == 0)) { cvs_log(LP_WARN, "invalid permission bit `%c'", *sp); - } - else + } else m |= cvs_modes[(int)type][*sp - 'a']; } } @@ -401,8 +397,7 @@ cvs_getargv(const char *line, char **argv, int argvlen) cvs_log(LP_ERR, "no terminating quote"); err++; break; - } - else if (*lp == '\\') + } else if (*lp == '\\') lp++; qbuf[i++] = *lp++; @@ -413,8 +408,7 @@ cvs_getargv(const char *line, char **argv, int argvlen) } arg = qbuf; - } - else { + } else { cp = strsep(&lp, " \t"); if (cp == NULL) break; |