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
24 /*---------------------------------------------------------------------------
26 Test program used to test the DMAPI function create_userevent(). The
29 create_userevent [-s sid] string
31 where string is the msgdata to be stored in the event.
32 sid is the session ID to use for the event.
34 ----------------------------------------------------------------------------*/
37 extern char *sys_errlist[];
48 fprintf(stderr, "usage:\t%s [-s sid] string\n", Progname);
58 dm_sessid_t sid = DM_NO_SESSION;
64 Progname = strrchr(argv[0], '/');
71 /* Crack and validate the command line options. */
73 while ((opt = getopt(argc, argv, "s:")) != EOF) {
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");
90 if (sid == DM_NO_SESSION)
91 find_test_session(&sid);
93 if (dm_create_userevent(sid, strlen(string)+ 1, string, &token)) {
94 fprintf(stderr, "dm_create_userevent failed, %s\n",
99 fprintf(stdout, "New token %d\n", token);