1 /* 2 * Copyright (c) 2014 Fujitsu Ltd. 3 * Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com> 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of version 2 of the GNU General Public License as 7 * published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope that it would be useful, but 10 * WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 * 13 * You should have received a copy of the GNU General Public License along 14 * with this program. 15 */ 16 17 #include <stdio.h> 18 #include <stdlib.h> 19 #include <string.h> 20 #include <errno.h> 21 #include <unistd.h> 22 23 int main(int argc, char **argv) 24 { 25 int ret; 26 int fd; 27 28 if (argc != 2) { 29 fprintf(stderr, "Only two arguments: %s <fd>\n", argv[0]); 30 exit(1); 31 } 32 33 fd = atoi(argv[1]); 34 ret = write(fd, argv[1], strlen(argv[1])); 35 36 return ret != -1; 37 } 38