[Midnightbsd-cvs] src [11384] trunk/libexec/talkd/talkd.c: cleanup formatting, make some things static
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Fri Jul 6 20:16:08 EDT 2018
Revision: 11384
http://svnweb.midnightbsd.org/src/?rev=11384
Author: laffer1
Date: 2018-07-06 20:16:08 -0400 (Fri, 06 Jul 2018)
Log Message:
-----------
cleanup formatting, make some things static
Modified Paths:
--------------
trunk/libexec/talkd/Makefile
trunk/libexec/talkd/announce.c
trunk/libexec/talkd/extern.h
trunk/libexec/talkd/print.c
trunk/libexec/talkd/process.c
trunk/libexec/talkd/table.c
trunk/libexec/talkd/talkd.8
trunk/libexec/talkd/talkd.c
Property Changed:
----------------
trunk/libexec/talkd/talkd.8
Modified: trunk/libexec/talkd/Makefile
===================================================================
--- trunk/libexec/talkd/Makefile 2018-07-07 00:15:34 UTC (rev 11383)
+++ trunk/libexec/talkd/Makefile 2018-07-07 00:16:08 UTC (rev 11384)
@@ -1,11 +1,11 @@
+# $MidnightBSD$
# @(#)Makefile 8.1 (Berkeley) 6/4/93
-# $FreeBSD: src/libexec/talkd/Makefile,v 1.9 2002/02/04 02:33:51 kris Exp $
-# $MidnightBSD: src/libexec/talkd/Makefile,v 1.2 2012/04/11 00:58:36 laffer1 Exp $
+# $FreeBSD: stable/10/libexec/talkd/Makefile 321267 2017-07-20 00:52:11Z ngie $
PROG= ntalkd
SRCS= talkd.c announce.c process.c table.c print.c ttymsg.c
-.PATH: ${.CURDIR}/../../usr.bin/wall
+.PATH: ${SRCTOP}/usr.bin/wall
MAN= talkd.8
-CFLAGS+=-I${.CURDIR}/../../usr.bin/wall
+CFLAGS+=-I${SRCTOP}/usr.bin/wall
.include <bsd.prog.mk>
Modified: trunk/libexec/talkd/announce.c
===================================================================
--- trunk/libexec/talkd/announce.c 2018-07-07 00:15:34 UTC (rev 11383)
+++ trunk/libexec/talkd/announce.c 2018-07-07 00:16:08 UTC (rev 11384)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/libexec/talkd/announce.c,v 1.2 2012/04/11 00:58:36 laffer1 Exp $ */
+/* $MidnightBSD$ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -11,11 +11,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -37,7 +33,7 @@
static char sccsid[] = "@(#)announce.c 8.3 (Berkeley) 4/28/95";
#endif
static const char rcsid[] =
- "$FreeBSD: src/libexec/talkd/announce.c,v 1.16 2003/04/03 05:13:27 jmallett Exp $";
+ "$FreeBSD: stable/10/libexec/talkd/announce.c 262435 2014-02-24 08:21:49Z brueffer $";
#endif /* not lint */
#include <sys/types.h>
@@ -61,8 +57,6 @@
#include "ttymsg.h"
#include "extern.h"
-extern char hostname[];
-
/*
* Announce an invitation to talk.
*/
Modified: trunk/libexec/talkd/extern.h
===================================================================
--- trunk/libexec/talkd/extern.h 2018-07-07 00:15:34 UTC (rev 11383)
+++ trunk/libexec/talkd/extern.h 2018-07-07 00:16:08 UTC (rev 11384)
@@ -23,9 +23,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/libexec/talkd/extern.h,v 1.3 2003/04/03 05:13:27 jmallett Exp $
+ * $FreeBSD: stable/10/libexec/talkd/extern.h 241777 2012-10-20 10:33:15Z ed $
*/
+extern int debug;
+extern char hostname[];
+
int announce(CTL_MSG *, const char *);
int delete_invite(u_int32_t);
void do_announce(CTL_MSG *, CTL_RESPONSE *);
Modified: trunk/libexec/talkd/print.c
===================================================================
--- trunk/libexec/talkd/print.c 2018-07-07 00:15:34 UTC (rev 11383)
+++ trunk/libexec/talkd/print.c 2018-07-07 00:16:08 UTC (rev 11384)
@@ -11,11 +11,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -37,7 +33,7 @@
static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$FreeBSD: src/libexec/talkd/print.c,v 1.12 2003/04/03 05:13:27 jmallett Exp $";
+ "$FreeBSD: stable/10/libexec/talkd/print.c 262435 2014-02-24 08:21:49Z brueffer $";
#endif /* not lint */
/* debug print routines */
Modified: trunk/libexec/talkd/process.c
===================================================================
--- trunk/libexec/talkd/process.c 2018-07-07 00:15:34 UTC (rev 11383)
+++ trunk/libexec/talkd/process.c 2018-07-07 00:16:08 UTC (rev 11384)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/libexec/talkd/process.c,v 1.2 2012/04/11 00:58:36 laffer1 Exp $ */
+/* $MidnightBSD$ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -11,11 +11,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -37,7 +33,7 @@
static char sccsid[] = "@(#)process.c 8.2 (Berkeley) 11/16/93";
#endif
static const char rcsid[] =
- "$FreeBSD: src/libexec/talkd/process.c,v 1.11 2005/05/06 15:28:54 delphij Exp $";
+ "$FreeBSD: stable/10/libexec/talkd/process.c 262435 2014-02-24 08:21:49Z brueffer $";
#endif /* not lint */
/*
@@ -64,8 +60,6 @@
#include "extern.h"
-extern int debug;
-
void
process_request(CTL_MSG *mp, CTL_RESPONSE *rp)
{
Modified: trunk/libexec/talkd/table.c
===================================================================
--- trunk/libexec/talkd/table.c 2018-07-07 00:15:34 UTC (rev 11383)
+++ trunk/libexec/talkd/table.c 2018-07-07 00:16:08 UTC (rev 11384)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/libexec/talkd/table.c,v 1.2 2012/04/11 00:58:36 laffer1 Exp $ */
+/* $MidnightBSD$ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -11,11 +11,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -37,7 +33,7 @@
static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$FreeBSD: src/libexec/talkd/table.c,v 1.9 2003/04/03 05:13:27 jmallett Exp $";
+ "$FreeBSD: stable/10/libexec/talkd/table.c 311751 2017-01-09 05:52:30Z delphij $";
#endif /* not lint */
/*
@@ -65,8 +61,7 @@
#define NIL ((TABLE_ENTRY *)0)
-extern int debug;
-struct timeval tp;
+static struct timespec ts;
typedef struct table_entry TABLE_ENTRY;
@@ -79,7 +74,7 @@
static void delete(TABLE_ENTRY *);
-TABLE_ENTRY *table = NIL;
+static TABLE_ENTRY *table = NIL;
/*
* Look in the table for an invitation that matches the current
@@ -88,14 +83,15 @@
CTL_MSG *
find_match(CTL_MSG *request)
{
- TABLE_ENTRY *ptr;
+ TABLE_ENTRY *ptr, *next;
time_t current_time;
- gettimeofday(&tp, NULL);
- current_time = tp.tv_sec;
+ clock_gettime(CLOCK_MONOTONIC_FAST, &ts);
+ current_time = ts.tv_sec;
if (debug)
print_request("find_match", request);
- for (ptr = table; ptr != NIL; ptr = ptr->next) {
+ for (ptr = table; ptr != NIL; ptr = next) {
+ next = ptr->next;
if ((ptr->time - current_time) > MAX_LIFE) {
/* the entry is too old */
if (debug)
@@ -121,11 +117,11 @@
CTL_MSG *
find_request(CTL_MSG *request)
{
- TABLE_ENTRY *ptr;
+ TABLE_ENTRY *ptr, *next;
time_t current_time;
- gettimeofday(&tp, NULL);
- current_time = tp.tv_sec;
+ clock_gettime(CLOCK_MONOTONIC_FAST, &ts);
+ current_time = ts.tv_sec;
/*
* See if this is a repeated message, and check for
* out of date entries in the table while we are it.
@@ -132,7 +128,8 @@
*/
if (debug)
print_request("find_request", request);
- for (ptr = table; ptr != NIL; ptr = ptr->next) {
+ for (ptr = table; ptr != NIL; ptr = next) {
+ next = ptr->next;
if ((ptr->time - current_time) > MAX_LIFE) {
/* the entry is too old */
if (debug)
@@ -161,8 +158,8 @@
TABLE_ENTRY *ptr;
time_t current_time;
- gettimeofday(&tp, NULL);
- current_time = tp.tv_sec;
+ clock_gettime(CLOCK_MONOTONIC_FAST, &ts);
+ current_time = ts.tv_sec;
request->id_num = new_id();
response->id_num = htonl(request->id_num);
/* insert a new entry into the top of the list */
Modified: trunk/libexec/talkd/talkd.8
===================================================================
--- trunk/libexec/talkd/talkd.8 2018-07-07 00:15:34 UTC (rev 11383)
+++ trunk/libexec/talkd/talkd.8 2018-07-07 00:16:08 UTC (rev 11384)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -9,11 +10,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
+.\" 3. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
@@ -30,8 +27,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)talkd.8 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD: src/libexec/talkd/talkd.8,v 1.7 2003/09/08 19:57:18 ru Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/libexec/talkd/talkd.8 262435 2014-02-24 08:21:49Z brueffer $
.\"
.Dd December 11, 1993
.Dt TALKD 8
Property changes on: trunk/libexec/talkd/talkd.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/libexec/talkd/talkd.c
===================================================================
--- trunk/libexec/talkd/talkd.c 2018-07-07 00:15:34 UTC (rev 11383)
+++ trunk/libexec/talkd/talkd.c 2018-07-07 00:16:08 UTC (rev 11384)
@@ -11,11 +11,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -43,7 +39,7 @@
static char sccsid[] = "@(#)talkd.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$FreeBSD: src/libexec/talkd/talkd.c,v 1.17 2004/06/14 22:44:13 bms Exp $";
+ "$FreeBSD: stable/10/libexec/talkd/talkd.c 262435 2014-02-24 08:21:49Z brueffer $";
#endif /* not lint */
/*
@@ -70,13 +66,13 @@
#include "extern.h"
-CTL_MSG request;
-CTL_RESPONSE response;
+static CTL_MSG request;
+static CTL_RESPONSE response;
-int debug = 0;
-long lastmsgtime;
+int debug = 0;
+static long lastmsgtime;
-char hostname[MAXHOSTNAMELEN];
+char hostname[MAXHOSTNAMELEN];
#define TIMEOUT 30
#define MAXIDLE 120
More information about the Midnightbsd-cvs
mailing list