Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/cron/dist I am having the last_word: Print the ...
details: https://anonhg.NetBSD.org/src/rev/9fa5a1bf1eb1
branches: trunk
changeset: 342353:9fa5a1bf1eb1
user: christos <christos%NetBSD.org@localhost>
date: Thu Dec 17 22:36:48 2015 +0000
description:
I am having the last_word: Print the full hostname.
diffstat:
external/bsd/cron/dist/do_command.c | 6 ++--
external/bsd/cron/dist/funcs.h | 3 +-
external/bsd/cron/dist/misc.c | 39 +-----------------------------------
3 files changed, 6 insertions(+), 42 deletions(-)
diffs (104 lines):
diff -r 5db37e95f58a -r 9fa5a1bf1eb1 external/bsd/cron/dist/do_command.c
--- a/external/bsd/cron/dist/do_command.c Thu Dec 17 22:32:41 2015 +0000
+++ b/external/bsd/cron/dist/do_command.c Thu Dec 17 22:36:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: do_command.c,v 1.6 2014/09/05 21:32:37 christos Exp $ */
+/* $NetBSD: do_command.c,v 1.7 2015/12/17 22:36:48 christos Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved
@@ -25,7 +25,7 @@
#if 0
static char rcsid[] = "Id: do_command.c,v 1.9 2004/01/23 18:56:42 vixie Exp";
#else
-__RCSID("$NetBSD: do_command.c,v 1.6 2014/09/05 21:32:37 christos Exp $");
+__RCSID("$NetBSD: do_command.c,v 1.7 2015/12/17 22:36:48 christos Exp $");
#endif
#endif
@@ -454,7 +454,7 @@
(void)fprintf(mail, "To: %s\n", mailto);
(void)fprintf(mail,
"Subject: Cron <%s@%s> %s\n",
- usernm, first_word(hostname, "."), e->cmd);
+ usernm, hostname, e->cmd);
(void)fprintf(mail,
"Auto-Submitted: auto-generated\n");
#ifdef MAIL_DATE
diff -r 5db37e95f58a -r 9fa5a1bf1eb1 external/bsd/cron/dist/funcs.h
--- a/external/bsd/cron/dist/funcs.h Thu Dec 17 22:32:41 2015 +0000
+++ b/external/bsd/cron/dist/funcs.h Thu Dec 17 22:36:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: funcs.h,v 1.2 2010/05/06 18:53:17 christos Exp $ */
+/* $NetBSD: funcs.h,v 1.3 2015/12/17 22:36:48 christos Exp $ */
/*
* Id: funcs.h,v 1.9 2004/01/23 18:56:42 vixie Exp
@@ -59,7 +59,6 @@
char *env_get(const char *, char **),
*arpadate(time_t *),
*mkprints(char *, size_t),
- *first_word(char *, const char *),
**env_init(void),
**env_copy(char **),
**env_set(char **, char *);
diff -r 5db37e95f58a -r 9fa5a1bf1eb1 external/bsd/cron/dist/misc.c
--- a/external/bsd/cron/dist/misc.c Thu Dec 17 22:32:41 2015 +0000
+++ b/external/bsd/cron/dist/misc.c Thu Dec 17 22:36:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.2 2010/05/06 18:53:17 christos Exp $ */
+/* $NetBSD: misc.c,v 1.3 2015/12/17 22:36:48 christos Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved
@@ -25,7 +25,7 @@
#if 0
static char rcsid[] = "Id: misc.c,v 1.16 2004/01/23 18:56:43 vixie Exp";
#else
-__RCSID("$NetBSD: misc.c,v 1.2 2010/05/06 18:53:17 christos Exp $");
+__RCSID("$NetBSD: misc.c,v 1.3 2015/12/17 22:36:48 christos Exp $");
#endif
#endif
@@ -497,41 +497,6 @@
#endif /*SYSLOG*/
}
-/* char *first_word(char *s, char *t)
- * return pointer to first word
- * parameters:
- * s - string we want the first word of
- * t - terminators, implicitly including \0
- * warnings:
- * (1) this routine is fairly slow
- * (2) it returns a pointer to static storage
- */
-char *
-first_word(char *s, const char *t) {
- static char retbuf[2][MAX_TEMPSTR + 1]; /* sure wish C had GC */
- static int retsel = 0;
- char *rb, *rp;
-
- /* select a return buffer */
- retsel = 1-retsel;
- rb = &retbuf[retsel][0];
- rp = rb;
-
- /* skip any leading terminators */
- while (*s && (NULL != strchr(t, *s))) {
- s++;
- }
-
- /* copy until next terminator or full buffer */
- while (*s && (NULL == strchr(t, *s)) && (rp < &rb[MAX_TEMPSTR])) {
- *rp++ = *s++;
- }
-
- /* finish the return-string and return it */
- *rp = '\0';
- return (rb);
-}
-
/* warning:
* heavily ascii-dependent.
*/
Home |
Main Index |
Thread Index |
Old Index