~ubuntu-branches/ubuntu/quantal/seyon/quantal

« back to all changes in this revision

Viewing changes to SeString.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve McIntyre
  • Date: 2001-12-19 17:24:13 UTC
  • Revision ID: james.westby@ubuntu.com-20011219172413-5l92k5tbflnjol7h
Tags: 2.20c-8
* Added Build-Depends on bison. Closes: #123699.
* Turned app-defaults files into conffiles after lintian warning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
char
24
24
itoa(num)
25
 
     int             num;
 
25
    int             num;
26
26
{
27
 
  char            buf[TIN_BUF];
 
27
    char            buf[TIN_BUF];
28
28
 
29
 
  sprintf(buf, "%d", num);
30
 
  return buf[0];
 
29
    /* Buffer is safely big enough */
 
30
    sprintf(buf, "%d", num);
 
31
    return buf[0];
31
32
}
32
33
 
33
34
/*
100
101
  char            buffer[REG_BUF],
101
102
                 *bufptr;
102
103
 
103
 
  strcpy(buffer, source);
 
104
  strncpy(buffer, source, REG_BUF);
104
105
  bufptr = str_strip_lead_end_space(buffer);
 
106
 
 
107
  /* Must fit, as we can only have removed things from the original
 
108
     string */
105
109
  return strcpy(dest, bufptr);
106
110
}
107
111
 
130
134
 
131
135
char*
132
136
FmtString(fmt, a, b, c)
133
 
         char *fmt, *a, *b, *c;
 
137
    char *fmt, *a, *b, *c;
134
138
{
135
 
  static char strBuf[LRG_BUF];
136
 
 
137
 
  sprintf(strBuf, fmt, a, b, c);
138
 
  return strBuf;
 
139
    static char     strBuf[LRG_BUF];
 
140
    static FILE    *devnull=NULL;
 
141
    int             length = 0;
 
142
 
 
143
    bzero(&strBuf, LRG_BUF);
 
144
 
 
145
    /* Ick... This is horrible - using a user-provided format string
 
146
       means we have no easy way of limiting string length. HACK HACK
 
147
       HACK Use fprintf to output to /dev/null and count the number of
 
148
       bytes... It would be nice if we could rely on having snprintf() */
 
149
 
 
150
    if(NULL == devnull)
 
151
    {
 
152
        devnull = fopen("/dev/null", "r+");
 
153
        if(NULL == devnull)
 
154
        {
 
155
          printf("Open /dev/null failed!?!\n");
 
156
          return strBuf;
 
157
        }
 
158
        length = fprintf(devnull, fmt, a, b, c);
 
159
    }
 
160
    
 
161
    if(LRG_BUF >= length)
 
162
        sprintf(strBuf, fmt, a, b, c);
 
163
 
 
164
    return strBuf;
139
165
}
140
166
 
141
167
/*
189
215
  if (*line == '\0')
190
216
    return NULL;
191
217
  else if (*line == '\"')
 
218
 
192
219
    for (wrd = ++line; *line != '\"' && *line; line++);
193
220
  else
194
221
    for (wrd = line; !isspace(*line) && *line; line++);
246
273
 * this routine is not currently used, and I'm not if it works
247
274
 */
248
275
 
249
 
char           *
250
 
get_word(str, word)
251
 
     char           *str,
252
 
                    *word;
253
 
{
254
 
  char           *wrd,
255
 
                  c;
256
 
 
257
 
  while (isspace(*str) && *str)
258
 
    str++;
259
 
 
260
 
  if (!(*str))
261
 
    word[0] = '\0';
262
 
 
263
 
  else if (*str == '\"') {
264
 
    for (wrd = ++str; *str != '\"' && *str; str++);
265
 
    *str = '\0';
266
 
    strcpy(word, wrd);
267
 
    *str = '\"';
268
 
    str++;
269
 
  }
270
 
 
271
 
  else {
272
 
    for (wrd = str; !isspace(*str) && *str; str++);
273
 
    c = *str;
274
 
    *str = '\0';
275
 
    strcpy(word, wrd);
276
 
    *str = c;
277
 
  }
278
 
 
279
 
  return str;
280
 
}
 
276
/* char           * */
 
277
/* get_word(str, word) */
 
278
/*      char           *str, */
 
279
/*                     *word; */
 
280
/* { */
 
281
/*   char           *wrd, */
 
282
/*                   c; */
 
283
 
 
284
/*   while (isspace(*str) && *str) */
 
285
/*     str++; */
 
286
 
 
287
/*   if (!(*str)) */
 
288
/*     word[0] = '\0'; */
 
289
 
 
290
/*   else if (*str == '\"') { */
 
291
/*     for (wrd = ++str; *str != '\"' && *str; str++); */
 
292
/*     *str = '\0'; */
 
293
/*     strcpy(word, wrd); */
 
294
/*     *str = '\"'; */
 
295
/*     str++; */
 
296
/*   } */
 
297
 
 
298
/*   else { */
 
299
/*     for (wrd = str; !isspace(*str) && *str; str++); */
 
300
/*     c = *str; */
 
301
/*     *str = '\0'; */
 
302
/*     strcpy(word, wrd); */
 
303
/*     *str = c; */
 
304
/*   } */
 
305
 
 
306
/*   return str; */
 
307
/* } */
281
308
 
282
309
#if !HAVE_STRERROR
283
310