您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xopen函数代码示例

51自学网 2021-06-03 11:50:29
  C++
这篇教程C++ xopen函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中xopen函数的典型用法代码示例。如果您正苦于以下问题:C++ xopen函数的具体用法?C++ xopen怎么用?C++ xopen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了xopen函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: setlogcons_main

int setlogcons_main(int argc UNUSED_PARAM, char **argv){	struct {		char fn;		char subarg;	} arg = { 11, /* redirect kernel messages */			  0   /* to specified console (current as default) */			};	if (argv[1])		arg.subarg = xatou_range(argv[1], 0, 63);	xioctl(xopen(VC_1, O_RDONLY), TIOCLINUX, &arg);	return EXIT_SUCCESS;}
开发者ID:593141477,项目名称:Learning-Linux,代码行数:16,


示例2: sendevent_main

void sendevent_main(void){  int fd = xopen(*toys.optargs, O_RDWR);  int version;  struct input_event ev;  if (ioctl(fd, EVIOCGVERSION, &version))    perror_exit("EVIOCGVERSION failed for %s", *toys.optargs);    memset(&ev, 0, sizeof(ev));  // TODO: error checking and support for named constants.  ev.type = atoi(toys.optargs[1]);  ev.code = atoi(toys.optargs[2]);  ev.value = atoi(toys.optargs[3]);  xwrite(fd, &ev, sizeof(ev));}
开发者ID:emaste,项目名称:toybox,代码行数:16,


示例3: main

int			main(int ac, char **av){	int		fd;	t_raw	raw;	t_data	data;	t_env	env;	read_args(&env, ac, av);	get_env(&env, av[1]);	fd = xopen(av[1], O_RDONLY);	raw = read_file(fd);	close(fd);	data = read_raw(raw);	display_data(data, env);	mlx_loop(env.mlx);	return (1);}
开发者ID:lgarczyn,项目名称:fdf,代码行数:17,


示例4: open_file_and_read_lines

static void open_file_and_read_lines(void){    if (filename) {        int fd = xopen(filename, O_RDONLY);        dup2(fd, 0);        if (fd) close(fd);    } else {        /* "less" with no arguments in argv[] */        /* For status line only */        filename = xstrdup(bb_msg_standard_input);    }    readpos = 0;    readeof = 0;    linepos = 0;    terminated = 1;    read_lines();}
开发者ID:OPSF,项目名称:uClinux,代码行数:17,


示例5: syslinux_execute

void syslinux_execute(void){	char *device, *diskdevice;	char *bootimages;	int fd;	if (strcmp(hashmapGetPrintf(ictx.opts, "none", BASE_BOOTLOADER),				"syslinux"))		return;	pr_info("Writing MBR");        diskdevice = xasprintf("/dev/block/%s",			hashmapGetPrintf(ictx.opts, NULL, BASE_INSTALL_DISK));	dd(SYSLINUX_MBR, diskdevice);        free(diskdevice);	/* SYSLINUX complains if this isn't done */	chmod("/tmp", 01777);	bootimages = hashmapGetPrintf(ictx.opts, NULL, BASE_BOOT_LIST);	device = hashmapGetPrintf(ictx.opts, NULL, "partition.bootloader:device");	pr_info("Installing ldlinux.sys onto %s", device);	do_install_syslinux(device);	/* In case we die() before we are finished */	signal(SIGABRT, sighandler);	mount_partition_device(device, "vfat", BOOTLOADER_PATH);	pr_info("Copying syslinux support files");	copy_file(IMAGES_PATH "vesamenu.c32", BOOTLOADER_PATH "vesamenu.c32");	copy_file(IMAGES_PATH "android.c32", BOOTLOADER_PATH "android.c32");	pr_info("Constructing syslinux.cfg");	/* Put the initial template stuff in */	copy_file(SYSLINUX_CFG_TEM_FN, SYSLINUX_CFG_FN);	fd = xopen(SYSLINUX_CFG_FN, O_WRONLY | O_APPEND);	put_string(fd, "menu androidcommand %s/n",		hashmapGetPrintf(ictx.opts, NULL, "partition.misc:index"));	string_list_iterate(bootimages, bootimage_cb, &fd);	xclose(fd);	umount(BOOTLOADER_PATH);	rmdir(BOOTLOADER_PATH);	signal(SIGABRT, SIG_DFL);	pr_info("SYSLINUX installation complete");}
开发者ID:quanganh2627,项目名称:platform_bootable_iago,代码行数:46,


示例6: build_code

static void build_code(char *str){  char *args[] = {"as", "--32", SFILE_WRITE, "-o", BFILE_WRITE, NULL};  Elf32_Ehdr  *aspElf_Header;  Elf32_Shdr  *aspElf_Shdr;  Elf32_Off   offset;  struct stat sts;  uint32_t    size;  int         status;  void        *map;  pid_t       pid;  int         fd;  del_files();  write_source_file(str);  pid = fork();  if (pid == 0)    {      execvp(args[0], args);      exit(EXIT_SUCCESS);    }  waitpid(pid, &status, 0);  if (stat(BFILE_WRITE, &sts) == -1)    exit(EXIT_FAILURE);  fd = xopen(BFILE_WRITE, O_RDONLY, 0644);  map = xmmap(0, sts.st_size, PROT_READ, MAP_SHARED, fd, 0);  aspElf_Header = map;  aspElf_Shdr = (Elf32_Shdr *)((char *)map + aspElf_Header->e_shoff);  offset = return_info_text(0, map, aspElf_Header, aspElf_Shdr);  size = return_info_text(1, map, aspElf_Header, aspElf_Shdr);  asm_mode.size = size;  asm_mode.opcode = xmalloc((size * sizeof(char)) + 1);  asm_mode.argument = str;  memcpy((char *)asm_mode.opcode, (char *)map + offset, asm_mode.size);  opcode_mode.flag = 1;  opcode_mode.size = asm_mode.size;  opcode_mode.opcode = asm_mode.opcode;  xclose(fd);  del_files();}
开发者ID:7h3rAm,项目名称:ROPgadget,代码行数:46,


示例7: watchdog_main

int watchdog_main(int argc, char **argv){	unsigned opts;	unsigned timer_duration = 30000; /* Userspace timer duration, in milliseconds */	char *t_arg;	opt_complementary = "=1"; /* must have 1 argument */	opts = getopt32(argv, "Ft:", &t_arg);	if (opts & OPT_TIMER) {		static const struct suffix_mult suffixes[] = {			{ "ms", 1 },			{ "", 1000 },			{ }		};		timer_duration = xatou_sfx(t_arg, suffixes);	}	if (!(opts & OPT_FOREGROUND)) {		bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv);	}	bb_signals(BB_FATAL_SIGS, watchdog_shutdown);	/* Use known fd # - avoid needing global 'int fd' */	xmove_fd(xopen(argv[argc - 1], O_WRONLY), 3);// TODO?//	if (!(opts & OPT_TIMER)) {//		if (ioctl(fd, WDIOC_GETTIMEOUT, &timer_duration) == 0)//			timer_duration *= 500;//		else//			timer_duration = 30000;//	}	while (1) {		/*		 * Make sure we clear the counter before sleeping, as the counter value		 * is undefined at this point -- PFM		 */		write(3, "", 1); /* write zero byte */		usleep(timer_duration * 1000L);	}	return EXIT_SUCCESS; /* - not reached, but gcc 4.2.1 is too dumb! */}
开发者ID:aYosukeAkatsuka,项目名称:edimax-br-6528n,代码行数:45,


示例8: nohup_main

int nohup_main(int argc, char **argv){	int nullfd;	const char *nohupout;	char *home = NULL;	xfunc_error_retval = 127;	if (argc < 2) bb_show_usage();	nullfd = xopen(bb_dev_null, O_WRONLY|O_APPEND);	/* If stdin is a tty, detach from it. */	if (isatty(STDIN_FILENO))		dup2(nullfd, STDIN_FILENO);	nohupout = "nohup.out";	/* Redirect stdout to nohup.out, either in "." or in "$HOME". */	if (isatty(STDOUT_FILENO)) {		close(STDOUT_FILENO);		if (open(nohupout, O_CREAT|O_WRONLY|O_APPEND, S_IRUSR|S_IWUSR) < 0) {			home = getenv("HOME");			if (home) {				nohupout = concat_path_file(home, nohupout);				xopen3(nohupout, O_CREAT|O_WRONLY|O_APPEND, S_IRUSR|S_IWUSR);			}		}	} else dup2(nullfd, STDOUT_FILENO);	/* If we have a tty on stderr, announce filename and redirect to stdout.	 * Else redirect to /dev/null.	 */	if (isatty(STDERR_FILENO)) {		bb_error_msg("appending to %s", nohupout);		dup2(STDOUT_FILENO, STDERR_FILENO);	} else dup2(nullfd, STDERR_FILENO);	if (nullfd > 2)		close(nullfd);	signal(SIGHUP, SIG_IGN);	BB_EXECVP(argv[1], argv+1);	if (ENABLE_FEATURE_CLEAN_UP && home)		free((char*)nohupout);	bb_simple_perror_msg_and_die(argv[1]);}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:45,


示例9: cmd_scalebranch

void cmd_scalebranch(){  int i;  int nodes_count;  FILE * out;  /* attempt to open output file */  out = opt_outfile ?          xopen(opt_outfile,"w") : stdout;  /* parse tree */  if (!opt_quiet)    fprintf(stdout, "Parsing tree file.../n");  rtree_t * rtree = rtree_parse_newick(opt_treefile);  if (!rtree)    fatal("Tree must be rooted...");  nodes_count = 2*rtree->leaves-1;  rtree_t ** nodes = (rtree_t **)xmalloc(nodes_count*sizeof(rtree_t *));  /* get all nodes */  rtree_query_tipnodes(rtree, nodes);  rtree_query_innernodes(rtree, nodes+rtree->leaves);  for (i=0; i < nodes_count; ++i)    nodes[i]->length *= opt_scalebranch_factor;    char * newick = rtree_export_newick(rtree);  fprintf(out, "%s/n", newick);  if (opt_outfile)    fclose(out);  free(newick);    /* deallocate tree structure */  rtree_destroy(rtree);  if (!opt_quiet)    fprintf(stdout, "/nDone.../n");}
开发者ID:xflouris,项目名称:newick-tools,代码行数:45,


示例10: main

int		main(int ac, char **av){  t_open	*opn;  t_list	*list;  if (ac == 1)    {      my_putstr("asm: fatal error: no input file/n");      my_putstr("Compilation terminated/n");      return (0);    }  else    {      struct_init(&opn, &list);      xopen(av[1], opn, list);    }  return (0);}
开发者ID:Ezirel,项目名称:Corewar,代码行数:18,


示例11: i2c_dev_open

/* * Opens the device file associated with given i2c bus. * * Upstream i2c-tools also support opening devices by i2c bus name * but we drop it here for size reduction. */static int i2c_dev_open(int i2cbus){	char filename[sizeof("/dev/i2c-%d") + sizeof(int)*3];	int fd;	sprintf(filename, "/dev/i2c-%d", i2cbus);	fd = open(filename, O_RDWR);	if (fd < 0) {		if (errno == ENOENT) {			filename[8] = '/'; /* change to "/dev/i2c/%d" */			fd = xopen(filename, O_RDWR);		} else {			bb_perror_msg_and_die("can't open '%s'", filename);		}	}	return fd;}
开发者ID:AlexShiLucky,项目名称:busybox,代码行数:24,


示例12: testDistrib

void testDistrib(){	float dd[1000]; memset(dd,0,sizeof(dd));	for(int i=0; i<profileLength; i++){		float xx=fProfile->get(i);		if(xx==NA) dd[0]++;		else{			float x=log(1+xx);			int k=(int)(x/10*1000)+1;			dd[k]++;		}	}	FILE *f=xopen("dstr","wt");	for(int i=0; i<1000; i++){		fprintf(f,"%5.2f/t%6f/n",i*10./1000.,dd[i]);	}	fclose(f);}
开发者ID:favorov,项目名称:stereogene,代码行数:18,


示例13: sizeof

bwa_seqio_t *bwa_bam_open(const char *fn, int which, char **saif,                          gap_opt_t *o0, bam_header_t **hh){    int c, b=0;    bwa_seqio_t *bs;    bam_header_t *h;    bs = (bwa_seqio_t*)calloc(1, sizeof(bwa_seqio_t));    bs->is_bam = 1;    bs->which = which;    bs->fp = (fn[0]!='-' || fn[1]) ? bam_open(fn, "r") : bam_dopen(0, "r") ;    h = bam_header_read(bs->fp);    if(hh) *hh=h;    else bam_header_destroy(h);    if( saif ) for(c=0; c!=3; ++c)        {            gap_opt_t opt;            if( saif[c] ) {                bs->sai[c] = xopen(saif[c], "r");                if( 1 > fread(&opt, sizeof(gap_opt_t), 1, bs->sai[c]) )                {                    fclose(bs->sai[c]);                    bs->sai[c] = 0;                }                opt.n_threads=o0->n_threads;                if(o0) {                    if(b) {                        opt.mode=o0->mode;                        if( memcmp(o0, &opt, sizeof(gap_opt_t)) ) {                            fprintf( stderr, "[bwa_bam_open] options from sai file /"%s/" conflict with others./n", saif[c] ) ;                            exit(1);                        }                        fprintf( stderr, "[bwa_bam_open] options from sai file /"%s/" match./n", saif[c] ) ;                    }                    else {                        fprintf( stderr, "[bwa_bam_open] recovered options from sai file /"%s/"./n", saif[c] ) ;                        memcpy(o0, &opt, sizeof(gap_opt_t));                        b=1;                    }                }            }        }    return bs;}
开发者ID:mpieva,项目名称:network-aware-bwa,代码行数:44,


示例14: write_ar_archive

static int write_ar_archive(archive_handle_t *handle){	struct stat st;	archive_handle_t *out_handle;	if (fstat(handle->src_fd, &st) == -1)		bb_simple_perror_msg_and_die(handle->ar__name);	/* if archive exists, create a new handle for output.	 * we create it in place of the old one.	 */	if (st.st_size != 0) {		out_handle = init_handle();		xunlink(handle->ar__name);		out_handle->src_fd = xopen(handle->ar__name, O_WRONLY | O_CREAT | O_TRUNC);		out_handle->accept = handle->accept;	} else {		out_handle = handle;	}	handle->ar__out = out_handle;	xwrite(out_handle->src_fd, AR_MAGIC "/n", AR_MAGIC_LEN + 1);	out_handle->offset += AR_MAGIC_LEN + 1;	/* skip to the end of the archive if we have to append stuff */	if (st.st_size != 0) {		handle->filter = filter_replaceable;		handle->action_data = copy_data;		unpack_ar_archive(handle);	}	while (write_ar_header(out_handle) == 0)		continue;	/* optional, since we exit right after we return */	if (ENABLE_FEATURE_CLEAN_UP) {		close(handle->src_fd);		if (out_handle->src_fd != handle->src_fd)			close(out_handle->src_fd);	}	return EXIT_SUCCESS;}
开发者ID:Ayyayay,项目名称:busybox,代码行数:44,


示例15: daemonize

static int daemonize(void){	int fd;	int pid = fork();	if (pid < 0) /* error */		return -errno;	if (pid > 0) /* parent */		return 0;	/* child */	fd = xopen(bb_dev_null, O_RDWR);	dup2(fd, 0);	dup2(fd, 1);	dup2(fd, 2);	while (fd > 2) close(fd--);	setsid();	openlog(applet_name, LOG_PID, LOG_DAEMON);	logmode = LOGMODE_SYSLOG;	return 1;}
开发者ID:AlickHill,项目名称:Lantern,代码行数:19,


示例16: uuencode_main

int uuencode_main(int argc UNUSED_PARAM, char **argv){	struct stat stat_buf;	int src_fd = STDIN_FILENO;	const char *tbl;	mode_t mode;	char src_buf[SRC_BUF_SIZE];	char dst_buf[DST_BUF_SIZE + 1];	tbl = bb_uuenc_tbl_std;	mode = 0666 & ~umask(0666);	opt_complementary = "-1:?2"; /* must have 1 or 2 args */	if (getopt32(argv, "m")) {		tbl = bb_uuenc_tbl_base64;	}	argv += optind;	if (argv[1]) {		src_fd = xopen(*argv, O_RDONLY);		fstat(src_fd, &stat_buf);		mode = stat_buf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);		argv++;	}	printf("begin%s %o %s", tbl == bb_uuenc_tbl_std ? "" : "-base64", mode, *argv);	while (1) {		size_t size = full_read(src_fd, src_buf, SRC_BUF_SIZE);		if (!size)			break;		if ((ssize_t)size < 0)			bb_perror_msg_and_die(bb_msg_read_error);		/* Encode the buffer we just read in */		bb_uuencode(dst_buf, src_buf, size, tbl);		bb_putchar('/n');		if (tbl == bb_uuenc_tbl_std) {			bb_putchar(tbl[size]);		}		fflush(stdout);		xwrite(STDOUT_FILENO, dst_buf, 4 * ((size + 2) / 3));	}	printf(tbl == bb_uuenc_tbl_std ? "/n`/nend/n" : "/n====/n");	fflush_stdout_and_exit(EXIT_SUCCESS);}
开发者ID:0xD34D,项目名称:android_external_busybox,代码行数:43,


