[mw-devel] MW3 r1321 - trunk/src

psycodom at sucs.org psycodom at sucs.org
Sun Jan 13 16:15:46 GMT 2013


Author: psycodom
Date: 2013-01-13 16:15:45 +0000 (Sun, 13 Jan 2013)
New Revision: 1321

Modified:
   trunk/src/user.c
Log:
reverts the various listuser functions to a method of printing logout date that works and doesn't print the date as 1875/6 but without falling foul of the shadow warnings

fixes #62



Modified: trunk/src/user.c
===================================================================
--- trunk/src/user.c	2012-12-30 19:25:33 UTC (rev 1320)
+++ trunk/src/user.c	2013-01-13 16:15:45 UTC (rev 1321)
@@ -377,19 +377,21 @@
 	char stats[10],gr[10];
 	int linecount=0;
 	int screen_height = screen_h();
-	
+	long logout_time;
+		
 	file=openuserfile(O_RDONLY);
 	while (get_person(file,&usr))
 	{
 		if (!newonly || ( newonly && !u_reg(usr.status) ) )
 		{
+			logout_time=usr.lastlogout;
 			show_user_stats(usr.status,stats,true);
 			show_fold_groups(usr.groups,gr,true);
 			if (!u_del(usr.status))
 			{
 				linecount++;
 				printf("%*s [%5s] [%8s] %s", NAMESIZE, usr.name,
-				     stats, gr, ctime((time_t*)&usr.lastlogout));
+				     stats, gr, ctime(&logout_time));
 				if (linecount>=(screen_height-1))
 				{
 					char foo[6];
@@ -414,19 +416,21 @@
 	char stats[10],gr[10];
 	int linecount=0;
 	int screen_height = screen_h();
+	long logout_time;
 	
 	file=openuserfile(O_RDONLY);
 	while (get_person(file,&usr))
 	{
 		if (usr.lastlogout>date)
 		{
+			logout_time = usr.lastlogout;
 			show_user_stats(usr.status,stats,true);
 			show_fold_groups(usr.groups,gr,true);
 			if (!u_del(usr.status))
 			{
 				linecount++;
 				printf("%*s [%5s] [%8s] %s", NAMESIZE, usr.name,
-				      stats, gr, ctime((time_t*)&usr.lastlogout));
+				      stats, gr, ctime(&logout_time));
 				if (linecount>=(screen_height-1))
 				{
 					char foo[6];
@@ -453,6 +457,7 @@
 	char stats[10],gr[10],spec[20],cmodes[20],cprivs[20],prot[10];
 	int linecount=0;
 	int check=0;
+	long logout_time;
 	int screen_height=screen_h();
 	
 	file=openuserfile(O_RDONLY);
@@ -475,6 +480,7 @@
 		check=check&flags;
 		if (inv?check==0:check!=0)
 		{
+			logout_time=usr.lastlogout;
 			show_user_stats(usr.status,stats,true);
 			show_special(usr.special,spec,true);
 			show_fold_groups(usr.groups,gr,true);
@@ -488,10 +494,10 @@
 				
 				if (type < 3)
 					printf("%*s [%s] [%s] [%s] %s", NAMESIZE, usr.name,
-					  stats, spec, gr, ctime((time_t*)&usr.lastlogout));
+					  stats, spec, gr, ctime(&logout_time));
 				else
 					printf("%*s [%s] [%s] [%s] %s", NAMESIZE, usr.name, cmodes,
-					     cprivs, prot, ctime((time_t*)&usr.lastlogout));
+					     cprivs, prot, ctime(&logout_time));
 
 				if (linecount>=(screen_height-1))
 				{




More information about the mw-devel mailing list