Selaa lähdekoodia

The ntk-console client command console_uptime should now not print negative numbers, And inet_sendto should now properly print ipv4 addresses in a human readable format.

MissValeska 9 vuotta sitten
vanhempi
commit
8bc5d69758
3 muutettua tiedostoa jossa 17 lisäystä ja 17 poistoa
  1. 5
    5
      src/inet.c
  2. 6
    6
      src/ntk-console.c
  3. 6
    6
      src/ntk-console.h

+ 5
- 5
src/inet.c Näytä tiedosto

1117
 						len-(len/2), flags, to, tolen);
1117
 						len-(len/2), flags, to, tolen);
1118
 			break;
1118
 			break;
1119
 		case EFAULT:
1119
 		case EFAULT:
1120
-			error("To Family is: %hu "
1121
-                                "To Data is: %%pNP "
1122
-                                "and: %s", to->sa_family, 
1123
-                                to->sa_data,
1124
-                                strerror(errno));
1120
+			error("Bad Address\n"
1121
+                                "To Family is: %hu "
1122
+                                "To Data is: %s", 
1123
+                                to->sa_family, 
1124
+                                inet_ntoa(  &(  ((struct sockaddr_in*)to)->sin_addr ) ));
1125
 		default:
1125
 		default:
1126
 			error("inet_sendto: Cannot send(): %s", strerror(errno));
1126
 			error("inet_sendto: Cannot send(): %s", strerror(errno));
1127
 			return err;
1127
 			return err;

+ 6
- 6
src/ntk-console.c Näytä tiedosto

179
 
179
 
180
 void console_uptime(void) {
180
 void console_uptime(void) {
181
     
181
     
182
-    int uptime_sec1;
183
-    int uptime_min1;
184
-    int uptime_hour1;
182
+    unsigned int uptime_sec1;
183
+    unsigned int uptime_min1;
184
+    unsigned int uptime_hour1;
185
     
185
     
186
-    int uptime_day1;
187
-    int uptime_month1;
188
-    int uptime_year1;
186
+    unsigned int uptime_day1;
187
+    unsigned int uptime_month1;
188
+    unsigned int uptime_year1;
189
     
189
     
190
     time(&rawtime);
190
     time(&rawtime);
191
     
191
     

+ 6
- 6
src/ntk-console.h Näytä tiedosto

31
 time_t rawtime;
31
 time_t rawtime;
32
 struct tm *timeinfo;
32
 struct tm *timeinfo;
33
 
33
 
34
-int uptime_sec;
35
-int uptime_min;
36
-int uptime_hour;
37
-int uptime_day;
38
-int uptime_month;
39
-int uptime_year;
34
+unsigned int uptime_sec;
35
+unsigned int uptime_min;
36
+unsigned int uptime_hour;
37
+unsigned int uptime_day;
38
+unsigned int uptime_month;
39
+unsigned int uptime_year;
40
 
40
 
41
 int i;
41
 int i;
42
 
42
 

Loading…
Peruuta
Tallenna