示例17: do_test

static intdo_test (void){  char *tempfile;  int fd;  /* Create a temporary file and open it in read-only mode.  */  TEST_VERIFY_EXIT (create_temp_file ("tst-bz11319", &tempfile));  fd = xopen (tempfile, O_RDONLY, 0660);  /* Try and write to the temporary file to intentionally fail, then     check that dprintf (or __dprintf_chk) return EOF.  */  TEST_COMPARE (dprintf (fd, "%d", 0), EOF);  xclose (fd);  free (tempfile);  return 0;}
开发者ID:bminor,项目名称:glibc,代码行数:19,


示例18: init

/* use `x_foo' names to avoid colliding with similarly named global * variables */voidinit(int x_startlab, int x_keep_comments, const char *x_filename){    FILE *x_infile;    x_infile = xopen(x_filename, IO_MODE_READ, fatal);    if (STREQ(x_filename, "-"))        x_filename = "(stdin)"; /* this is clearer in error messages */    inclevel = 0;               /* count of inclusion levels */    lineno[0] = 1;              /* line count of first file */    filename[0] = x_filename;   /* filename of first file */    infile[0] = x_infile;       /* file handle of first file */    keep_comments = x_keep_comments;    current_subprogram_name[0] = EOS;    current_subprogram_type = SUBPRG_NONE;    reading_parenthesized_macro_definition = false;    set_starting_label(x_startlab);}
开发者ID:slattarini,项目名称:ratfor,代码行数:21,


