/*
+***********************************************************************
+* © 2016 and later: Unicode, Inc. and others.
+* License & terms of use: http://www.unicode.org/copyright.html#License
+***********************************************************************
**********************************************************************
-* Copyright (C) 1998-2004, International Business Machines Corporation
+* Copyright (C) 1998-2012, International Business Machines Corporation
* and others. All Rights Reserved.
**********************************************************************
*
int printUsage = 0;
int printVersion = 0;
UBool useLongNames = 0;
- int optind = 1;
+ int optInd = 1;
char *arg;
int32_t month = -1, year = -1;
UErrorCode status = U_ZERO_ERROR;
/* parse the options */
- for(optind = 1; optind < argc; ++optind) {
- arg = argv[optind];
+ for(optInd = 1; optInd < argc; ++optInd) {
+ arg = argv[optInd];
/* version info */
if(strcmp(arg, "-v") == 0 || strcmp(arg, "--version") == 0) {
/* POSIX.1 says all arguments after -- are not options */
else if(strcmp(arg, "--") == 0) {
/* skip the -- */
- ++optind;
+ ++optInd;
break;
}
/* unrecognized option */
}
/* Get the month and year to display, if specified */
- if(optind != argc) {
+ if(optInd != argc) {
/* Month and year specified */
- if(argc - optind == 2) {
- sscanf(argv[optind], "%d", (int*)&month);
- sscanf(argv[optind + 1], "%d", (int*)&year);
+ if(argc - optInd == 2) {
+ sscanf(argv[optInd], "%d", (int*)&month);
+ sscanf(argv[optInd + 1], "%d", (int*)&year);
/* Make sure the month value is legal */
if(month < 0 || month > 12) {
}
/* Only year specified */
else {
- sscanf(argv[optind], "%d", (int*)&year);
+ sscanf(argv[optInd], "%d", (int*)&year);
}
}
}
for(i = 0; i < arrayLength; i++) {
- int32_t index = (i + firstIndex) % arrayLength;
- int32_t size = 1 + udat_getSymbols(fmt, type, index + lowestIndex, NULL, 0, status);
+ int32_t idx = (i + firstIndex) % arrayLength;
+ int32_t size = 1 + udat_getSymbols(fmt, type, idx + lowestIndex, NULL, 0, status);
- array[index] = (UChar *) malloc(sizeof(UChar) * size);
+ array[idx] = (UChar *) malloc(sizeof(UChar) * size);
*status = U_ZERO_ERROR;
- udat_getSymbols(fmt, type, index + lowestIndex, array[index], size, status);
+ udat_getSymbols(fmt, type, idx + lowestIndex, array[idx], size, status);
}
}
/* ========== Generate the header containing the month and year */
/* Open a formatter with a month and year only pattern */
- dfmt = udat_open(UDAT_IGNORE,UDAT_IGNORE,NULL,NULL,0,pat, len,status);
+ dfmt = udat_open(UDAT_PATTERN,UDAT_PATTERN,NULL,NULL,0,pat, len,status);
/* Format the date */
udat_format(dfmt, ucal_getMillis(c, status), s, BUF_SIZE, 0, status);
/* ========== Generate the header containing the year (only) */
/* Open a formatter with a month and year only pattern */
- dfmt = udat_open(UDAT_IGNORE,UDAT_IGNORE,NULL,NULL,0,pat, len, status);
+ dfmt = udat_open(UDAT_PATTERN,UDAT_PATTERN,NULL,NULL,0,pat, len, status);
/* Format the date */
udat_format(dfmt, ucal_getMillis(left_cal, status), s, BUF_SIZE, 0, status);