Annotation of OpenXM/misc/packages/FreeBSD/openxm-ports/openxm-1.1.2/files/gen-plist.c, Revision 1.1
1.1 ! takayama 1: /* $OpenXM$ */
! 2: #include <stdio.h>
! 3: #include <sys/types.h>
! 4: #include <sys/stat.h>
! 5: #include <unistd.h>
! 6: /* References are
! 7: /usr/src/bin/ls/print.c readlink
! 8: /usr/port/japanese/dvipsk-vflib/pkg/PLIST
! 9:
! 10: */
! 11:
! 12:
! 13: main() {
! 14: char s[512];
! 15: char s0[512];
! 16: char lnk[1024];
! 17: int i;
! 18: int n;
! 19: int flag = 0;
! 20: struct stat sb;
! 21: int p;
! 22:
! 23: while (fgets(s0,512,stdin) != NULL) {
! 24: n = strlen(s0);
! 25: if (n <= 1) goto LLL;
! 26: if (s0[n-1] == '\n') s0[n-1] = '\0';
! 27: if (s0[0] == '.' && s0[1] == '/' && s0[2] == '.') goto LLL;
! 28: if (s0[0] == '.' && s0[1] == '/' ) {
! 29: strcpy(s,&(s0[2]));
! 30: }else{
! 31: strcpy(s,s0);
! 32: }
! 33: n = strlen(s);
! 34: flag = 0;
! 35: if (n == 0) goto LLL;
! 36: if (isExclude(s,"/CVS/")) goto LLL;
! 37: if (isExclude(s,".done")) goto LLL;
! 38: if (isExclude(s,".uuencoded")) goto LLL;
! 39: if (isExclude(s,"DO_NOT_EDIT")) goto LLL;
! 40: if (isExclude(s,"~")) goto LLL;
! 41: if (isExclude(s,".#")) goto LLL;
! 42: if (isExclude(s,"OpenXM/doc/histrical-doc")) goto LLL;
! 43: if (isExclude(s,".log")) goto LLL;
! 44: if (isExclude(s,"fep.linux")) goto LLL;
! 45: if (isExclude(s,"/Old/")) goto LLL;
! 46: if (isExclude(s,"/debug/.sm1")) goto LLL;
! 47: if (isExclude(s,".aux")) goto LLL;
! 48: if (isExclude(s,".toc")) goto LLL;
! 49: if (isExclude(s,".keepme")) goto LLL;
! 50: if (isExclude(s,"/sm1/ole")) goto LLL;
! 51: if (isExclude(s,"OpenXM/lib/sm1/ttt")) goto LLL;
! 52: if (isExclude(s,".sm1.org")) goto LLL;
! 53: if (isExclude(s,"OpenXM/lib/sm1/onlinehelp")) goto LLL;
! 54: if (isExclude(s,"OpenXM/lib/sm1/printOnlineHelp")) goto LLL;
! 55: if (isExclude(s,"OpenXM/lib/sm1/Makefile")) goto LLL;
! 56: if (isExclude(s,"issac2000")) goto LLL;
! 57: if (isExclude(s,"doc/Papers")) goto LLL;
! 58: if (isExclude(s,"doc/OpenXM-web")) goto LLL;
! 59: if (isExclude(s,"doc/Makefile")) goto LLL;
! 60: if (isExclude(s,"doc/install")) goto LLL;
! 61:
! 62:
! 63: if (lstat(s,&sb) < 0) fprintf(stderr,"The file %s is not found.\n",s);
! 64: if (S_ISLNK(sb.st_mode)) {
! 65: /* symbolic link */
! 66: p = readlink(s,lnk,1024);
! 67: if (p > 0) lnk[p] = '\0';
! 68: else {
! 69: fprintf(stderr,"readlink could not get the symbolic link of %s\n",s);
! 70: }
! 71: printf("@exec ln -fs %s %%D/%s\n",lnk,s);
! 72: }else{
! 73: printf("%s\n",s);
! 74: }
! 75:
! 76: LLL: ;
! 77:
! 78: }
! 79: }
! 80:
! 81: isExclude(char *s,char *pattern) {
! 82: int n;
! 83: int m;
! 84: int i,j;
! 85: n = strlen(pattern);
! 86: m = strlen(s);
! 87: /* printf("%s %s\n",s,pattern); */
! 88: for (i=0; i< m -n +1; i++) {
! 89: for (j=0; j<n; j++) {
! 90: /* printf("%c %c, ",pattern[j], s[i+j]); */
! 91: if (pattern[j] != s[i+j]) goto PPP;
! 92: }
! 93: return(1);
! 94: PPP: ;
! 95: }
! 96: return(0);
! 97: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>