[BACK]Return to gen-plist.c CVS log [TXT][DIR] Up to [local] / OpenXM / misc / packages / FreeBSD / openxm-ports / openxm-1.1.2 / files

Annotation of OpenXM/misc/packages/FreeBSD/openxm-ports/openxm-1.1.2/files/gen-plist.c, Revision 1.5

1.5     ! takayama    1: /* $OpenXM: OpenXM/misc/packages/FreeBSD/openxm-ports/openxm-1.1.2/files/gen-plist.c,v 1.4 2000/03/05 02:25:24 takayama Exp $ */
1.1       takayama    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:
1.2       takayama   23:   /* Initial data */
                     24:   printf("bin/asir\n");
                     25:   printf("bin/sm1\n");
                     26:   printf("bin/oxMathematica\n");
                     27:   printf("bin/oxmath\n");
                     28:   printf("bin/ox\n");
1.3       takayama   29:   printf("bin/oxgp\n");
                     30:   printf("bin/openxm\n");
1.5     ! takayama   31:   printf("man/man1/sm1.1.gz\n");
        !            32:   printf("man/man1/openxm.1.gz\n");
1.2       takayama   33:
1.1       takayama   34:   while (fgets(s0,512,stdin) != NULL) {
                     35:        n = strlen(s0);
                     36:        if (n <= 1) goto LLL;
                     37:        if (s0[n-1] == '\n') s0[n-1] = '\0';
                     38:        if (s0[0] == '.' && s0[1] == '/' && s0[2] == '.') goto LLL;
                     39:        if (s0[0] == '.' && s0[1] == '/' ) {
                     40:          strcpy(s,&(s0[2]));
                     41:        }else{
                     42:          strcpy(s,s0);
                     43:        }
                     44:        n = strlen(s);
                     45:        flag = 0;
                     46:        if (n == 0) goto LLL;
                     47:        if (isExclude(s,"/CVS/")) goto LLL;
                     48:        if (isExclude(s,".done")) goto LLL;
                     49:        if (isExclude(s,".uuencoded")) goto LLL;
                     50:        if (isExclude(s,"DO_NOT_EDIT")) goto LLL;
                     51:        if (isExclude(s,"~")) goto LLL;
                     52:        if (isExclude(s,".#")) goto LLL;
                     53:        if (isExclude(s,"OpenXM/doc/histrical-doc")) goto LLL;
                     54:        if (isExclude(s,".log")) goto LLL;
                     55:        if (isExclude(s,"fep.linux")) goto LLL;
                     56:        if (isExclude(s,"/Old/")) goto LLL;
                     57:        if (isExclude(s,"/debug/.sm1")) goto LLL;
                     58:        if (isExclude(s,".aux")) goto LLL;
                     59:        if (isExclude(s,".toc")) goto LLL;
                     60:        if (isExclude(s,".keepme")) goto LLL;
                     61:        if (isExclude(s,"/sm1/ole")) goto LLL;
                     62:        if (isExclude(s,"OpenXM/lib/sm1/ttt")) goto LLL;
                     63:        if (isExclude(s,".sm1.org")) goto LLL;
                     64:        if (isExclude(s,"OpenXM/lib/sm1/onlinehelp")) goto LLL;
                     65:        if (isExclude(s,"OpenXM/lib/sm1/printOnlineHelp")) goto LLL;
                     66:        if (isExclude(s,"OpenXM/lib/sm1/Makefile")) goto LLL;
                     67:        if (isExclude(s,"issac2000")) goto LLL;
                     68:        if (isExclude(s,"doc/Papers")) goto LLL;
                     69:        if (isExclude(s,"doc/OpenXM-web")) goto LLL;
                     70:        if (isExclude(s,"doc/Makefile")) goto LLL;
                     71:        if (isExclude(s,"doc/install")) goto LLL;
1.2       takayama   72:        if (isExclude(s,"doc/compalg")) goto LLL;
1.1       takayama   73:
                     74:
                     75:        if (lstat(s,&sb) < 0) fprintf(stderr,"The file %s is not found.\n",s);
                     76:        if (S_ISLNK(sb.st_mode)) {
                     77:          /* symbolic link */
                     78:          p = readlink(s,lnk,1024);
                     79:          if (p > 0) lnk[p] = '\0';
                     80:          else {
                     81:                fprintf(stderr,"readlink could not get the symbolic link of %s\n",s);
                     82:          }
                     83:          printf("@exec ln -fs %s %%D/%s\n",lnk,s);
                     84:        }else{
                     85:          printf("%s\n",s);
                     86:        }
                     87:
                     88:   LLL: ;
                     89:
                     90:   }
1.4       takayama   91:   printf("@dirrm OpenXM\n");
1.1       takayama   92: }
                     93:
                     94: isExclude(char *s,char *pattern) {
                     95:   int n;
                     96:   int m;
                     97:   int i,j;
                     98:   n = strlen(pattern);
                     99:   m = strlen(s);
                    100:   /* printf("%s %s\n",s,pattern); */
                    101:   for (i=0; i< m -n +1; i++) {
                    102:        for (j=0; j<n; j++) {
                    103:          /* printf("%c %c, ",pattern[j], s[i+j]); */
                    104:          if (pattern[j] != s[i+j]) goto PPP;
                    105:        }
                    106:        return(1);
                    107:   PPP: ;
                    108:   }
                    109:   return(0);
                    110: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>