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

📄 __packpats.c

📁 一套客户/服务器模式的备份系统代码,跨平台,支持linux,AIX, IRIX, FreeBSD, Digital Unix (OSF1), Solaris and HP-UX.
💻 C
字号:
/****************** Start of $RCSfile: __packpats.c,v $  ****************** $Source: /home/alb/afbackup/afbackup-3.3.8.1/RCS/__packpats.c,v $* $Id: __packpats.c,v 1.3 2004/07/08 20:34:42 alb Exp alb $* $Date: 2004/07/08 20:34:42 $* $Author: alb $********* description *********************************************************************************************************************/#include <conf.h>#include <version.h>  static char * fileversion = "$RCSfile: __packpats.c,v $ $Source: /home/alb/afbackup/afbackup-3.3.8.1/RCS/__packpats.c,v $ $Id: __packpats.c,v 1.3 2004/07/08 20:34:42 alb Exp alb $ " PACKAGE " " VERSION_STRING;#include <stdio.h>#include <unistd.h>#include <x_types.h>#include <genutils.h>#include <fileutil.h>#include <packer.h>#include <backup.h>#define	EM__(arg)	nomemmsgexit((arg), stderr)voidusage(UChar * prognam){  fprintf(stderr, "Usage: %s <path>\n", FN_BASENAME(prognam));  exit(2);}main(int argc, char ** argv){  UChar		*line = NULL, *oldline, *c2, *c3, *pat;  Int32		len, clen, llen, nall = 0, oldall;  if(argc > 2)    usage(argv[0]);  pat = argc > 1 ? argv[1] : "";  if(pat[0] && strcmp(pat, "/"))    EM__(pat = strapp(pat, "/"));  len = strlen(pat);  clen = strlen(CMDINOUTPREFIX);  EM__(oldline = NEWP(UChar, oldall = 1024));  strcpy(oldline, "");  while(!feof(stdin)){    if(fget_realloc_str(stdin, &line, &nall))	continue;    chop(line);    if(!strncmp(line, CMDINOUTPREFIX, clen)){	fprintf(stdout, "%s\n", line);	fflush(stdout);	continue;    }    if(!strncmp(pat, line, len)){	c2 = line + len;#if 0	if(*c2 != FN_DIRSEPCHR)	  continue;#endif	c3 = strchr(c2 + 1, FN_DIRSEPCHR);	if(c3){	  c2 = c3;	  c3 = strchr(c2 + 1, FN_DIRSEPCHR);	  if(c3)	    *c3 = '\0';	}	if(!strcmp(line, oldline))	  continue;	fprintf(stdout, "%s\n", line);	fflush(stdout);	llen = strlen(line) + 1;	if(llen > oldall)	  oldline = RENEWP(oldline, UChar, oldall = llen);	strcpy(oldline, line);    }  }  exit(0);}

⌨️ 快捷键说明

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