2 * Copyright (c) 2000-2001 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #include <sys/types.h>
26 #include <lib/dmport.h>
33 /*---------------------------------------------------------------------------
35 Test program used to test the DMAPI function send_msg().
38 send_msg [-a] [-s sid] string
40 where string is the msgdata to be stored in the event.
41 sid is the session ID to use for the event.
43 ----------------------------------------------------------------------------*/
46 extern char *sys_errlist[];
57 fprintf(stderr, "usage:\t%s [-a] [-s sid] string\n", Progname);
67 dm_sessid_t sid = DM_NO_SESSION;
71 dm_msgtype_t msgtype = DM_MSGTYPE_SYNC;
73 Progname = strrchr(argv[0], '/');
80 /* Crack and validate the command line options. */
82 while ((opt = getopt(argc, argv, "as:")) != EOF) {
85 msgtype = DM_MSGTYPE_ASYNC;
94 if (optind + 1 != argc)
96 string = argv[optind++];
98 if (dm_init_service(&name) == -1) {
99 fprintf(stderr, "Can't initialize the DMAPI\n");
103 if (sid == DM_NO_SESSION)
104 find_test_session(&sid);
106 if (dm_send_msg(sid, msgtype, strlen(string)+ 1, string)) {
107 fprintf(stderr, "dm_send_msg failed, %s\n",