summaryrefslogtreecommitdiffstats
path: root/utils/moddeps.c
blob: 7905d93e60371fcbb9d04f64834e0e8eb980e78e (plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include <popt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/utsname.h>

#include "../isys/isys.h"
#include "modules.h"

void setFloppyDevice(int flags) {
}

char *translateString(char *str) {
	return NULL;
}

int extractModules(int location, char * modName) {
    return 0;
}

void scsiWindow(const char * foo) {
}

void startNewt(int flags) {
}

void newtPopWindow(void) {
}

void newtWinChoice(void) {
}

void newtWinMessage(void) {
}

void eject(void) {
}

void winStatus(void) {
}

int main(int argc, char ** argv) {
    poptContext optCon;
    char * modDepsFile = NULL;
    char * mod;
    int rc;
    char ** list, ** l;
    struct utsname ut;
    moduleDeps ml;
    struct poptOption optionTable[] = {
	    { "moddeps", 'm', POPT_ARG_STRING, &modDepsFile, 0 },
	    POPT_AUTOHELP
	    { 0, 0, 0, 0, 0 }
    };

    optCon = poptGetContext(NULL, argc, (const char **) argv, optionTable, 0);

    if ((rc = poptGetNextOpt(optCon)) < -1) {
	fprintf(stderr, "bad option %s: %s\n",
		       poptBadOption(optCon, POPT_BADOPTION_NOALIAS), 
		       poptStrerror(rc));
	exit(1);
    }

    if (!modDepsFile) {
        modDepsFile = malloc(100);
	uname(&ut);
	sprintf(modDepsFile, "/lib/modules/%s/modules.dep",
		ut.release);
    }

    ml = mlNewDeps();
    if (mlLoadDeps(&ml, modDepsFile)) {
        fprintf(stderr, "Failed to read %s\n", modDepsFile);
	exit(1);
    }

    while ((mod = (char *) poptGetArg(optCon))) {
        list = mlGetDeps(ml, mod);
	if (list) {
	    for (l = list; *l; l++)
	        printf("%s%s", l == list ? "" : " ", *l);
	    printf("\n");
	}
    }

    return 0;
}

void logMessage(const char * s, ...) {
}