Annotation of gcc/config/winnt/mklibgcc.c, revision 1.1

1.1     ! root        1: #include <stdio.h>
        !             2: #include <string.h>
        !             3: #include <dirent.h>
        !             4: 
        !             5: char *skips[] = {
        !             6:   0
        !             7: };
        !             8: 
        !             9: int
        !            10: do_clean()
        !            11: {
        !            12:   DIR *dir;
        !            13:   struct dirent *de;
        !            14:   remove("mklibnow.bat");
        !            15: 
        !            16:   dir = opendir("lgcctmp");
        !            17:   if (!dir)
        !            18:     return 0;
        !            19:   while ((de=readdir(dir)))
        !            20:     {
        !            21:       char buf[30];
        !            22:       if (de->d_name[0] == '.')
        !            23:         continue;
        !            24:       sprintf(buf, "lgcctmp/%s", de->d_name);
        !            25:       unlink(buf);
        !            26:     }
        !            27:   closedir(dir);
        !            28:   return 0;
        !            29: }
        !            30: 
        !            31: int
        !            32: main(int argc, char **argv)
        !            33: {
        !            34:   char *cc = argv[1];
        !            35:   char *csrc=argv[2];
        !            36:   int i;
        !            37:   FILE *batfile;
        !            38:   FILE *cfile;
        !            39: 
        !            40:   if (argc > 1 && strcmp(argv[1], "-c")==0)
        !            41:     return do_clean();
        !            42: 
        !            43:   _mkdir("lgcctmp", 0755);
        !            44: 
        !            45:   batfile = fopen("mklibnow.bat", "a");
        !            46:   if (!batfile)
        !            47:     {
        !            48:       perror("mklibnow.bat");
        !            49:       return 1;
        !            50:     }
        !            51: /*  fprintf(batfile, "@echo off\n"); */
        !            52: 
        !            53:   for (i=3; i<argc; i++)
        !            54:     {
        !            55:       char dirname[30], basename[30], fullname[30], *bp;
        !            56:       int s;
        !            57:       for (s=0; skips[s]; s++)
        !            58:         if (strcmp(skips[s], argv[i]) == 0)
        !            59:        break;
        !            60:       if (skips[s])
        !            61:         continue;
        !            62:       strcpy(dirname, "lgcctmp/");
        !            63:       strcpy(basename, "\0");
        !            64:       if (strncmp(argv[i], "_fix", 4)==0)
        !            65:         {
        !            66:           strcat(basename, "fx");
        !            67:           strcat(basename, argv[i]+4);
        !            68:         }
        !            69:       else if (strncmp(argv[i], "_float", 4)==0)
        !            70:         {
        !            71:           strcat(basename, "flt");
        !            72:           strcat(basename, argv[i]+6);
        !            73:         }
        !            74:       else
        !            75:         {
        !            76:           strcat(basename, argv[i]);
        !            77:         }
        !            78:       strcpy (fullname, dirname);
        !            79:       strcat (fullname, basename);
        !            80:       fprintf(batfile, "%s -c lgcctmp/%s.c\n", cc, basename);
        !            81:       fprintf(batfile, "copy %s.obj lgcctmp\n", basename);
        !            82:       bp = fullname + strlen(fullname);
        !            83:       strcpy(bp, ".c");
        !            84:       cfile = fopen(fullname, "w");
        !            85:       if (cfile)
        !            86:         {
        !            87:           *bp = 0;
        !            88:           fprintf(cfile, "#define L%s\n#include \"%s\"\n", argv[i], csrc);
        !            89:           fclose(cfile);
        !            90:         }
        !            91:       else
        !            92:         perror(fullname);
        !            93:     }
        !            94: 
        !            95:   fclose(batfile);
        !            96:   return 0;
        !            97: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.