VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /usr/share/GNUstep/Libraries/gnustep-base/Versions/1.26/Resources/NSTimeZones/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/GNUstep/Libraries/gnustep-base/Versions/1.26/Resources/NSTimeZones/create-abbrevs.m
/* 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];

  /* Load preferred abbreviation mappings.
   */
  a = [NSMutableDictionary
    dictionaryWithContentsOfFile: @"preferred_abbreviations.plist"];
  if (nil == a)
    {
      NSLog(@"Unable to load 'preferred_abbreviations.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;
}

VaKeR 2022