1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2001 Silicon Graphics, Inc.
14 #include <lib/dmport.h>
21 /*---------------------------------------------------------------------------
23 Test program used to test the DMAPI function send_msg().
26 send_msg [-a] [-s sid] string
28 where string is the msgdata to be stored in the event.
29 sid is the session ID to use for the event.
31 ----------------------------------------------------------------------------*/
34 extern char *sys_errlist[];
45 fprintf(stderr, "usage:\t%s [-a] [-s sid] string\n", Progname);
55 dm_sessid_t sid = DM_NO_SESSION;
59 dm_msgtype_t msgtype = DM_MSGTYPE_SYNC;
61 Progname = strrchr(argv[0], '/');
68 /* Crack and validate the command line options. */
70 while ((opt = getopt(argc, argv, "as:")) != EOF) {
73 msgtype = DM_MSGTYPE_ASYNC;
82 if (optind + 1 != argc)
84 string = argv[optind++];
86 if (dm_init_service(&name) == -1) {
87 fprintf(stderr, "Can't initialize the DMAPI\n");
91 if (sid == DM_NO_SESSION)
92 find_test_session(&sid);
94 if (dm_send_msg(sid, msgtype, strlen(string)+ 1, string)) {
95 fprintf(stderr, "dm_send_msg failed, %s\n",