ICU-597 Make the definition for main more consistent for OS/400.
X-SVN-Rev: 2473
This commit is contained in:
parent
fb5bafafe6
commit
7783b01356
@ -65,7 +65,7 @@ static UOption options[]={
|
||||
|
||||
|
||||
extern int
|
||||
main(int argc, const char *argv[]) {
|
||||
main(int argc, char* argv[]) {
|
||||
|
||||
UResourceBundle *bundle = NULL;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
@ -62,7 +62,7 @@ static UOption options[]={
|
||||
char symPrefix[100];
|
||||
|
||||
extern int
|
||||
main(int argc, const char *argv[]) {
|
||||
main(int argc, char* argv[]) {
|
||||
/* read command line options */
|
||||
argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options);
|
||||
|
||||
|
@ -89,7 +89,7 @@ static UOption options[]={
|
||||
char symPrefix[100];
|
||||
|
||||
extern int
|
||||
main(int argc, const char *argv[]) {
|
||||
main(int argc, char* argv[]) {
|
||||
static uint8_t buffer[4096];
|
||||
char line[512];
|
||||
FileStream *in, *file;
|
||||
|
@ -130,7 +130,7 @@ static UOption options[]={
|
||||
};
|
||||
|
||||
extern int
|
||||
main(int argc, const char *argv[]) {
|
||||
main(int argc, char* argv[]) {
|
||||
char line[512];
|
||||
const char *path;
|
||||
FileStream *in;
|
||||
|
@ -204,7 +204,7 @@ static UOption options[]={
|
||||
};
|
||||
|
||||
extern int
|
||||
main(int argc, const char *argv[]) {
|
||||
main(int argc, char* argv[]) {
|
||||
UVersionInfo version;
|
||||
UBool store10Names=FALSE;
|
||||
|
||||
@ -279,6 +279,9 @@ lineFn(void *context,
|
||||
char *name1Start, *name2Start;
|
||||
int16_t name1Length, name2Length;
|
||||
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
/* get the character code */
|
||||
code=uprv_strtoul(fields[0][0], NULL, 16);
|
||||
|
||||
@ -381,7 +384,7 @@ skipNoise(char *line, int16_t start, int16_t limit) {
|
||||
char c;
|
||||
|
||||
/* skip anything that is not part of a word in this sense */
|
||||
while(start<limit && !('A'<=(c=line[start]) && c<='Z' || '0'<=c && c<='9')) {
|
||||
while(start<limit && !(('A'<=(c=line[start]) && c<='Z') || ('0'<=c && c<='9'))) {
|
||||
++start;
|
||||
}
|
||||
|
||||
@ -393,7 +396,7 @@ getWord(char *line, int16_t start, int16_t limit) {
|
||||
char c=0; /* initialize to avoid a compiler warning although the code was safe */
|
||||
|
||||
/* a unicode character name word consists of A-Z0-9 */
|
||||
while(start<limit && ('A'<=(c=line[start]) && c<='Z' || '0'<=c && c<='9')) {
|
||||
while(start<limit && (('A'<=(c=line[start]) && c<='Z') || ('0'<=c && c<='9'))) {
|
||||
++start;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ static UOption options[]={
|
||||
};
|
||||
|
||||
extern int
|
||||
main(int argc, const char *argv[]) {
|
||||
main(int argc, char* argv[]) {
|
||||
char filename[300];
|
||||
const char *srcDir=NULL, *destDir=NULL, *suffix=NULL;
|
||||
char *basename=NULL;
|
||||
|
@ -84,7 +84,7 @@ UOption options[]={
|
||||
|
||||
int
|
||||
main(int argc,
|
||||
char **argv)
|
||||
char* argv[])
|
||||
{
|
||||
int i;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
@ -95,10 +95,10 @@ main(int argc,
|
||||
UBool verbose;
|
||||
|
||||
#ifdef XP_MAC_CONSOLE
|
||||
argc = ccommand(&argv);
|
||||
argc = ccommand((char***)&argv);
|
||||
#endif
|
||||
|
||||
argc = u_parseArgs(argc, (const char**)argv, sizeof(options)/sizeof(options[0]), options);
|
||||
argc = u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options);
|
||||
|
||||
/* error handling, printing usage message */
|
||||
if(argc<0) {
|
||||
|
@ -52,7 +52,7 @@ static UOption options[]={
|
||||
};
|
||||
|
||||
extern int
|
||||
main(int argc, const char *argv[]) {
|
||||
main(int argc, char* argv[]) {
|
||||
/* preset then read command line options */
|
||||
options[2].value=u_getDataDirectory();
|
||||
argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options);
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "filestrm.h"
|
||||
#include "unicode/udata.h"
|
||||
//#include "unicode/udata.h"
|
||||
#include "unewdata.h"
|
||||
#include "uoptions.h"
|
||||
#include "tzdat.h"
|
||||
@ -106,7 +106,7 @@ class gentz {
|
||||
UBool useCopyright;
|
||||
|
||||
public:
|
||||
int main(int argc, const char *argv[]);
|
||||
int gentzMain(int argc, char *argv[]);
|
||||
private:
|
||||
int32_t writeTzDatFile(const char *destdir);
|
||||
void parseTzTextFile(FileStream* in);
|
||||
@ -137,12 +137,12 @@ private:
|
||||
void die(const char* msg);
|
||||
};
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
int main(int argc, char *argv[]) {
|
||||
gentz x;
|
||||
#ifdef XP_MAC_CONSOLE
|
||||
argc=ccommand((char***)&argv);
|
||||
#endif
|
||||
return x.main(argc, argv);
|
||||
return x.gentzMain(argc, argv);
|
||||
}
|
||||
|
||||
const int32_t gentz::MAX_GMT_OFFSET = (int32_t)24*60*60; // seconds
|
||||
@ -164,7 +164,7 @@ static UOption options[]={
|
||||
UOPTION_DESTDIR
|
||||
};
|
||||
|
||||
int gentz::main(int argc, const char *argv[]) {
|
||||
int gentz::gentzMain(int argc, char* argv[]) {
|
||||
/* preset then read command line options */
|
||||
options[3].value=u_getDataDirectory();
|
||||
argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options);
|
||||
|
@ -133,10 +133,10 @@ char *
|
||||
char *
|
||||
strtoupper (char *name)
|
||||
{
|
||||
int32_t i = 0;
|
||||
|
||||
while (name[i] = (char)uprv_toupper(name[i]))
|
||||
i++;
|
||||
do {
|
||||
*name = (char)uprv_toupper(*name);
|
||||
}
|
||||
while (*(name++));
|
||||
|
||||
return name;
|
||||
}
|
||||
@ -250,7 +250,7 @@ static UOption options[]={
|
||||
UOPTION_VERBOSE /* 5 */
|
||||
};
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
UConverterSharedData* mySharedData = NULL;
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
@ -354,7 +354,8 @@ int main(int argc, const char *argv[])
|
||||
}
|
||||
|
||||
/*removes the extension if any is found*/
|
||||
if (dot = uprv_strrchr(outBasename, '.'))
|
||||
dot = uprv_strrchr(outBasename, '.');
|
||||
if (dot)
|
||||
{
|
||||
*dot = '\0';
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ const char options_help[][160]={
|
||||
|
||||
|
||||
int
|
||||
main(int argc, const char *argv[]) {
|
||||
main(int argc, char* argv[]) {
|
||||
FileStream *out;
|
||||
UPKGOptions o;
|
||||
CharList *tail;
|
||||
|
@ -21,9 +21,9 @@
|
||||
#include "uoptions.h"
|
||||
|
||||
U_CAPI int U_EXPORT2
|
||||
u_parseArgs(int argc, const char *argv[],
|
||||
u_parseArgs(int argc, char* argv[],
|
||||
int optionCount, UOption options[]) {
|
||||
const char *arg;
|
||||
char *arg;
|
||||
int i=1, remaining=1;
|
||||
char c, stopOptions=0;
|
||||
|
||||
|
@ -106,9 +106,16 @@ struct UOption {
|
||||
* If an option is not recognized or an argument missing, then
|
||||
* the parser returns with the negative index of the argv[] entry
|
||||
* where the error was detected.
|
||||
*
|
||||
* The OS/400 compiler requires that argv either be "char* argv[]",
|
||||
* or "const char* const argv[]", and it will not accept,
|
||||
* "const char* argv[]" as a definition for main().
|
||||
*
|
||||
* @param argv This parameter is modified
|
||||
* @param options This parameter is modified
|
||||
*/
|
||||
U_CAPI int U_EXPORT2
|
||||
u_parseArgs(int argc, const char *argv[],
|
||||
u_parseArgs(int argc, char* argv[],
|
||||
int optionCount, UOption options[]);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user