示例19: readall

/* file utilities */static uint8_t *readall(const char *filename, unsigned long long *msglenp){	unsigned long long msglen = 0;	uint8_t *msg = NULL;	struct stat sb;	ssize_t x, space;	int fd;	const unsigned long long maxmsgsize = 1UL << 30;	fd = xopen(filename, O_RDONLY | O_NOFOLLOW, 0);	if (fstat(fd, &sb) == 0 && S_ISREG(sb.st_mode)) {		if (sb.st_size > maxmsgsize)			errx(1, "msg too large in %s", filename);		space = sb.st_size + 1;	} else {		space = 64 * 1024;	}	msg = xmalloc(space + 1);	while (1) {		if (space == 0) {			if (msglen * 2 > maxmsgsize)				errx(1, "msg too large in %s", filename);			space = msglen;			if (!(msg = realloc(msg, msglen + space + 1)))				errx(1, "realloc");		}		if ((x = read(fd, msg + msglen, space)) == -1)			err(1, "read from %s", filename);		if (x == 0)			break;		space -= x;		msglen += x;	}	msg[msglen] = 0;	close(fd);	*msglenp = msglen;	return msg;}
开发者ID:jwilkins,项目名称:reop,代码行数:43,


示例20: writekeyfile

/* * can write a few different file types */static voidwritekeyfile(const char *filename, const char *info, const void *key,    size_t keylen, const char *ident, int oflags, mode_t mode){	char header[1024];	char b64[1024];	int fd;	fd = xopen(filename, O_CREAT|oflags|O_NOFOLLOW|O_WRONLY, mode);	snprintf(header, sizeof(header), "-----BEGIN REOP %s-----/nident:%s/n",	    info, ident);	writeall(fd, header, strlen(header), filename);	if (b64_ntop(key, keylen, b64, sizeof(b64)) == -1)		errx(1, "b64 encode failed");	writeb64data(fd, filename, b64);	explicit_bzero(b64, sizeof(b64));	snprintf(header, sizeof(header), "-----END REOP %s-----/n", info);	writeall(fd, header, strlen(header), filename);	close(fd);}
开发者ID:jwilkins,项目名称:reop,代码行数:23,


