Anonymous avatar Anonymous committed aacf7cd

myctime -> rb_ctime

Comments (0)

Files changed (5)

include/irc_string.h

  */
 char *strip_tabs(char *dest, const unsigned char *src, size_t len);
 
-const char *myctime(time_t);
-
 #define EmptyString(x) ((x) == NULL || *(x) == '\0')
 #define CheckEmpty(x) EmptyString(x) ? "" : x
 
 static void
 send_birthdate_online_time(struct Client *source_p)
 {
+	char tbuf[26]; /* this needs to be 26 - see ctime_r manpage */
 	sendto_one(source_p, ":%s %d %s :Birth Date: %s, compile # %s",
 		   get_id(&me, source_p), RPL_INFO, 
 		   get_id(source_p, source_p), creation, generation);
 
 	sendto_one(source_p, ":%s %d %s :On-line since %s",
 		   get_id(&me, source_p), RPL_INFO, 
-		   get_id(source_p, source_p), myctime(startup_time));
+		   get_id(source_p, source_p), rb_ctime(startup_time, tbuf, sizeof(tbuf)));
 }
 
 /*

modules/m_whowas.c

 	int max = -1, found = 0;
 	char *p;
 	const char *nick;
+	char tbuf[26];
 
 	static time_t last_used = 0L;
 
 			sendto_one_numeric(source_p, RPL_WHOISSERVER,
 					   form_str(RPL_WHOISSERVER),
 					   temp->name, temp->servername,
-					   myctime(temp->logoff));
+					   rb_ctime(temp->logoff, tbuf, sizeof(tbuf)));
 			cur++;
 			found++;
 		}
 		  const char *comment)
 {
 	unsigned long on_for;
+	char tbuf[26];
 
 	exit_generic_client(client_p, source_p, from, comment);
 	clear_monitor(source_p);
 	on_for = rb_current_time() - source_p->localClient->firsttime;
 
 	ilog(L_USER, "%s (%3lu:%02lu:%02lu): %s!%s@%s %d/%d",
-		myctime(rb_current_time()), on_for / 3600,
+		rb_ctime(rb_current_time(), tbuf, sizeof(tbuf)), on_for / 3600,
 		(on_for % 3600) / 60, on_for % 60,
 		source_p->name, source_p->username, source_p->host,
 		source_p->localClient->sendK, source_p->localClient->receiveK);
 #include "client.h"
 #include "setup.h"
 
-#ifndef INADDRSZ
-#define INADDRSZ 4
-#endif
-
-#ifdef RB_IPV6
-#ifndef IN6ADDRSZ
-#define IN6ADDRSZ 16
-#endif
-#endif
-
 #ifndef INT16SZ
 #define INT16SZ 2
 #endif
-/*
- * myctime - This is like standard ctime()-function, but it zaps away
- *   the newline from the end of that string. Also, it takes
- *   the time value as parameter, instead of pointer to it.
- *   Note that it is necessary to copy the string to alternate
- *   buffer (who knows how ctime() implements it, maybe it statically
- *   has newline there and never 'refreshes' it -- zapping that
- *   might break things in other places...)
- *
- *
- * Thu Nov 24 18:22:48 1986 
- */
-const char *
-myctime(time_t value)
-{
-	static char buf[32];
-	char *p;
-
-	strcpy(buf, ctime(&value));
-	if((p = strchr(buf, '\n')) != NULL)
-		*p = '\0';
-	return buf;
-}
-
 
 /*
  * clean_string - clean up a string possibly containing garbage
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.