/[mailutils]/mailutils/mh/mh_alias.y
ViewVC logotype

Diff of /mailutils/mh/mh_alias.y

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by gray, Fri Aug 22 14:01:39 2003 UTC revision 1.3 by gray, Fri Oct 24 09:39:49 2003 UTC
# Line 45  list_create_or_die () Line 45  list_create_or_die ()
45    return list;    return list;
46  }  }
47    
48    static char *
49    ali_list_to_string (list_t *plist)
50    {
51      size_t n;
52      char *string;
53      
54      list_count (*plist, &n);
55      if (n == 1)
56        {
57          list_get (*plist, 0, (void **)&string);
58        }
59      else
60        {
61          char *p;
62          size_t length = 0;
63          iterator_t itr;
64          iterator_create (&itr, *plist);
65          for (iterator_first (itr); !iterator_is_done (itr); iterator_next(itr))
66            {
67              char *s;
68              iterator_current (itr, (void**) &s);
69              length += strlen (s) + 1;
70            }
71      
72          string = xmalloc (length + 1);
73          p = string;
74          for (iterator_first (itr); !iterator_is_done (itr); iterator_next(itr))
75            {
76              char *s;
77              iterator_current (itr, (void**) &s);
78              strcpy (p, s);
79              p += strlen (s);
80              *p++ = ' ';
81            }
82          *--p = 0;
83          iterator_destroy (&itr);
84        }
85      list_destroy (plist);
86      return string;
87    }
88                
89  static list_t unix_group_to_list __P((char *name));  static list_t unix_group_to_list __P((char *name));
90  static list_t unix_gid_to_list __P((char *name));  static list_t unix_gid_to_list __P((char *name));
91  static list_t unix_passwd_to_list __P((void));  static list_t unix_passwd_to_list __P((void));
# Line 61  int yylex __P((void)); Line 102  int yylex __P((void));
102  }  }
103    
104  %token <string> STRING  %token <string> STRING
105  %type <list>  address_list address_group  %type <list>  address_list address_group string_list
106  %type <string> address  %type <string> address
107  %type <alias> alias  %type <alias> alias
108    
# Line 133  address_list : address Line 174  address_list : address
174                 }                 }
175               ;               ;
176    
177  address      : STRING  address      : string_list
178                   {
179                     $$ = ali_list_to_string (&$1);
180                   }
181                 ;
182    
183    string_list  : STRING
184                   {
185                     list_create(&$$);
186                     list_append($$, $1);
187                   }
188                 | string_list STRING
189                   {
190                     list_append($1, $2);
191                     $$ = $1;
192                   }
193               ;               ;
194    
195  %%  %%

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26