示例21: if

t_history *history_create_list(t_config *config, t_history **history){  int		fd;  char		*tmp;  int		id_command;  int		flag;  id_command = 0;  if ((fd = xopen(".history", O_RDONLY, 0, NO)) != -1)    while ((tmp = get_next_line(fd)))      {	if ((flag = history_fill_list(history, tmp, fd, id_command)) == -1)	  return (NULL);	else if (flag == 1)	  return (history_list_config(config, *history, 0));	id_command++;      }  close(fd);  return (history_list_config(config, *history, 0));}
开发者ID:Frozenhorns,项目名称:project,代码行数:20,


示例22: my_script_command

int	my_script_command(char *command){  int	fd_file;  char	buff[512];  time_t	date;  fd_file = xopen("typescript", O_WRONLY | O_CREAT | O_TRUNC, 0644);  printf("Script started, file is typescript/n");  time(&date);  strcpy(buff, "Script started on ");  strcat(buff, ctime(&date));  xwrite(fd_file, buff, strlen(buff));  exec_command(command);  printf("Script done, file is typescript/n");  strcpy(buff, "Script done on ");  strcat(buff, ctime(&date));  xwrite(fd_file, buff, strlen(buff));  xclose(fd_file);  return (EXIT_SUCCESS);}
开发者ID:syrus44,项目名称:my_script,代码行数:20,


