/usr/share/GNUstep/Libraries/gnustep-base/Versions/1.24/Resources/NSTimeZones/create-abbrevs.m is in gnustep-base-common 1.24.7-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | /* create-abbrevs.m - Utility to create a list of time zones and their
associated abbreviations.
Copyright (C) 1997 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include <stdio.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSException.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSDate.h>
#include <Foundation/NSTimeZone.h>
int
main (int argc, char *argv[])
{
int i;
id pool, zone, dict, e, details, name, a;
pool = [NSAutoreleasePool new];
a = [NSMutableDictionary
dictionaryWithContentsOfFile: @"abbreviations.plist"];
if (nil == a)
{
NSLog(@"Unable to load 'abbbreviations.plist'");
return 1;
}
for (i = 1; i < argc; i++)
{
name = [NSString stringWithUTF8String: argv[i]];
zone = [NSTimeZone timeZoneWithName: name];
if (zone != nil)
{
id detail, abbrev;
dict = [NSMutableDictionary dictionary];
details = [zone timeZoneDetailArray];
e = [details objectEnumerator];
while ((detail = [e nextObject]) != nil)
{
[dict setObject: name forKey: [detail timeZoneAbbreviation]];
}
e = [dict keyEnumerator];
while ((abbrev = [e nextObject]) != nil)
{
printf("%s\t%s\n", [abbrev UTF8String], [name UTF8String]);
/* As an abbreviation can map to multiple names, and we only
* want a single 'default' mapping, we only add a new one if
* there is no existing one.
*/
if (nil == [a objectForKey: abbrev])
{
[a setObject: name forKey: abbrev];
}
}
}
}
if (NO == [a writeToFile: @"abbreviations.plist" atomically: NO])
{
NSLog(@"Failed to update 'abbreviations.plist'");
return 1;
}
[pool release];
return 0;
}
|