~ubuntu-branches/ubuntu/karmic/gnustep-base/karmic

« back to all changes in this revision

Viewing changes to Testing/create-abbrevs.m

  • Committer: Bazaar Package Importer
  • Author(s): Eric Heintzmann
  • Date: 2005-04-17 00:14:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050417001438-enf0y07c9tku85z1
Tags: 1.10.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* create-abbrevs.m - Utility to create a list of time zones and their
2
 
       associated abbreviations.
3
 
 
4
 
   Copyright (C) 1997 Free Software Foundation, Inc.
5
 
 
6
 
   This program is free software; you can redistribute it and/or
7
 
   modify it under the terms of the GNU General Public License as
8
 
   published by the Free Software Foundation; either version 2 of the
9
 
   License, or (at your option) any later version.
10
 
 
11
 
   This program is distributed in the hope that it will be useful, but
12
 
   WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 
   General Public License for more details.
15
 
 
16
 
   You should have received a copy of the GNU General Public License
17
 
   along with this program; if not, write to the Free Software
18
 
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
 
 
20
 
#include <stdio.h>
21
 
#include <Foundation/NSArray.h>
22
 
#include <Foundation/NSAutoreleasePool.h>
23
 
#include <Foundation/NSException.h>
24
 
#include <Foundation/NSDictionary.h>
25
 
#include <Foundation/NSDate.h>
26
 
#include <Foundation/NSUtilities.h>
27
 
#include <Foundation/NSTimeZone.h>
28
 
 
29
 
int
30
 
main (int argc, char *argv[])
31
 
{
32
 
  int i;
33
 
  id pool, zone, dict, e, details, name;
34
 
 
35
 
  pool = [NSAutoreleasePool new];
36
 
 
37
 
  for (i = 1; i < argc; i++)
38
 
    {
39
 
      name = [NSString stringWithCString: argv[i]];
40
 
      zone = [NSTimeZone timeZoneWithName: name];
41
 
      if (zone != nil)
42
 
        {
43
 
          id detail, abbrev;
44
 
 
45
 
          dict = [NSMutableDictionary dictionary];
46
 
          details = [zone timeZoneDetailArray];
47
 
          e = [details objectEnumerator];
48
 
          while ((detail = [e nextObject]) != nil)
49
 
            [dict setObject: name forKey: [detail timeZoneAbbreviation]];
50
 
          e = [dict keyEnumerator];
51
 
          while ((abbrev = [e nextObject]) != nil)
52
 
            printf("%@\t%@\n", abbrev, name);
53
 
        }
54
 
    }
55
 
 
56
 
  [pool release];
57
 
  return 0;
58
 
}