示例23: init_object

void	init_object(t_env *raytracer, const char *file){  int	elem;  char	*tmp;  int	i;  elem = xopen(file, O_RDONLY);  while ((tmp = get_next_line(elem)))    {      i = -1;      while (++i < MAX && my_strncmp(tmp, functions[i].object_name, my_strlen(functions[i].object_name)) != 1);      if (i < MAX)	push_front(&(raytracer->objects[i]), (*(functions[i].init_func))(tmp));      else if (my_strncmp(tmp, "camera", 6) != 0)	init_cam(&raytracer->camera, tmp);      else if (my_strncmp(tmp, "plan", 4) != 0)	init_plan(&raytracer->plan, tmp);      printf("%s/n", tmp);    }}
开发者ID:SkeneZr,项目名称:Raytracer,代码行数:20,


示例24: write_source_file

static void write_source_file(char *str){  int fd;  int i;  i = 0;  fd = xopen(SFILE_WRITE, O_WRONLY | O_CREAT | O_APPEND, 0755);  if (syntaxins.type == INTEL)    write(fd, ".intel_syntax noprefix/n", 23);  while (str[i] != '/0')    {      if (str[i] == ';')        write(fd, "/n", 1);      else        write(fd, &str[i], 1);      i++;    }  write(fd, "/n", 1);  xclose(fd);}
开发者ID:7h3rAm,项目名称:ROPgadget,代码行数:20,


