File: case_test.c

package info (click to toggle)
libtext-bibtex-perl 0.91-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,528 kB
  • sloc: ansic: 10,706; perl: 1,991; makefile: 9
file content (50 lines) | stat: -rw-r--r-- 857 bytes parent folder | download | duplicates (6)
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
/*
 * case_test.c
 * 
 * GPW 1997/11/25
 *
 * $Id$
 */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "btparse.h"


static void
show_case_changed (char transform, char * msg, char * string)
{
   char * dup;

   dup = strdup (string);
   bt_change_case (transform, dup, 0);
   printf ("%s%s\n", msg, dup);
   free (dup);
}


int
main (void)
{
   char   line[1024];
   int    line_num;
   int    len;

   while (! feof (stdin))
   {
      if (fgets (line, 1024, stdin) == NULL)
         break;

      len = strlen (line);
      if (line[len-1] == '\n') line[len-1] = '\0';
      line_num++;

      printf ("original_string = %s\n", line);

      show_case_changed ('l', "      lowercase = ", line);
      show_case_changed ('u', "      uppercase = ", line);
      show_case_changed ('t', "     title caps = ", line);
   }
   return 0;
}