1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2001 Silicon Graphics, Inc.
12 /*---------------------------------------------------------------------------
14 Test program used to test the DMAPI function create_userevent(). The
17 create_userevent [-s sid] string
19 where string is the msgdata to be stored in the event.
20 sid is the session ID to use for the event.
22 ----------------------------------------------------------------------------*/
25 extern char *sys_errlist[];
36 fprintf(stderr, "usage:\t%s [-s sid] string\n", Progname);
46 dm_sessid_t sid = DM_NO_SESSION;
52 Progname = strrchr(argv[0], '/');
59 /* Crack and validate the command line options. */
61 while ((opt = getopt(argc, argv, "s:")) != EOF) {
70 if (optind + 1 != argc)
72 string = argv[optind++];
74 if (dm_init_service(&name) == -1) {
75 fprintf(stderr, "Can't initialize the DMAPI\n");
78 if (sid == DM_NO_SESSION)
79 find_test_session(&sid);
81 if (dm_create_userevent(sid, strlen(string)+ 1, string, &token)) {
82 fprintf(stderr, "dm_create_userevent failed, %s\n",
87 fprintf(stdout, "New token %d\n", token);