?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6.  
  7.  
  8. int main(int argc,char* argv[])
  9. {
  10.         FILE *fin,*fout;
  11.         char line[1024];
  12.         unsigned int pp,pp1;
  13.  
  14.         if(argc<2) return 1;
  15.  
  16.         strcpy(line,argv[1]);
  17.         line[strlen(line)-3]='h';
  18.         line[strlen(line)-2]=0;
  19.  
  20.         fin=fopen(argv[1],"rt");
  21.  
  22.         if(!fin) return 1;
  23.  
  24.         fout=fopen(line,"wt");
  25.  
  26.         if(!fout)
  27.         {
  28.                 fclose(fin);
  29.                 return 1;
  30.         }
  31.  
  32.         while(fgets(line,sizeof(line),fin)!=NULL)
  33.         {
  34.                 if(line[strlen(line)-1]<0x20) line[strlen(line)-1]=0;
  35.  
  36.                 pp=0;
  37.  
  38.                 while(pp<strlen(line))
  39.                 {
  40.                         if(line[pp]==':') break;
  41.                         if(line[pp]>='a'&&line[pp]<='z') line[pp]-=32;
  42.                         pp++;
  43.                 }
  44.  
  45.                 line[pp++]='\t';
  46.                 pp1=pp;
  47.  
  48.                 while(pp<strlen(line))
  49.                 {
  50.                         if(line[pp]=='0') break;
  51.                         pp++;
  52.                 }
  53.  
  54.                 strcpy(&line[pp1],&line[pp]);
  55.  
  56.                 fprintf(fout,"#define %s\n",line);
  57.         }
  58.  
  59.         fclose(fin);
  60.         fclose(fout);
  61.  
  62.         return 0;
  63. }
  64.