diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-10-07 21:47:33 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-10-07 21:47:33 +0000 |
commit | 72e54d6f66713dc2905d7b70108ffcfeda54f2bd (patch) | |
tree | 351fe44837a3a000bdf71a80e7c69dc3895d3d4e /usr.bin/cvs | |
parent | b691345e2ba6d65b165f2c2ffcc8810591f70b73 (diff) |
knf and spacing, ok joris@
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/add.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/cmd.c | 14 | ||||
-rw-r--r-- | usr.bin/cvs/cvs.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/cvs.h | 34 | ||||
-rw-r--r-- | usr.bin/cvs/date.y | 26 | ||||
-rw-r--r-- | usr.bin/cvs/diff.c | 9 | ||||
-rw-r--r-- | usr.bin/cvs/file.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.c | 21 | ||||
-rw-r--r-- | usr.bin/cvs/release.c | 6 | ||||
-rw-r--r-- | usr.bin/cvs/remove.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/repo.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/req.c | 7 | ||||
-rw-r--r-- | usr.bin/cvs/resp.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/util.c | 4 |
14 files changed, 85 insertions, 72 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c index 7191c5aaaf9..7c96a2bb840 100644 --- a/usr.bin/cvs/add.c +++ b/usr.bin/cvs/add.c @@ -1,4 +1,4 @@ -/* $OpenBSD: add.c,v 1.33 2005/09/30 15:40:22 xsa Exp $ */ +/* $OpenBSD: add.c,v 1.34 2005/10/07 21:47:32 reyk Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org> @@ -193,7 +193,7 @@ cvs_add_local(CVSFILE *cf, void *arg) return (0); } else if ((cf->cf_cvstat == CVS_FST_CONFLICT) || - (cf->cf_cvstat == CVS_FST_LOST) || + (cf->cf_cvstat == CVS_FST_LOST) || (cf->cf_cvstat == CVS_FST_MODIFIED) || (cf->cf_cvstat == CVS_FST_UPTODATE)) { if (verbosity > 1) { @@ -316,7 +316,7 @@ cvs_add_directory(CVSFILE *cf) if ((ent = cvs_ent_parse(entry)) == NULL) { cvs_log(LP_ERR, "failed to parse entry"); return (CVS_EX_DATA); - } + } if (cvs_ent_add(entf, ent) < 0) { cvs_log(LP_ERR, "failed to add entry"); @@ -380,7 +380,7 @@ cvs_add_build_entry(CVSFILE *cf) cvs_log(LP_ERR, "failed to parse entry"); (void)cvs_unlink(path); return (CVS_EX_DATA); - } + } if (cvs_ent_add(entf, ent) < 0) { cvs_log(LP_ERR, "failed to add entry"); diff --git a/usr.bin/cvs/cmd.c b/usr.bin/cvs/cmd.c index b30b840aa98..fe73fc3b94d 100644 --- a/usr.bin/cvs/cmd.c +++ b/usr.bin/cvs/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.35 2005/09/13 17:24:38 joris Exp $ */ +/* $OpenBSD: cmd.c,v 1.36 2005/10/07 21:47:32 reyk Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -181,8 +181,10 @@ cvs_startcmd(struct cvs_cmd *cmd, int argc, char **argv) * checkout, export, import and release do not depend on these files. */ error = 0; - if ((cmd->cmd_op != CVS_OP_CHECKOUT) && (cmd->cmd_op != CVS_OP_EXPORT) && - (cmd->cmd_op != CVS_OP_IMPORT) && (cmd->cmd_op != CVS_OP_RELEASE) && + if ((cmd->cmd_op != CVS_OP_CHECKOUT) && + (cmd->cmd_op != CVS_OP_EXPORT) && + (cmd->cmd_op != CVS_OP_IMPORT) && + (cmd->cmd_op != CVS_OP_RELEASE) && (cmd->cmd_op != CVS_OP_VERSION)) { /* check for the CVS directory */ ret = stat(CVS_PATH_CVSDIR, &st); @@ -211,9 +213,11 @@ cvs_startcmd(struct cvs_cmd *cmd, int argc, char **argv) } if (error & MISSING_CVS_ENTRIES) - cvs_log(LP_ABORT, "missing '%s' file", CVS_PATH_ENTRIES); + cvs_log(LP_ABORT, "missing '%s' file", + CVS_PATH_ENTRIES); if (error & MISSING_CVS_REPO) - cvs_log(LP_ABORT, "missing '%s' file", CVS_PATH_REPOSITORY); + cvs_log(LP_ABORT, "missing '%s' file", + CVS_PATH_REPOSITORY); return (CVS_EX_FILE); } diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c index 656e8662d7e..351db3962e5 100644 --- a/usr.bin/cvs/cvs.c +++ b/usr.bin/cvs/cvs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.c,v 1.84 2005/08/10 14:49:20 xsa Exp $ */ +/* $OpenBSD: cvs.c,v 1.85 2005/10/07 21:47:32 reyk Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -137,7 +137,7 @@ main(int argc, char **argv) exit(CVS_EX_DATA); } cvs_homedir = pw->pw_dir; - } + } if ((envstr = getenv("TMPDIR")) != NULL) cvs_tmpdir = envstr; diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h index 76e5f761d59..74fe7e83baf 100644 --- a/usr.bin/cvs/cvs.h +++ b/usr.bin/cvs/cvs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.h,v 1.85 2005/09/15 22:12:23 joris Exp $ */ +/* $OpenBSD: cvs.h,v 1.86 2005/10/07 21:47:32 reyk Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -151,26 +151,26 @@ struct cvs_cmd { - int cmd_op; - int cmd_req; - char cmd_name[CVS_CMD_MAXNAMELEN]; - char cmd_alias[CVS_CMD_MAXALIAS][CVS_CMD_MAXNAMELEN]; - char cmd_descr[CVS_CMD_MAXDESCRLEN]; - char *cmd_synopsis; - char *cmd_opts; - char *cmd_defargs; - int file_flags; + int cmd_op; + int cmd_req; + char cmd_name[CVS_CMD_MAXNAMELEN]; + char cmd_alias[CVS_CMD_MAXALIAS][CVS_CMD_MAXNAMELEN]; + char cmd_descr[CVS_CMD_MAXDESCRLEN]; + char *cmd_synopsis; + char *cmd_opts; + char *cmd_defargs; + int file_flags; /* operations vector */ - int (*cmd_init) (struct cvs_cmd *, int, char **, int *); - int (*cmd_pre_exec) (struct cvsroot *); - int (*cmd_exec_remote) (CVSFILE *, void *); - int (*cmd_exec_local) (CVSFILE *, void *); - int (*cmd_post_exec) (struct cvsroot *); - int (*cmd_cleanup) (void); + int (*cmd_init)(struct cvs_cmd *, int, char **, int *); + int (*cmd_pre_exec)(struct cvsroot *); + int (*cmd_exec_remote)(CVSFILE *, void *); + int (*cmd_exec_local)(CVSFILE *, void *); + int (*cmd_post_exec)(struct cvsroot *); + int (*cmd_cleanup)(void); /* flags for cvs_file_get() */ - int cmd_flags; + int cmd_flags; }; struct cvs_file; diff --git a/usr.bin/cvs/date.y b/usr.bin/cvs/date.y index 4635f2920c3..b49c582ad1f 100644 --- a/usr.bin/cvs/date.y +++ b/usr.bin/cvs/date.y @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: date.y,v 1.9 2005/09/25 19:11:34 otto Exp $ */ +/* $OpenBSD: date.y,v 1.10 2005/10/07 21:47:32 reyk Exp $ */ /* ** Originally written by Steven M. Bellovin <smb@research.att.com> while @@ -537,7 +537,7 @@ ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian) Hours = 0; return ((Hours + 12) * 60L + Minutes) * 60L + Seconds; default: - abort (); + abort(); } /* NOTREACHED */ } @@ -802,15 +802,14 @@ difftm(struct tm *a, struct tm *b) int ay = a->tm_year + (YEAR_TMORIGIN - 1); int by = b->tm_year + (YEAR_TMORIGIN - 1); int days = ( - /* difference in day of year */ - a->tm_yday - b->tm_yday - /* + intervening leap days */ - + ((ay >> 2) - (by >> 2)) - - (ay/100 - by/100) - + ((ay/100 >> 2) - (by/100 >> 2)) - /* + difference in years * 365 */ - + (long)(ay-by) * 365 - ); + /* difference in day of year */ + a->tm_yday - b->tm_yday + /* + intervening leap days */ + + ((ay >> 2) - (by >> 2)) + - (ay/100 - by/100) + + ((ay/100 >> 2) - (by/100 >> 2)) + /* + difference in years * 365 */ + + (long)(ay-by) * 365); return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour)) + (a->tm_min - b->tm_min)) + (a->tm_sec - b->tm_sec)); } @@ -852,7 +851,7 @@ cvs_date_parse(const char *p) if (gmt_ptr != NULL) ftz.timezone = difftm(&gmt, tm) / 60; - if(tm->tm_isdst) + if (tm->tm_isdst) ftz.timezone += 60; } else { @@ -889,7 +888,8 @@ cvs_date_parse(const char *p) } else { Start = nowtime; if (!yyHaveRel) - Start -= ((tm->tm_hour * 60L + tm->tm_min) * 60L) + tm->tm_sec; + Start -= ((tm->tm_hour * 60L + tm->tm_min) * 60L) + + tm->tm_sec; } Start += yyRelSeconds; diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c index db37b8b1487..b305b57c17c 100644 --- a/usr.bin/cvs/diff.c +++ b/usr.bin/cvs/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.56 2005/10/05 23:11:06 niallo Exp $ */ +/* $OpenBSD: diff.c,v 1.57 2005/10/07 21:47:32 reyk Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -1353,8 +1353,8 @@ proceed: struct context_vec *tmp; ptrdiff_t offset = context_vec_ptr - context_vec_start; max_context <<= 1; - if ((tmp = realloc(context_vec_start, - max_context * sizeof(struct context_vec))) == NULL) { + if ((tmp = realloc(context_vec_start, max_context * + sizeof(struct context_vec))) == NULL) { free(context_vec_start); context_vec_start = NULL; cvs_log(LP_ERRNO, @@ -1592,7 +1592,8 @@ match_function(const long *f, int pos, FILE *fp) if (p != NULL) *p = '\0'; if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { - strlcpy(lastbuf, (const char *)buf, sizeof lastbuf); + strlcpy(lastbuf, (const char *)buf, + sizeof lastbuf); lastmatchline = pos; return lastbuf; } diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index 510eb88ed76..3e078e9d288 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.123 2005/09/15 22:12:23 joris Exp $ */ +/* $OpenBSD: file.c,v 1.124 2005/10/07 21:47:32 reyk Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -53,7 +53,7 @@ struct cvs_ignpat { char ip_pat[MAXNAMLEN]; int ip_flags; - TAILQ_ENTRY (cvs_ignpat) ip_list; + TAILQ_ENTRY(cvs_ignpat) ip_list; }; @@ -287,7 +287,7 @@ cvs_file_create(CVSFILE *parent, const char *path, u_int type, mode_t mode) if (((mkdir(path, mode) == -1) && (errno != EEXIST)) || (cvs_mkadmin(path, cfp->cf_root->cr_str, cfp->cf_repo, - NULL, NULL, 0) < 0)) { + NULL, NULL, 0) < 0)) { cvs_file_free(cfp); return (NULL); } @@ -1314,7 +1314,7 @@ cvs_file_lget(const char *path, int flags, CVSFILE *parent, CVSENTRIES *pent, * but does not exist anymore, start complaining. */ if (!(cfp->cf_flags & CVS_FILE_ONDISK) && - (cfp->cf_cvstat == CVS_FST_ADDED) && + (cfp->cf_cvstat == CVS_FST_ADDED) && (cfp->cf_type != DT_DIR)) cvs_log(LP_WARN, "new-born %s has disappeared", path); diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index c09d902e538..430277de907 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.79 2005/10/05 23:11:07 niallo Exp $ */ +/* $OpenBSD: rcs.c,v 1.80 2005/10/07 21:47:32 reyk Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -598,8 +598,8 @@ rcs_write(RCSFILE *rfp) return (-1); } - if ((to_fd = open(rfp->rf_path, O_WRONLY|O_TRUNC|O_CREAT)) - == -1) { + if ((to_fd = open(rfp->rf_path, + O_WRONLY|O_TRUNC|O_CREAT)) == -1) { cvs_log(LP_ERRNO, "failed to open `%s'", fn); close(from_fd); return (-1); @@ -2905,12 +2905,14 @@ rcs_expand_keywords(char *rcsfile, struct rcs_delta *rdp, char *line, char *out, } /* - * order matters because of RCS_KW_ID and RCS_KW_HEADER here + * order matters because of RCS_KW_ID and + * RCS_KW_HEADER here */ if (mode & RCS_KWEXP_VAL) { if (kwtype & RCS_KW_RCSFILE) { if (!(kwtype & RCS_KW_FULLPATH)) - strlcat(expbuf, basename(rcsfile), + strlcat(expbuf, + basename(rcsfile), sizeof(expbuf)); else strlcat(expbuf, rcsfile, @@ -2919,14 +2921,16 @@ rcs_expand_keywords(char *rcsfile, struct rcs_delta *rdp, char *line, char *out, } if (kwtype & RCS_KW_REVISION) { - rcsnum_tostr(rdp->rd_num, buf, sizeof(buf)); + rcsnum_tostr(rdp->rd_num, buf, + sizeof(buf)); strlcat(buf, " ", sizeof(buf)); strlcat(expbuf, buf, sizeof(expbuf)); } if (kwtype & RCS_KW_DATE) { strftime(buf, sizeof(buf), - "%Y/%m/%d %H:%M:%S ", &rdp->rd_date); + "%Y/%m/%d %H:%M:%S ", + &rdp->rd_date); strlcat(expbuf, buf, sizeof(expbuf)); } @@ -2947,7 +2951,8 @@ rcs_expand_keywords(char *rcsfile, struct rcs_delta *rdp, char *line, char *out, strlcat(expbuf, " ", sizeof(expbuf)); if (kwtype & RCS_KW_SOURCE) { - strlcat(expbuf, rcsfile, sizeof(expbuf)); + strlcat(expbuf, rcsfile, + sizeof(expbuf)); strlcat(expbuf, " ", sizeof(expbuf)); } diff --git a/usr.bin/cvs/release.c b/usr.bin/cvs/release.c index b89cf48f5d6..bce2e6012fc 100644 --- a/usr.bin/cvs/release.c +++ b/usr.bin/cvs/release.c @@ -1,4 +1,4 @@ -/* $OpenBSD: release.c,v 1.22 2005/09/21 16:55:28 xsa Exp $ */ +/* $OpenBSD: release.c,v 1.23 2005/10/07 21:47:32 reyk Exp $ */ /* * Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org> * All rights reserved. @@ -115,8 +115,8 @@ cvs_release_yesno(void) ret = 0; - fflush (stderr); - fflush (stdout); + fflush(stderr); + fflush(stdout); if ((c = getchar()) != 'y' && c != 'Y') ret = -1; diff --git a/usr.bin/cvs/remove.c b/usr.bin/cvs/remove.c index 108fd28ff03..e69cd7387fa 100644 --- a/usr.bin/cvs/remove.c +++ b/usr.bin/cvs/remove.c @@ -1,4 +1,4 @@ -/* $OpenBSD: remove.c,v 1.36 2005/09/06 17:08:05 xsa Exp $ */ +/* $OpenBSD: remove.c,v 1.37 2005/10/07 21:47:32 reyk Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2004, 2005 Xavier Santolaria <xsa@openbsd.org> @@ -248,7 +248,7 @@ cvs_remove_file(const char *fpath) /* if -f option is used, physically remove the file */ if (force_remove == 1) { - if(cvs_unlink(fpath) == -1) + if (cvs_unlink(fpath) == -1) return (-1); nuked++; } else { diff --git a/usr.bin/cvs/repo.c b/usr.bin/cvs/repo.c index d228f124e0d..8f2d77e8e0d 100644 --- a/usr.bin/cvs/repo.c +++ b/usr.bin/cvs/repo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: repo.c,v 1.8 2005/08/11 11:45:06 xsa Exp $ */ +/* $OpenBSD: repo.c,v 1.9 2005/10/07 21:47:32 reyk Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -222,7 +222,8 @@ cvs_repo_lockent(CVSRPENT *ent, int type, pid_t owner) if (TAILQ_EMPTY(&(ent->cr_rlocks))) ent->cr_wlock = lk; else - TAILQ_INSERT_TAIL(&(ent->cr_lkreq), lk, lk_link); + TAILQ_INSERT_TAIL(&(ent->cr_lkreq), + lk, lk_link); } } @@ -594,7 +595,8 @@ cvs_repo_loadrec(CVSREPO *repo, const char *path) } cr_ent->cr_parent = cfp; - TAILQ_INSERT_TAIL(&(cfp->cr_files), cr_ent, cr_link); + TAILQ_INSERT_TAIL(&(cfp->cr_files), + cr_ent, cr_link); } } while (ret > 0); diff --git a/usr.bin/cvs/req.c b/usr.bin/cvs/req.c index d740df00eaa..e57aa1fc10a 100644 --- a/usr.bin/cvs/req.c +++ b/usr.bin/cvs/req.c @@ -1,4 +1,4 @@ -/* $OpenBSD: req.c,v 1.31 2005/09/15 17:01:10 xsa Exp $ */ +/* $OpenBSD: req.c,v 1.32 2005/10/07 21:47:32 reyk Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -69,7 +69,7 @@ static int cvs_req_command(int, char *); struct cvs_reqhdlr { - int (*hdlr)(int, char *); + int (*hdlr)(int, char *); } cvs_req_swtab[CVS_REQ_MAX + 1] = { { NULL }, { cvs_req_root }, @@ -440,7 +440,8 @@ cvs_req_filestate(int reqid, char *line) ent = cvs_ent_get(cvs_req_entf, line); if (ent == NULL) { cvs_log(LP_ERR, - "received Unchanged request for a non-existing file"); + "received Unchanged request " + "for a non-existing file"); ret = -1; } else { ent->ce_status = CVS_ENT_UPTODATE; diff --git a/usr.bin/cvs/resp.c b/usr.bin/cvs/resp.c index 109f3020d89..5c3df305d6a 100644 --- a/usr.bin/cvs/resp.c +++ b/usr.bin/cvs/resp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resp.c,v 1.59 2005/09/15 22:12:23 joris Exp $ */ +/* $OpenBSD: resp.c,v 1.60 2005/10/07 21:47:32 reyk Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -66,7 +66,7 @@ static int cvs_resp_copyfile (struct cvsroot *, int, char *); static int cvs_resp_createdir (char *); struct cvs_resphdlr { - int (*hdlr)(struct cvsroot *, int, char *); + int (*hdlr)(struct cvsroot *, int, char *); } cvs_resp_swtab[CVS_RESP_MAX + 1] = { { NULL }, { cvs_resp_ok }, diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c index bbc92f803e7..4ba6ef57263 100644 --- a/usr.bin/cvs/util.c +++ b/usr.bin/cvs/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.52 2005/09/15 17:01:10 xsa Exp $ */ +/* $OpenBSD: util.c,v 1.53 2005/10/07 21:47:32 reyk Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -890,7 +890,7 @@ cvs_parse_tagfile(char **tagp, char **datep, int *nbp) } linebuf[--len] = '\0'; - switch(*linebuf) { + switch (*linebuf) { case 'T': if (tagp != NULL) *tagp = strdup(linebuf); |