⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 远程桌面连接工具
💻 C
📖 第 1 页 / 共 2 页
字号:
#ifdef USGISH/*  should really reset SIGINT to SIG_IGN if it was.  */#ifdef SIGHUP	signal (SIGHUP, catch);#endif	signal (SIGINT, catch);#ifdef SIGQUIT	signal (SIGQUIT, catch);#endif	signal (SIGILL, catch);#ifdef SIGBUS	signal (SIGBUS, catch);#endif	signal (SIGSEGV, catch);#ifdef SIGSYS	signal (SIGSYS, catch);#endif#else	sig_act.sa_handler = catch;#ifdef _POSIX_SOURCE	sigemptyset(&sig_act.sa_mask);	sigaddset(&sig_act.sa_mask, SIGINT);	sigaddset(&sig_act.sa_mask, SIGQUIT);#ifdef SIGBUS	sigaddset(&sig_act.sa_mask, SIGBUS);#endif	sigaddset(&sig_act.sa_mask, SIGILL);	sigaddset(&sig_act.sa_mask, SIGSEGV);	sigaddset(&sig_act.sa_mask, SIGHUP);	sigaddset(&sig_act.sa_mask, SIGPIPE);#ifdef SIGSYS	sigaddset(&sig_act.sa_mask, SIGSYS);#endif#else	sig_act.sa_mask = ((1<<(SIGINT -1))			   |(1<<(SIGQUIT-1))#ifdef SIGBUS			   |(1<<(SIGBUS-1))#endif			   |(1<<(SIGILL-1))			   |(1<<(SIGSEGV-1))			   |(1<<(SIGHUP-1))			   |(1<<(SIGPIPE-1))#ifdef SIGSYS			   |(1<<(SIGSYS-1))#endif			   );#endif /* _POSIX_SOURCE */	sig_act.sa_flags = 0;	sigaction(SIGHUP, &sig_act, (struct sigaction *)0);	sigaction(SIGINT, &sig_act, (struct sigaction *)0);	sigaction(SIGQUIT, &sig_act, (struct sigaction *)0);	sigaction(SIGILL, &sig_act, (struct sigaction *)0);#ifdef SIGBUS	sigaction(SIGBUS, &sig_act, (struct sigaction *)0);#endif	sigaction(SIGSEGV, &sig_act, (struct sigaction *)0);#ifdef SIGSYS	sigaction(SIGSYS, &sig_act, (struct sigaction *)0);#endif#endif /* USGISH */	/*	 * now peruse through the list of files.	 */	for(fp=filelist; *fp; fp++) {		filecontent = getfile(*fp);		ip = newinclude(*fp, (char *)NULL);		find_includes(filecontent, ip, ip, 0, FALSE);		freefile(filecontent);		recursive_pr_include(ip, ip->i_file, base_name(*fp));		inc_clean();	}	if (printed)		printf("\n");	exit(0);}#ifdef __EMX__/* * eliminate \r chars from file */static int elim_cr(char *buf, int sz){	int i,wp;	for (i= wp = 0; i<sz; i++) {		if (buf[i] != '\r')			buf[wp++] = buf[i];	}	return wp;}#endifstruct filepointer *getfile(file)	char	*file;{	register int	fd;	struct filepointer	*content;	struct stat	st;	content = (struct filepointer *)malloc(sizeof(struct filepointer));	if ((fd = open(file, O_RDONLY)) < 0) {		warning("cannot open \"%s\"\n", file);		content->f_p = content->f_base = content->f_end = (char *)malloc(1);		*content->f_p = '\0';		return(content);	}	fstat(fd, &st);	content->f_base = (char *)malloc(st.st_size+1);	if (content->f_base == NULL)		fatalerr("cannot allocate mem\n");	if ((st.st_size = read(fd, content->f_base, st.st_size)) < 0)		fatalerr("failed to read %s\n", file);#ifdef __EMX__	st.st_size = elim_cr(content->f_base,st.st_size);#endif	close(fd);	content->f_len = st.st_size+1;	content->f_p = content->f_base;	content->f_end = content->f_base + st.st_size;	*content->f_end = '\0';	content->f_line = 0;	return(content);}voidfreefile(fp)	struct filepointer	*fp;{	free(fp->f_base);	free(fp);}char *copy(str)	register char	*str;{	register char	*p = (char *)malloc(strlen(str) + 1);	strcpy(p, str);	return(p);}match(str, list)	register char	*str, **list;{	register int	i;	for (i=0; *list; i++, list++)		if (strcmp(str, *list) == 0)			return(i);	return(-1);}/* * Get the next line.  We only return lines beginning with '#' since that * is all this program is ever interested in. */char *x_getline(filep)	register struct filepointer	*filep;{	register char	*p,	/* walking pointer */			*eof,	/* end of file pointer */			*bol;	/* beginning of line pointer */	register int	lineno;	/* line number */	p = filep->f_p;	eof = filep->f_end;	if (p >= eof)		return((char *)NULL);	lineno = filep->f_line;	for(bol = p--; ++p < eof; ) {		if (*p == '/' && *(p+1) == '*') { /* consume comments */			*p++ = ' ', *p++ = ' ';			while (*p) {				if (*p == '*' && *(p+1) == '/') {					*p++ = ' ', *p = ' ';					break;				}				else if (*p == '\n')					lineno++;				*p++ = ' ';			}			continue;		}#if defined(WIN32) || defined(__EMX__)		else if (*p == '/' && *(p+1) == '/') { /* consume comments */			*p++ = ' ', *p++ = ' ';			while (*p && *p != '\n')				*p++ = ' ';			lineno++;			continue;		}#endif		else if (*p == '\\') {			if (*(p+1) == '\n') {				*p = ' ';				*(p+1) = ' ';				lineno++;			}		}		else if (*p == '\n') {			lineno++;			if (*bol == '#') {				register char *cp;				*p++ = '\0';				/* punt lines with just # (yacc generated) */				for (cp = bol+1; 				     *cp && (*cp == ' ' || *cp == '\t'); cp++);				if (*cp) goto done;			}			bol = p+1;		}	}	if (*bol != '#')		bol = NULL;done:	filep->f_p = p;	filep->f_line = lineno;	return(bol);}/* * Strip the file name down to what we want to see in the Makefile. * It will have objprefix and objsuffix around it. */char *base_name(file)	register char	*file;{	register char	*p;	file = copy(file);	for(p=file+strlen(file); p>file && *p != '.'; p--) ;	if (*p == '.')		*p = '\0';	return(file);}#if defined(USG) && !defined(CRAY) && !defined(SVR4) && !defined(__EMX__) && !defined(clipper) && !defined(__clipper__)int rename (from, to)    char *from, *to;{    (void) unlink (to);    if (link (from, to) == 0) {	unlink (from);	return 0;    } else {	return -1;    }}#endif /* USGISH */voidredirect(line, makefile)	char	*line,		*makefile;{	struct stat	st;	FILE	*fdin, *fdout;	char	backup[ BUFSIZ ],		buf[ BUFSIZ ];	boolean	found = FALSE;	int	len;	/*	 * if makefile is "-" then let it pour onto stdout.	 */	if (makefile && *makefile == '-' && *(makefile+1) == '\0') {		puts(line);		return;	}	/*	 * use a default makefile is not specified.	 */	if (!makefile) {		if (stat("Makefile", &st) == 0)			makefile = "Makefile";		else if (stat("makefile", &st) == 0)			makefile = "makefile";		else			fatalerr("[mM]akefile is not present\n");	}	else	    stat(makefile, &st);	if ((fdin = fopen(makefile, "r")) == NULL)		fatalerr("cannot open \"%s\"\n", makefile);	sprintf(backup, "%s.bak", makefile);	unlink(backup);#if defined(WIN32) || defined(__EMX__)	fclose(fdin);#endif	if (rename(makefile, backup) < 0)		fatalerr("cannot rename %s to %s\n", makefile, backup);#if defined(WIN32) || defined(__EMX__)	if ((fdin = fopen(backup, "r")) == NULL)		fatalerr("cannot open \"%s\"\n", backup);#endif	if ((fdout = freopen(makefile, "w", stdout)) == NULL)		fatalerr("cannot open \"%s\"\n", backup);	len = strlen(line);	while (!found && fgets(buf, BUFSIZ, fdin)) {		if (*buf == '#' && strncmp(line, buf, len) == 0)			found = TRUE;		fputs(buf, fdout);	}	if (!found) {		if (verbose)		warning("Adding new delimiting line \"%s\" and dependencies...\n",			line);		puts(line); /* same as fputs(fdout); but with newline */	} else if (append) {	    while (fgets(buf, BUFSIZ, fdin)) {		fputs(buf, fdout);	    }	}	fflush(fdout);#if defined(USGISH) || defined(_SEQUENT_) || defined(USE_CHMOD)	chmod(makefile, st.st_mode);#else        fchmod(fileno(fdout), st.st_mode);#endif /* USGISH */}void#if NeedVarargsPrototypesfatalerr(char *msg, ...)#else/*VARARGS*/fatalerr(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)    char *msg;#endif{#if NeedVarargsPrototypes	va_list args;#endif	fprintf(stderr, "%s: error:  ", ProgramName);#if NeedVarargsPrototypes	va_start(args, msg);	vfprintf(stderr, msg, args);	va_end(args);#else	fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9);#endif	exit (1);}void#if NeedVarargsPrototypeswarning(char *msg, ...)#else/*VARARGS0*/warning(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)    char *msg;#endif{#if NeedVarargsPrototypes	va_list args;#endif	fprintf(stderr, "%s: warning:  ", ProgramName);#if NeedVarargsPrototypes	va_start(args, msg);	vfprintf(stderr, msg, args);	va_end(args);#else	fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9);#endif}void#if NeedVarargsPrototypeswarning1(char *msg, ...)#else/*VARARGS0*/warning1(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)    char *msg;#endif{#if NeedVarargsPrototypes	va_list args;	va_start(args, msg);	vfprintf(stderr, msg, args);	va_end(args);#else	fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9);#endif}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -