summaryrefslogtreecommitdiffstats
path: root/nsprpub/pr/tests/mbcs.c
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-01-02 21:01:38 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-01-02 21:01:38 +0100
commitf7d30133221896638f7bf4f66c504255c4b14f48 (patch)
tree5f3e07a049f388a3a309a615b8884318f6668a98 /nsprpub/pr/tests/mbcs.c
parent26b297510a11758727438df4669357a2a2bc42ce (diff)
downloadUXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.gz
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.lz
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.tar.xz
UXP-f7d30133221896638f7bf4f66c504255c4b14f48.zip
Issue #1338 - Part 1: Update NSPR to 4.24
Diffstat (limited to 'nsprpub/pr/tests/mbcs.c')
-rw-r--r--nsprpub/pr/tests/mbcs.c66
1 files changed, 35 insertions, 31 deletions
diff --git a/nsprpub/pr/tests/mbcs.c b/nsprpub/pr/tests/mbcs.c
index 50d5dd009..1a0d08f84 100644
--- a/nsprpub/pr/tests/mbcs.c
+++ b/nsprpub/pr/tests/mbcs.c
@@ -10,9 +10,9 @@
**
** where dirName is the directory to be traversed. dirName is required.
**
-** Description:
+** Description:
** mbcs.c tests use of multi-byte characters, as would be passed to
-** NSPR funtions by internationalized applications.
+** NSPR funtions by internationalized applications.
**
** mbcs.c, when run on any single-byte platform, should run correctly.
** In truth, running the mbcs test on a single-byte platform is
@@ -31,11 +31,11 @@
** named such that when represented in the local multi-byte character
** set, one or more characters of the name is longer than a single
** byte.
-**
+**
*/
-#include <plgetopt.h>
-#include <nspr.h>
+#include <plgetopt.h>
+#include <nspr.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -68,29 +68,29 @@ static void TraverseDirectory( unsigned char *dir )
printf("Directory: %s\n", dir );
cwd = PR_OpenDir( dir );
if ( NULL == cwd ) {
- printf("PR_OpenDir() failed on directory: %s, with error: %d, %d\n",
- dir, PR_GetError(), PR_GetOSError());
+ printf("PR_OpenDir() failed on directory: %s, with error: %d, %d\n",
+ dir, PR_GetError(), PR_GetOSError());
exit(1);
}
while( NULL != (dirEntry = PR_ReadDir( cwd, PR_SKIP_BOTH | PR_SKIP_HIDDEN ))) {
sprintf( file, "%s/%s", dir, dirEntry->name );
rc = PR_GetFileInfo( file, &info );
if ( PR_FAILURE == rc ) {
- printf("PR_GetFileInfo() failed on file: %s, with error: %d, %d\n",
- dirEntry->name, PR_GetError(), PR_GetOSError());
+ printf("PR_GetFileInfo() failed on file: %s, with error: %d, %d\n",
+ dirEntry->name, PR_GetError(), PR_GetOSError());
exit(1);
}
if ( PR_FILE_FILE == info.type ) {
printf("File: %s \tsize: %ld\n", dirEntry->name, info.size );
fd = PR_Open( file, PR_RDONLY, 0 );
if ( NULL == fd ) {
- printf("PR_Open() failed. Error: %ld, OSError: %ld\n",
- PR_GetError(), PR_GetOSError());
+ printf("PR_Open() failed. Error: %ld, OSError: %ld\n",
+ PR_GetError(), PR_GetOSError());
}
rc = PR_Close( fd );
if ( PR_FAILURE == rc ) {
- printf("PR_Close() failed. Error: %ld, OSError: %ld\n",
- PR_GetError(), PR_GetOSError());
+ printf("PR_Close() failed. Error: %ld, OSError: %ld\n",
+ PR_GetError(), PR_GetOSError());
}
} else if ( PR_FILE_DIRECTORY == info.type ) {
sprintf( nextDir, "%s/%s", dir, dirEntry->name );
@@ -104,44 +104,46 @@ static void TraverseDirectory( unsigned char *dir )
rc = PR_CloseDir( cwd );
if ( PR_FAILURE == rc ) {
- printf("PR_CloseDir() failed on directory: %s, with error: %d, %d\n",
- dir, PR_GetError(), PR_GetOSError());
+ printf("PR_CloseDir() failed on directory: %s, with error: %d, %d\n",
+ dir, PR_GetError(), PR_GetOSError());
}
} /* end TraverseDirectory() */
int main(int argc, char **argv)
{
- { /* get command line options */
+ { /* get command line options */
/*
** Get command line options
*/
PLOptStatus os;
PLOptState *opt = PL_CreateOptState(argc, argv, "dv");
- while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
+ while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
- if (PL_OPT_BAD == os) continue;
+ if (PL_OPT_BAD == os) {
+ continue;
+ }
switch (opt->option)
{
- case 'd': /* debug */
- debug = 1;
- msgLevel = PR_LOG_ERROR;
- break;
- case 'v': /* verbose mode */
- msgLevel = PR_LOG_DEBUG;
- break;
- default:
- dirName = strdup(opt->value);
- break;
+ case 'd': /* debug */
+ debug = 1;
+ msgLevel = PR_LOG_ERROR;
+ break;
+ case 'v': /* verbose mode */
+ msgLevel = PR_LOG_DEBUG;
+ break;
+ default:
+ dirName = strdup(opt->value);
+ break;
}
}
- PL_DestroyOptState(opt);
+ PL_DestroyOptState(opt);
} /* end get command line options */
lm = PR_NewLogModule("Test"); /* Initialize logging */
-
+
if ( dirName == NULL ) {
printf("you gotta specify a directory as an operand!\n");
exit(1);
@@ -149,7 +151,9 @@ int main(int argc, char **argv)
TraverseDirectory( dirName );
- if (debug) printf("%s\n", (failed_already)? "FAIL" : "PASS");
+ if (debug) {
+ printf("%s\n", (failed_already)? "FAIL" : "PASS");
+ }
return( (failed_already == PR_TRUE )? 1 : 0 );
} /* main() */
/* end template.c */