示例25: xgetpass

static char *xgetpass(const char *prm){    static struct strbuf pass; /* = strbuf_INIT; */    int fd;    sigset_t oset, set;    struct sigaction sa, osa;    sa.sa_handler = SIG_IGN;    sigemptyset(&sa.sa_mask);    sa.sa_flags = 0;    (void)sigaction(SIGINT, &sa, &osa);    sigemptyset(&set);    sigaddset(&set, SIGINT);    (void)sigprocmask(SIG_UNBLOCK, &set, &oset);    cleanup_push(&osa, sigint_cleanup);    cleanup_push(&oset, sigprocmask_cleanup);    (void) Rawmode();	/* Make sure, cause we want echo off */    fd = xopen("/dev/tty", O_RDWR|O_LARGEFILE);    if (fd == -1)	fd = SHIN;    else	cleanup_push(&fd, open_cleanup);    xprintf("%s", prm); flush();    pass.len = 0;    for (;;)  {	char c;	if (xread(fd, &c, 1) < 1 || c == '/n') 	    break;	strbuf_append1(&pass, c);    }    strbuf_terminate(&pass);    cleanup_until(&osa);    return pass.s;}
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:41,


示例26: cmd_extract_rtips

void cmd_extract_rtips(){  unsigned int i;  FILE * out;  /* attempt to open output file */  out = opt_outfile ?          xopen(opt_outfile,"w") : stdout;  /* parse tree */  if (!opt_quiet)    fprintf(stdout, "Parsing tree file.../n");  rtree_t * rtree = rtree_parse_newick(opt_treefile);  if (!rtree)    fatal("Tree must be rooted...");    if (!opt_quiet)    fprintf(out,"Tip labels for left subtree:/n");  /* allocate list of tip nodes in left subtree */  rtree_t ** node_list = (rtree_t **)calloc(rtree->right->leaves,                                            sizeof(rtree_t *));   rtree_query_tipnodes(rtree->right, node_list);  /* print tip-node labels */  for (i = 0; i < rtree->right->leaves; ++i)    fprintf(out, "%s/n", node_list[i]->label);  /* deallocate tree structure */  rtree_destroy(rtree);  free(node_list);  if (opt_outfile)    fclose(out);  if (!opt_quiet)    fprintf(stdout, "/nDone.../n");}
开发者ID:xflouris,项目名称:newick-tools,代码行数:41,


