2 This program is free software; you can redistribute it and/or modify
3 it under the terms of the GNU General Public License as published by
4 the Free Software Foundation; either version 2 of the License, or
5 (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <jack/jack.h>
21 #include <jack/intclient.h>
24 main (int argc
, char *argv
[])
28 jack_client_t
*client
;
30 jack_intclient_t intclient
;
33 if ((argc
< 2) || (argc
> 3)) {
34 fprintf (stderr
, "usage: %s client-name [ server-name ]]\n",
39 /* use `basename $0` for my own client name */
40 my_name
= strrchr(argv
[0], '/');
47 /* first, become a JACK client */
49 client
= jack_client_open (my_name
,
50 (JackServerName
|JackNoStartServer
),
53 client
= jack_client_open (my_name
, JackNoStartServer
, &status
);
57 if (status
& JackServerFailed
) {
58 fprintf (stderr
, "JACK server not running.\n");
60 fprintf (stderr
, "JACK open failed, "
61 "status = 0x%2.0x\n", status
);
66 /* then, get the internal client handle */
67 client_name
= argv
[1];
68 intclient
= jack_internal_client_handle (client
, client_name
, &status
);
69 if (status
& JackFailure
) {
70 fprintf (stderr
, "client %s not found.\n", client_name
);
74 /* now, unload the internal client */
75 status
= jack_internal_client_unload (client
, intclient
);
76 if (status
& JackFailure
) {
77 if (status
& JackNoSuchClient
) {
78 fprintf (stderr
, "client %s is gone.\n",
81 fprintf (stderr
, "could not unload %s, "
82 "returns 0x%2.0x\n", client_name
, status
);
86 fprintf (stdout
, "%s unloaded.\n", client_name
);
89 jack_client_close(client
);