File: grammar.c

package info (click to toggle)
morse 2.1-4
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 412 kB
  • ctags: 428
  • sloc: ansic: 3,750; xml: 376; makefile: 116
file content (34 lines) | stat: -rw-r--r-- 576 bytes parent folder | download | duplicates (4)
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
#include <stdio.h>

int
is_vowel (first_char)
     char first_char;
{
    if (
	   first_char == 'A' ||
	   first_char == 'E' ||
	   first_char == 'I' ||
	   first_char == 'O' ||
	   first_char == 'U' ||
	   first_char == 'a' ||
	   first_char == 'e' ||
	   first_char == 'i' ||
	   first_char == 'o' ||
	   first_char == 'u'
     )
	return (1);
    return (0);
}

char buffer[200];

char *
A_Or_An (string)
     char *string;
{
    if (is_vowel (string[0]) == 1)
	sprintf (buffer, "an %s", string);
    else
	sprintf (buffer, "a %s", string);
    return ((char *) buffer);
}