Subversion Repositories SvarDOS

Rev

Rev 1064 | Rev 1247 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1064 Rev 1114
Line 64... Line 64...
64
 
64
 
65
  return(l);
65
  return(l);
66
}
66
}
67
 
67
 
68
 
68
 
69
/* parse a line in format "1.50:somestring". fills id and returns a pointer to
69
/* parse a line in format "[?]1.50:somestring". fills id and returns a pointer to
70
 * the actual string part on success, or NULL on error */
70
 * the actual string part on success, or NULL on error */
71
static char *parseline(unsigned short *id, char *s) {
71
static const char *parseline(unsigned short *id, const char *s) {
72
  int i;
72
  int i;
73
  int dotpos = 0, colpos = 0, gotdigits = 0;
73
  int dotpos = 0, colpos = 0, gotdigits = 0;
74
 
74
 
-
 
75
  /* strings prefixed by '?' are flagged as "dirty": ignore this flag here */
-
 
76
  if (*s == '?') s++;
-
 
77
 
75
  /* I must have a . and a : in the first 9 bytes */
78
  /* I must have a . and a : in the first 9 bytes */
76
  for (i = 0;; i++) {
79
  for (i = 0;; i++) {
77
    if (s[i] == '.') {
80
    if (s[i] == '.') {
78
      if ((dotpos != 0) || (gotdigits == 0)) break;
81
      if ((dotpos != 0) || (gotdigits == 0)) break;
79
      dotpos = i;
82
      dotpos = i;
Line 129... Line 132...
129
static unsigned short gen_langstrings(unsigned char *buff, const char *langid, struct bitmap *b, const struct bitmap *refb, const unsigned char *refblock) {
132
static unsigned short gen_langstrings(unsigned char *buff, const char *langid, struct bitmap *b, const struct bitmap *refb, const unsigned char *refblock) {
130
  unsigned short len = 0, linelen;
133
  unsigned short len = 0, linelen;
131
  FILE *fd;
134
  FILE *fd;
132
  char fname[] = "XX.TXT";
135
  char fname[] = "XX.TXT";
133
  static char linebuf[8192];
136
  static char linebuf[8192];
134
  char *ptr;
137
  const char *ptr;
135
  unsigned short id, linecount;
138
  unsigned short id, linecount;
136
 
139
 
137
  bitmap_init(b);
140
  bitmap_init(b);
138
 
141
 
139
  memcpy(fname + strlen(fname) - 6, langid, 2);
142
  memcpy(fname + strlen(fname) - 6, langid, 2);
Line 160... Line 163...
160
      puts(linebuf);
163
      puts(linebuf);
161
      len = 0;
164
      len = 0;
162
      break;
165
      break;
163
    }
166
    }
164
 
167
 
-
 
168
    /* warn about dirty lines */
-
 
169
    if (linebuf[0] == '?') {
-
 
170
      printf("WARNING: %s[#%u] string id %u.%u is flagged as 'dirty'\r\n", fname, linecount, id >> 8, id & 0xff);
-
 
171
    }
-
 
172
 
165
    /* write string into block (II LL S) */
173
    /* write string into block (II LL S) */
166
    memcpy(buff + len, &id, 2);
174
    memcpy(buff + len, &id, 2);
167
    len += 2;
175
    len += 2;
168
    {
176
    {
169
      unsigned short slen = strlen(ptr) + 1;
177
      unsigned short slen = strlen(ptr) + 1;