Module Name: src
Committed By: christos
Date: Tue Mar 7 21:24:19 UTC 2023
Modified Files:
src/usr.bin/cvslatest: cvslatest.c
Log Message:
simplify previous
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/cvslatest/cvslatest.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/cvslatest/cvslatest.c
diff -u src/usr.bin/cvslatest/cvslatest.c:1.10 src/usr.bin/cvslatest/cvslatest.c:1.11
--- src/usr.bin/cvslatest/cvslatest.c:1.10 Wed Feb 15 12:00:24 2023
+++ src/usr.bin/cvslatest/cvslatest.c Tue Mar 7 16:24:19 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: cvslatest.c,v 1.10 2023/02/15 17:00:24 martin Exp $ */
+/* $NetBSD: cvslatest.c,v 1.11 2023/03/07 21:24:19 christos Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: cvslatest.c,v 1.10 2023/02/15 17:00:24 martin Exp $");
+__RCSID("$NetBSD: cvslatest.c,v 1.11 2023/03/07 21:24:19 christos Exp $");
/*
* Find the latest timestamp in a set of CVS trees, by examining the
@@ -92,6 +92,13 @@ getrepo(const FTSENT *e, char *repo, siz
}
static void
+notimestamp(const char *fn, const char *ename, int uncommitted)
+{
+ warnx("Can't get timestamp from %s file `%s' in `%s'",
+ uncommitted ? "uncommitted" : "locally modified", fn, ename);
+}
+
+static void
getlatest(const FTSENT *e, const char *repo, struct latest *lat)
{
static const char fmt[] = "%a %b %d %H:%M:%S %Y";
@@ -117,28 +124,14 @@ getlatest(const FTSENT *e, const char *r
goto mal;
if ((dt = strtok(NULL, "/")) == NULL)
goto mal;
- if (strcmp(dt, "dummy timestamp") == 0) {
- warnx("Can't get timestamp from uncommitted file %s in `%s'",
- fn, ename);
- if (!ignore)
- exit(EXIT_FAILURE);
- continue;
- }
- /*
- * This may not be visible in real world, but the cvs code
- * has paths that would create this string (mabe server
- * side only?)
- */
- if (strcmp(dt, "dummy timestamp from new-entry") == 0) {
- warnx("Can't get timestamp from uncommitted file %s in `%s'",
- fn, ename);
+ if (strncmp(dt, "dummy timestamp", 14) == 0) {
+ notimestamp(fn, ename, 1);
if (!ignore)
exit(EXIT_FAILURE);
continue;
}
if (strcmp(dt, "Result of merge") == 0) {
- warnx("Can't get cvs timestamp for localy modified file %s in `%s', using modification time.",
- fn, ename);
+ notimestamp(fn, ename, 0);
if (fstat(fileno(fp), &sb) == 0) {
t = sb.st_mtime;
goto compare;