File: makestub.c

package info (click to toggle)
arj 3.10.22-28
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,964 kB
  • sloc: ansic: 33,002; makefile: 2,014; sh: 1,587; asm: 436
file content (71 lines) | stat: -rw-r--r-- 1,543 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * $Id: makestub.c,v 1.2 2003/06/22 11:12:28 andrew_belov Exp $
 * ---------------------------------------------------------------------------
 * This program compiles SFX-STUB locale-dependent files.
 *
 */

#include <stdio.h>
#include <stdlib.h>

#include "arj.h"
#include "msg_stb.h"

DEBUGHDR(__FILE__)                      /* Debug information block */

/* Translation routine */

void store_xlat(FILE *ostream, char *banner, unsigned char *msg)
{
 int i, j=0;

 fprintf(ostream, "%s db ", banner);
 if(msg[0]=='\0')
  fprintf(ostream, "63");
 for(i=0; msg[i]!='\0'; i++)
 {
  if(msg[i]==10)
  {
   fprintf(ostream, "13,");
   j++;
  }
  fprintf(ostream, "%d", (int)msg[i]);
  j++;
  if(msg[i+1]!='\0')
  {
   if(i%20==19)
    fprintf(ostream, "\ndb ");
   else
    fprintf(ostream, ",");
  }
 }
 #if TARGET==DOS
  fprintf(ostream, "\ndb 36");
 #endif
 fprintf(ostream, "\nL_%s EQU %d\n", banner, j);
}

/* Main routine */

int main(int argc, char **argv)
{
 FILE *stream;

 printf("MAKESTUB v 1.11  [30/11/2001]  Not a part of any binary package!\n\n");
 if(argc<2)
 {
  printf("Usage: MAKESTUB <target>\n");
  exit(1);
 }
 if((stream=fopen(argv[1], m_w))==NULL)
 {
  printf("Failed to open include file\n");
  exit(1);
 }
 fprintf(stream, "; DO NOT MODIFY! This file has been automatically generated with MAKESTUB\n\n");
 store_xlat(stream, "M_SFXSTUB_BANNER", M_SFXSTUB_BANNER);
 store_xlat(stream, "M_SFXSTUB_BLURB_1", M_SFXSTUB_BLURB_1);
 store_xlat(stream, "M_SFXSTUB_BLURB_2", M_SFXSTUB_BLURB_2);
 fclose(stream);
 return(0);
}