2 This file is part of PulseAudio.
4 Copyright 2004-2006 Lennart Poettering
5 Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
7 PulseAudio is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published
9 by the Free Software Foundation; either version 2.1 of the License,
10 or (at your option) any later version.
12 PulseAudio is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public License
18 along with PulseAudio; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
32 #include <pulse/util.h>
33 #include <pulse/i18n.h>
35 #include <pulsecore/modinfo.h>
36 #include <pulsecore/core-util.h>
37 #include <pulsecore/macro.h>
39 #include "dumpmodules.h"
41 #define PREFIX "module-"
43 static void short_info(const char *name
, const char *path
, pa_modinfo
*i
) {
47 printf("%-40s%s\n", name
, i
->description
? i
->description
: "n/a");
50 static void long_info(const char *name
, const char *path
, pa_modinfo
*i
) {
60 printf(_("Name: %s\n"), name
);
62 if (!i
->description
&& !i
->version
&& !i
->author
&& !i
->usage
)
63 printf(_("No module information available\n"));
66 printf(_("Version: %s\n"), i
->version
);
68 printf(_("Description: %s\n"), i
->description
);
70 printf(_("Author: %s\n"), i
->author
);
72 printf(_("Usage: %s\n"), i
->usage
);
73 printf(_("Load Once: %s\n"), pa_yes_no(i
->load_once
));
75 printf(_("DEPRECATION WARNING: %s\n"), i
->deprecated
);
79 printf(_("Path: %s\n"), path
);
82 static void show_info(const char *name
, const char *path
, void (*info
)(const char *name
, const char *path
, pa_modinfo
*i
)) {
87 if ((i
= pa_modinfo_get_by_name(path
? path
: name
))) {
93 extern const lt_dlsymlist lt_preloaded_symbols
[];
95 static int is_preloaded(const char *name
) {
96 const lt_dlsymlist
*l
;
98 for (l
= lt_preloaded_symbols
; l
->name
; l
++) {
104 pa_snprintf(buf
, sizeof(buf
), "%s", l
->name
);
105 if ((e
= strrchr(buf
, '.')))
108 if (!strcmp(name
, buf
))
115 static int callback(const char *path
, lt_ptr data
) {
117 pa_daemon_conf
*c
= (data
);
119 e
= pa_path_get_filename(path
);
121 if (strlen(e
) <= sizeof(PREFIX
)-1 || strncmp(e
, PREFIX
, sizeof(PREFIX
)-1))
127 show_info(e
, path
, c
->log_level
>= PA_LOG_INFO
? long_info
: short_info
);
131 void pa_dump_modules(pa_daemon_conf
*c
, int argc
, char * const argv
[]) {
136 for (i
= 0; i
< argc
; i
++)
137 show_info(argv
[i
], NULL
, long_info
);
139 const lt_dlsymlist
*l
;
141 for (l
= lt_preloaded_symbols
; l
->name
; l
++) {
147 if (strlen(l
->name
) <= sizeof(PREFIX
)-1 || strncmp(l
->name
, PREFIX
, sizeof(PREFIX
)-1))
150 pa_snprintf(buf
, sizeof(buf
), "%s", l
->name
);
151 if ((e
= strrchr(buf
, '.')))
154 show_info(buf
, NULL
, c
->log_level
>= PA_LOG_INFO
? long_info
: short_info
);
157 lt_dlforeachfile(NULL
, callback
, c
);