~ubuntu-branches/ubuntu/trusty/hyphen/trusty-proposed

« back to all changes in this revision

Viewing changes to example.c

  • Committer: Bazaar Package Importer
  • Author(s): Chris Cheney
  • Date: 2008-07-01 20:44:19 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080701204419-x15zd2n5ei0yvqbk
Tags: 2.4-2ubuntu1
* Merge from debian unstable, remaining changes:
  - Replaces old version of openoffice.org-hyphenation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
void help() {
11
11
    fprintf(stderr,"correct syntax is:\n"); 
12
12
    fprintf(stderr,"example [-d | -dd] hyphen_dictionary_file file_of_words_to_check\n");
13
 
    fprintf(stderr,"-d = use discretionary hyphenation\n");
14
 
    fprintf(stderr,"-dd = discretionary hyphenation with listing of the possible hyphenations\n");
 
13
    fprintf(stderr,"-o = use old algorithm (without non-standard hyphenation)\n");
 
14
    fprintf(stderr,"-d = hyphenation with listing of the possible hyphenations\n");
15
15
}
16
16
 
17
17
/* get a pointer to the nth 8-bit or UTF-8 character of the word */
68
68
    char *hyphword;
69
69
    char hword[BUFSIZE * 2];
70
70
    int arg = 1;
71
 
    int optd = 0;
 
71
    int optd = 1;
72
72
    int optdd = 0;
73
73
    char ** rep;
74
74
    int * pos;
78
78
  /* arg1 - hyphen dictionary file, arg2 - file of words to check */
79
79
 
80
80
  if (argv[arg]) {
81
 
       if (strcmp(argv[arg], "-d") == 0) {
82
 
            optd = 1;
 
81
       if (strcmp(argv[arg], "-o") == 0) {
 
82
            optd = 0;
83
83
            arg++;
84
84
       }
85
 
       if (argv[arg] && strcmp(argv[arg], "-dd") == 0) {
 
85
       if (argv[arg] && strcmp(argv[arg], "-d") == 0) {
86
86
            optd = 1;
87
87
            optdd = 1;
88
88
            arg++;
121
121
  /* now read each word from the wtc file */
122
122
    while(fgets(buf,BUFSIZE,wtclst)) {
123
123
       k = strlen(buf);
124
 
       *(buf + k - 1) = '\0';
 
124
       if (buf[k - 1] == '\n') buf[k - 1] = '\0';
 
125
       if (*buf && buf[k - 2] == '\r') buf[k-- - 2] = '\0';
125
126
 
126
127
       /* set aside some buffers to hold lower cased */
127
128
       /* and hyphen information */
192
193
      free(lcword);
193
194
    }
194
195
 
 
196
    fclose(wtclst);
195
197
    hnj_hyphen_free(dict);
196
198
    return 0;
197
199
}