From aff333a19fa881f52475c7f352eb57ea44dd7e52 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 20 May 2011 19:21:11 +0000 Subject: Remove a bunch of unused functions, from Michael W Bombardieri. ok ray --- usr.bin/rcs/rcs.c | 195 +-------------------------------------------------- usr.bin/rcs/rcs.h | 10 +-- usr.bin/rcs/rcsnum.c | 19 +---- 3 files changed, 3 insertions(+), 221 deletions(-) diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c index f818fd8c65c..98f519a9241 100644 --- a/usr.bin/rcs/rcs.c +++ b/usr.bin/rcs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.75 2011/04/20 19:34:16 nicm Exp $ */ +/* $OpenBSD: rcs.c,v 1.76 2011/05/20 19:21:10 nicm Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -50,75 +50,6 @@ static const char rcs_state_invch[] = RCS_STATE_INVALCHAR; /* invalid characters in RCS symbol names */ static const char rcs_sym_invch[] = RCS_SYM_INVALCHAR; -/* comment leaders, depending on the file's suffix */ -static const struct rcs_comment { - const char *rc_suffix; - const char *rc_cstr; -} rcs_comments[] = { - { "1", ".\\\" " }, - { "2", ".\\\" " }, - { "3", ".\\\" " }, - { "4", ".\\\" " }, - { "5", ".\\\" " }, - { "6", ".\\\" " }, - { "7", ".\\\" " }, - { "8", ".\\\" " }, - { "9", ".\\\" " }, - { "a", "-- " }, /* Ada */ - { "ada", "-- " }, - { "adb", "-- " }, - { "asm", ";; " }, /* assembler (MS-DOS) */ - { "ads", "-- " }, /* Ada */ - { "bat", ":: " }, /* batch (MS-DOS) */ - { "body", "-- " }, /* Ada */ - { "c", " * " }, /* C */ - { "c++", "// " }, /* C++ */ - { "cc", "// " }, - { "cpp", "// " }, - { "cxx", "// " }, - { "m", "// " }, /* Objective-C */ - { "cl", ";;; " }, /* Common Lisp */ - { "cmd", ":: " }, /* command (OS/2) */ - { "cmf", "c " }, /* CM Fortran */ - { "csh", "# " }, /* shell */ - { "e", "# " }, /* efl */ - { "epsf", "% " }, /* encapsulated postscript */ - { "epsi", "% " }, /* encapsulated postscript */ - { "el", "; " }, /* Emacs Lisp */ - { "f", "c " }, /* Fortran */ - { "for", "c " }, - { "h", " * " }, /* C-header */ - { "hh", "// " }, /* C++ header */ - { "hpp", "// " }, - { "hxx", "// " }, - { "in", "# " }, /* for Makefile.in */ - { "l", " * " }, /* lex */ - { "mac", ";; " }, /* macro (DEC-10, MS-DOS, PDP-11, VMS, etc) */ - { "mak", "# " }, /* makefile, e.g. Visual C++ */ - { "me", ".\\\" " }, /* me-macros t/nroff */ - { "ml", "; " }, /* mocklisp */ - { "mm", ".\\\" " }, /* mm-macros t/nroff */ - { "ms", ".\\\" " }, /* ms-macros t/nroff */ - { "man", ".\\\" " }, /* man-macros t/nroff */ - { "p", " * " }, /* pascal */ - { "pas", " * " }, - { "pl", "# " }, /* Perl (conflict with Prolog) */ - { "pm", "# " }, /* Perl module */ - { "ps", "% " }, /* postscript */ - { "psw", "% " }, /* postscript wrap */ - { "pswm", "% " }, /* postscript wrap */ - { "r", "# " }, /* ratfor */ - { "rc", " * " }, /* Microsoft Windows resource file */ - { "red", "% " }, /* psl/rlisp */ - { "sh", "# " }, /* shell */ - { "sl", "% " }, /* psl */ - { "spec", "-- " }, /* Ada */ - { "tex", "% " }, /* tex */ - { "y", " * " }, /* yacc */ - { "ye", " * " }, /* yacc-efl */ - { "yr", " * " }, /* yacc-ratfor */ -}; - struct rcs_kw rcs_expkw[] = { { "Author", RCS_KW_AUTHOR }, { "Date", RCS_KW_DATE }, @@ -133,19 +64,6 @@ struct rcs_kw rcs_expkw[] = { { "State", RCS_KW_STATE }, }; -#define NB_COMTYPES (sizeof(rcs_comments)/sizeof(rcs_comments[0])) - -static const char *rcs_errstrs[] = { - "No error", - "No such entry", - "Duplicate entry found", - "Bad RCS number", - "Invalid RCS symbol", - "Parse error", -}; - -#define RCS_NERR (sizeof(rcs_errstrs)/sizeof(rcs_errstrs[0])) - int rcs_errno = RCS_ERR_NOERR; char *timezone_flag = NULL; @@ -509,17 +427,6 @@ out: return (ret); } -/* - * rcs_head_get() - * - * Retrieve the revision number of the head revision for the RCS file . - */ -const RCSNUM * -rcs_head_get(RCSFILE *file) -{ - return (file->rf_head); -} - /* * rcs_head_set() * @@ -554,23 +461,6 @@ rcs_branch_get(RCSFILE *file) return (file->rf_branch); } -/* - * rcs_branch_set() - * - * Set the default branch for the RCS file to . - * Returns 0 on success, -1 on failure. - */ -int -rcs_branch_set(RCSFILE *file, const RCSNUM *bnum) -{ - if (file->rf_branch == NULL) - file->rf_branch = rcsnum_alloc(); - - rcsnum_cpy(bnum, file->rf_branch, 0); - file->rf_flags &= ~RCS_SYNCED; - return (0); -} - /* * rcs_access_add() * @@ -863,17 +753,6 @@ rcs_lock_remove(RCSFILE *file, const char *user, RCSNUM *rev) return (0); } -/* - * rcs_desc_get() - * - * Retrieve the description for the RCS file . - */ -const char * -rcs_desc_get(RCSFILE *file) -{ - return (file->rf_desc); -} - /* * rcs_desc_set() * @@ -891,41 +770,6 @@ rcs_desc_set(RCSFILE *file, const char *desc) file->rf_flags &= ~RCS_SYNCED; } -/* - * rcs_comment_lookup() - * - * Lookup the assumed comment leader based on a file's suffix. - * Returns a pointer to the string on success, or NULL on failure. - */ -const char * -rcs_comment_lookup(const char *filename) -{ - int i; - const char *sp; - - if ((sp = strrchr(filename, '.')) == NULL) { - rcs_errno = RCS_ERR_NOENT; - return (NULL); - } - sp++; - - for (i = 0; i < (int)NB_COMTYPES; i++) - if (strcmp(rcs_comments[i].rc_suffix, sp) == 0) - return (rcs_comments[i].rc_cstr); - return (NULL); -} - -/* - * rcs_comment_get() - * - * Retrieve the comment leader for the RCS file . - */ -const char * -rcs_comment_get(RCSFILE *file) -{ - return (file->rf_comment); -} - /* * rcs_comment_set() * @@ -1563,25 +1407,6 @@ rcs_kflag_get(const char *flags) return (fl); } -/* - * rcs_errstr() - * - * Get the error string matching the RCS error code . - */ -const char * -rcs_errstr(int code) -{ - const char *esp; - - if (code < 0 || (code >= (int)RCS_NERR && code != RCS_ERR_ERRNO)) - esp = NULL; - else if (code == RCS_ERR_ERRNO) - esp = strerror(errno); - else - esp = rcs_errstrs[code]; - return (esp); -} - /* * rcs_freedelta() * @@ -2003,24 +1828,6 @@ rcs_state_check(const char *state) return (ret); } -/* - * rcs_state_get() - * - * Get the state for a given revision of a specified RCSFILE. - * - * Returns NULL on failure. - */ -const char * -rcs_state_get(RCSFILE *rfp, RCSNUM *rev) -{ - struct rcs_delta *rdp; - - if ((rdp = rcs_findrev(rfp, rev)) == NULL) - return (NULL); - - return (rdp->rd_state); -} - /* * rcs_kwexp_buf() * diff --git a/usr.bin/rcs/rcs.h b/usr.bin/rcs/rcs.h index 1af66b21c8b..0d3197daae2 100644 --- a/usr.bin/rcs/rcs.h +++ b/usr.bin/rcs/rcs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.h,v 1.13 2010/10/20 19:53:53 tobias Exp $ */ +/* $OpenBSD: rcs.h,v 1.14 2011/05/20 19:21:10 nicm Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -213,10 +213,8 @@ extern int rcs_errno; RCSFILE *rcs_open(const char *, int, int, ...); void rcs_close(RCSFILE *); -const RCSNUM *rcs_head_get(RCSFILE *); int rcs_head_set(RCSFILE *, RCSNUM *); const RCSNUM *rcs_branch_get(RCSFILE *); -int rcs_branch_set(RCSFILE *, const RCSNUM *); int rcs_access_add(RCSFILE *, const char *); int rcs_access_remove(RCSFILE *, const char *); int rcs_access_check(RCSFILE *, const char *); @@ -231,10 +229,7 @@ int rcs_lock_add(RCSFILE *, const char *, RCSNUM *); int rcs_lock_remove(RCSFILE *, const char *, RCSNUM *); BUF *rcs_getrev(RCSFILE *, RCSNUM *); int rcs_deltatext_set(RCSFILE *, RCSNUM *, BUF *); -const char *rcs_desc_get(RCSFILE *); void rcs_desc_set(RCSFILE *, const char *); -const char *rcs_comment_lookup(const char *); -const char *rcs_comment_get(RCSFILE *); void rcs_comment_set(RCSFILE *, const char *); BUF *rcs_kwexp_buf(BUF *, RCSFILE *, RCSNUM *); void rcs_kwexp_set(RCSFILE *, int); @@ -245,9 +240,7 @@ time_t rcs_rev_getdate(RCSFILE *, RCSNUM *); int rcs_rev_setlog(RCSFILE *, RCSNUM *, const char *); int rcs_rev_remove(RCSFILE *, RCSNUM *); int rcs_state_set(RCSFILE *, RCSNUM *, const char *); -const char *rcs_state_get(RCSFILE *, RCSNUM *); int rcs_state_check(const char *); -const char *rcs_errstr(int); void rcs_write(RCSFILE *); void rcs_delta_stats(struct rcs_delta *, int *, int *); @@ -260,7 +253,6 @@ RCSNUM *rcsnum_parse(const char *); RCSNUM *rcsnum_brtorev(const RCSNUM *); RCSNUM *rcsnum_revtobr(const RCSNUM *); RCSNUM *rcsnum_inc(RCSNUM *); -RCSNUM *rcsnum_dec(RCSNUM *); void rcsnum_free(RCSNUM *); int rcsnum_addmagic(RCSNUM *); int rcsnum_aton(const char *, char **, RCSNUM *); diff --git a/usr.bin/rcs/rcsnum.c b/usr.bin/rcs/rcsnum.c index dc44ca2a769..cd599e80cae 100644 --- a/usr.bin/rcs/rcsnum.c +++ b/usr.bin/rcs/rcsnum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsnum.c,v 1.12 2010/07/23 21:46:05 ray Exp $ */ +/* $OpenBSD: rcsnum.c,v 1.13 2011/05/20 19:21:10 nicm Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -350,23 +350,6 @@ rcsnum_inc(RCSNUM *num) return (num); } -/* - * rcsnum_dec() - * - * Decreases the revision number specified in , if doing so will not - * result in an ending value below 1. E.g. 4.2 will go to 4.1 but 4.1 will - * be returned as 4.1. - */ -RCSNUM * -rcsnum_dec(RCSNUM *num) -{ - /* XXX - Is it an error for the number to be 0? */ - if (num->rn_id[num->rn_len - 1] <= 1) - return (num); - num->rn_id[num->rn_len - 1]--; - return (num); -} - /* * rcsnum_revtobr() * -- cgit v1.2.3