File: archdetect.c

package info (click to toggle)
hw-detect 1.142
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,664 kB
  • sloc: sh: 1,408; makefile: 103; perl: 102; ansic: 39
file content (48 lines) | stat: -rw-r--r-- 724 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>

#include <debian-installer/system/subarch.h>

static struct option long_options[] =
{
	{"guess", 0, 0, 0},
	{0, 0, 0, 0}
};

int main(int argc, char *argv[])
{
        const char *subarch;
        int guess = 0;

	while (1)
	{
		int option_index = 0;
		int c;

		c = getopt_long (argc, argv, "g", long_options,
				 &option_index);
		if (c == -1) break;

		switch (c)
		{
			case 'g':
				guess = 1;
				break;
			default:
				continue;
		}
	}

	if (guess)
		subarch = di_system_subarch_analyze_guess();
	else
		subarch = di_system_subarch_analyze();
	if (!subarch)
 		return EXIT_FAILURE;

	printf("%s/%s\n", CPU_TEXT, subarch);

	return 0;
}