diff options
author | 2007-02-22 19:11:13 +0000 | |
---|---|---|
committer | 2007-02-22 19:11:13 +0000 | |
commit | 168f4dca489f790262d4e96fcbd2eb26100bcf1e (patch) | |
tree | d1f93a3934f3546e278a0163dafb52686c2829ed /usr.bin/rcs/rcsutil.c | |
parent | Added changes to dump all tables not just DSDT (diff) | |
download | wireguard-openbsd-168f4dca489f790262d4e96fcbd2eb26100bcf1e.tar.xz wireguard-openbsd-168f4dca489f790262d4e96fcbd2eb26100bcf1e.zip |
If a ,suffix file is given as an arg to ci and co, strip it. Avoids
potential disasters. Initial diff from niallo@, ok niallo@ joris@
Diffstat (limited to 'usr.bin/rcs/rcsutil.c')
-rw-r--r-- | usr.bin/rcs/rcsutil.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/usr.bin/rcs/rcsutil.c b/usr.bin/rcs/rcsutil.c index 633862235f6..11976adc86c 100644 --- a/usr.bin/rcs/rcsutil.c +++ b/usr.bin/rcs/rcsutil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsutil.c,v 1.27 2007/02/22 08:30:45 xsa Exp $ */ +/* $OpenBSD: rcsutil.c,v 1.28 2007/02/22 19:11:13 otto Exp $ */ /* * Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> @@ -619,3 +619,23 @@ rcs_argv_destroy(struct rcs_argvector *av) xfree(av->argv); xfree(av); } + +/* + * Strip suffix from filename. + */ +void +rcs_strip_suffix(char *filename) +{ + char *p, *suffixes, *next, *ext; + + if ((p = strrchr(filename, ',')) != NULL) { + suffixes = xstrdup(rcs_suffixes); + for (next = suffixes; (ext = strsep(&next, "/")) != NULL;) { + if (!strcmp(p, ext)) { + *p = '\0'; + break; + } + } + xfree(suffixes); + } +} |