File tree Expand file tree Collapse file tree 5 files changed +83
-5
lines changed Expand file tree Collapse file tree 5 files changed +83
-5
lines changed Original file line number Diff line number Diff line change @@ -22,3 +22,24 @@ void print_cpu_info() {
22
22
printf ("Error opening /proc/cpuinfo\n" );
23
23
}
24
24
}
25
+
26
+ void print_full_cpu_info () {
27
+ printf (" ____________\n" );
28
+ printf ("|\n" );
29
+ printf ("| Full CPU Info:\n" );
30
+ printf ("|____________\n" );
31
+ printf ("|\n" );
32
+
33
+ FILE * cpu_file = fopen ("/proc/cpuinfo" , "r" );
34
+ if (cpu_file ) {
35
+ char line [128 ];
36
+ while (fgets (line , sizeof (line ), cpu_file )) {
37
+ printf ("| %s" , line );
38
+ }
39
+ fclose (cpu_file );
40
+ printf ("|____________\n\n" );
41
+ } else {
42
+ printf ("Error opening /proc/cpuinfo\n" );
43
+ }
44
+ }
45
+
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+
3
+ void print_err_info () {
4
+ printf ("Use spynix -h to display all valid options\n" );
5
+ }
6
+
7
+ void print_hlp_info () {
8
+ printf ("spynix v2.0.0\n \
9
+ Info:\n\t \
10
+ -h - show this menu\n\t \
11
+ -v - show version\n\n \
12
+ Options:\n\t \
13
+ -a - show summary info about system, cpu, ram and rom\n\t \
14
+ -sys - show system info\n\t \
15
+ -cpu - show short Central Process Unit info\n\t \
16
+ -ram - show Random Access Memory info\n\t \
17
+ -rom - show Read Only Memory info\n\n \
18
+ Advanced:\n\t \
19
+ -cpu -f - show full Central Process Unit info\n" );
20
+ }
21
+
22
+ void print_ver_info () {
23
+ printf ("spynix v2.0.0\n\nFor more info visit: https://github.com/git-user-cpp/spynix" );
24
+ }
Original file line number Diff line number Diff line change
1
+ #include <string.h>
1
2
#include "sys/sys_info.h"
2
3
#include "ram/ram_info.h"
3
4
#include "cpu/cpu_info.h"
4
5
#include "rom/rom_info.h"
6
+ #include "hlp/hlp_info.h"
5
7
6
- int main () {
7
- print_sys_info ();
8
- print_cpu_info ();
9
- print_ram_info ();
10
- print_rom_info ();
8
+ int main (int argc , char * * argv ) {
9
+ if (argc == 1 ) {
10
+ print_sys_info ();
11
+ print_cpu_info ();
12
+ print_ram_info ();
13
+ print_rom_info ();
14
+ } else if (argc == 2 ) {
15
+ if (strcmp (argv [1 ], "-h" ) == 0 ) {
16
+ print_hlp_info ();
17
+ } else if (strcmp (argv [1 ], "-a" ) == 0 ) {
18
+ print_sys_info ();
19
+ print_cpu_info ();
20
+ print_ram_info ();
21
+ print_rom_info ();
22
+ } else if (strcmp (argv [1 ], "-sys" ) == 0 ) {
23
+ print_sys_info ();
24
+ } else if (strcmp (argv [1 ], "-cpu" ) == 0 ) {
25
+ print_cpu_info ();
26
+ } else if (strcmp (argv [1 ], "-ram" ) == 0 ) {
27
+ print_ram_info ();
28
+ } else if (strcmp (argv [1 ], "-rom" ) == 0 ) {
29
+ print_rom_info ();
30
+ } else if (strcmp (argv [1 ], "-v" ) == 0 ) {
31
+ print_ver_info ();
32
+ } else {
33
+ print_err_info ();
34
+ }
35
+ } else if (argc == 3 ){
36
+ if ((strcmp (argv [1 ], "-cpu" ) == 0 ) && (strcmp (argv [2 ], "-f" ) == 0 )) {
37
+ print_full_cpu_info ();
38
+ } else {
39
+ print_err_info ();
40
+ }
41
+ } else {
42
+ print_err_info ();
43
+ }
11
44
12
45
return 0 ;
13
46
}
You can’t perform that action at this time.
0 commit comments