Mercurial > msvpvf
comparison src/main.c @ 44:4f005d28d912
gah,,
| author | Paper <37962225+mrpapersonic@users.noreply.github.com> | 
|---|---|
| date | Fri, 20 May 2022 06:33:29 -0400 | 
| parents | 9b309701420e | 
| children | d8ac17c6d6f2 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 43:9b309701420e | 44:4f005d28d912 | 
|---|---|
| 147 fflush(stdout); | 147 fflush(stdout); | 
| 148 scanf("%3s", args.type); | 148 scanf("%3s", args.type); | 
| 149 } | 149 } | 
| 150 fflush(stdout); | 150 fflush(stdout); | 
| 151 if (strcmp(args.output, " ") == 0) { /* string manipulation hell */ | 151 if (strcmp(args.output, " ") == 0) { /* string manipulation hell */ | 
| 152 char temp* = (char*)malloc(sizeof(char)*256); | 152 char temp* = (char*)calloc(256, sizeof(char)); | 
| 153 temp[0] = '\0'; | 153 temp[0] = '\0'; | 
| 154 char str_version[16]; | 154 char str_version[16]; | 
| 155 sprintf(str_version, "V%d", args.version); | 155 sprintf(str_version, "V%d", args.version); | 
| 156 strncat(temp, str_version, 2); | 156 strncat(temp, str_version, 2); | 
| 157 strncat(temp, "_", 1); | 157 strncat(temp, "_", 1); | 
| 158 strncat(temp, basename(args.input), 248); | 158 strncat(temp, basename(args.input), 248); | 
| 159 strcpy(temp, strremove(temp, strrchr(basename(args.input), ('.')))); /* remove file extension */ | 159 strcpy(temp, strremove(temp, strrchr(basename(args.input), ('.')))); /* remove file extension */ | 
| 160 strncat(temp, ".", 1); | 160 strncat(temp, ".", 1); | 
| 161 strncat(temp, args.type, 3); | 161 strncat(temp, args.type, 3); | 
| 162 strncpy(args.output, temp, 255); | 162 strncpy(args.output, temp, 255); | 
| 163 free(temp); | |
| 163 } | 164 } | 
| 164 if (strcmp(args.type, "veg") == 0) { | 165 if (strcmp(args.type, "veg") == 0) { | 
| 165 const unsigned char T[] = {0xEF, 0x29, 0xC4, 0x46, 0x4A, 0x90, 0xD2, 0x11, 0x87, 0x22, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A}; | 166 const unsigned char T[] = {0xEF, 0x29, 0xC4, 0x46, 0x4A, 0x90, 0xD2, 0x11, 0x87, 0x22, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A}; | 
| 166 for (option_index = 0; option_index <= 15; option_index++) { /* this line is repeated, but it's probably best to just leave it be. */ | 167 for (option_index = 0; option_index <= 15; option_index++) { /* this line is repeated, but it's probably best to just leave it be. */ | 
| 167 magic[option_index] = T[option_index]; | 168 magic[option_index] = T[option_index]; | 