示例27: rpm2cpio_main

int rpm2cpio_main(int argc UNUSED_PARAM, char **argv){	struct rpm_lead lead;	unsigned pos;	if (argv[1]) {		xmove_fd(xopen(argv[1], O_RDONLY), rpm_fd);	}	xread(rpm_fd, &lead, sizeof(lead));	/* Just check the magic, the rest is irrelevant */	if (lead.magic != htonl(RPM_LEAD_MAGIC)) {		bb_error_msg_and_die("invalid RPM magic");	}	/* Skip the signature header, align to 8 bytes */	pos = skip_header();	seek_by_jump(rpm_fd, (-(int)pos) & 7);	/* Skip the main header */	skip_header();	//if (SEAMLESS_COMPRESSION)	//	/* We need to know whether child (gzip/bzip/etc) exits abnormally */	//	signal(SIGCHLD, check_errors_in_children);	/* This works, but doesn't report uncompress errors (they happen in child) */	setup_unzip_on_fd(rpm_fd, /*fail_if_not_compressed:*/ 1);	if (bb_copyfd_eof(rpm_fd, STDOUT_FILENO) < 0)		bb_error_msg_and_die("error unpacking");	if (ENABLE_FEATURE_CLEAN_UP) {		close(rpm_fd);	}	if (SEAMLESS_COMPRESSION) {		check_errors_in_children(0);		return bb_got_signal;	}	return EXIT_SUCCESS;}
开发者ID:AlexShiLucky,项目名称:busybox,代码行数:41,



注:本文中的xopen函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ xor函数代码示例
C++ xo_emit函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。