1 /* 2 * This file and its contents are supplied under the terms of the 3 * Common Development and Distribution License ("CDDL"), version 1.0. 4 * You may only use this file in accordance with the terms of version 5 * 1.0 of the CDDL. 6 * 7 * A full copy of the text of the CDDL should have accompanied this 8 * source. A copy of the CDDL is also available via the Internet at 9 * http://www.illumos.org/license/CDDL. 10 */ 11 12 /* 13 * Copyright 2013 Damian Bogel. All rights reserved. 14 */ 15 16 /* 17 * Command used to control the fsd pseudo-device driver. 18 */ 19 20 21 #include <errno.h> 22 #include <fcntl.h> 23 #include <libfsd.h> 24 #include <stdio.h> 25 #include <string.h> 26 #include <stropts.h> 27 #include <sys/stat.h> 28 #include <sys/types.h> 29 #include <unistd.h> 30 31 /* 32 * TODO 33 * - lint says that that fsd_open() is used but not defined 34 * - print proper error message 35 */ 36 37 int 38 main(int argc, char *argv[]) 39 { 40 int fd; 41 if (argc != 2) { 42 (void) fprintf(stderr, "Usage: %s message\n", argv[0]); 43 return (EINVAL); 44 } 45 46 fd = fsd_open(); 47 if (fd == INVALID_FSD_HANDLE) { 48 (void) fprintf(stderr, "Error: Something gone wrong."); 49 return (-1); /* TODO */ 50 } 51 fsd_print_msg(argv[1], fd); 52 fsd_close(fd); 53 return (0); 54 }