summaryrefslogtreecommitdiffstats
path: root/nsprpub/pr/tests/op_excl.c
diff options
context:
space:
mode:
Diffstat (limited to 'nsprpub/pr/tests/op_excl.c')
-rw-r--r--nsprpub/pr/tests/op_excl.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/nsprpub/pr/tests/op_excl.c b/nsprpub/pr/tests/op_excl.c
index 4b46891f5..e214af125 100644
--- a/nsprpub/pr/tests/op_excl.c
+++ b/nsprpub/pr/tests/op_excl.c
@@ -13,8 +13,8 @@
** 27-Oct-1999 lth. Initial version
***********************************************************************/
-#include <plgetopt.h>
-#include <nspr.h>
+#include <plgetopt.h>
+#include <nspr.h>
#include <stdio.h>
#include <stdlib.h>
@@ -55,23 +55,25 @@ int main(int argc, char **argv)
PLOptStatus os;
PLOptState *opt = PL_CreateOptState(argc, argv, "hd");
- 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 'h': /* help message */
- Help();
- break;
- default:
- break;
+ case 'd': /* debug */
+ debug = 1;
+ msgLevel = PR_LOG_ERROR;
+ break;
+ case 'h': /* help message */
+ Help();
+ break;
+ default:
+ break;
}
}
- PL_DestroyOptState(opt);
+ PL_DestroyOptState(opt);
}
lm = PR_NewLogModule("Test"); /* Initialize logging */
@@ -81,21 +83,27 @@ int main(int argc, char **argv)
*/
fd = PR_Open( NEW_FILENAME, PR_CREATE_FILE | PR_EXCL | PR_WRONLY, 0666 );
if ( NULL == fd ) {
- if (debug) fprintf( stderr, "Open exclusive. Expected success, got failure\n");
+ if (debug) {
+ fprintf( stderr, "Open exclusive. Expected success, got failure\n");
+ }
failed_already = 1;
goto Finished;
}
written = PR_Write( fd, outBuf, OUT_SIZE );
if ( OUT_SIZE != written ) {
- if (debug) fprintf( stderr, "Write after open exclusive failed\n");
+ if (debug) {
+ fprintf( stderr, "Write after open exclusive failed\n");
+ }
failed_already = 1;
goto Finished;
}
rv = PR_Close(fd);
if ( PR_FAILURE == rv ) {
- if (debug) fprintf( stderr, "Close after open exclusive failed\n");
+ if (debug) {
+ fprintf( stderr, "Close after open exclusive failed\n");
+ }
failed_already = 1;
goto Finished;
}
@@ -105,19 +113,25 @@ int main(int argc, char **argv)
*/
fd = PR_Open( NEW_FILENAME, PR_CREATE_FILE | PR_EXCL | PR_WRONLY, 0666 );
if ( NULL != fd ) {
- if (debug) fprintf( stderr, "Open exclusive. Expected failure, got success\n");
+ if (debug) {
+ fprintf( stderr, "Open exclusive. Expected failure, got success\n");
+ }
failed_already = 1;
PR_Close(fd);
}
rv = PR_Delete( NEW_FILENAME );
if ( PR_FAILURE == rv ) {
- if (debug) fprintf( stderr, "PR_Delete() failed\n");
+ if (debug) {
+ fprintf( stderr, "PR_Delete() failed\n");
+ }
failed_already = 1;
}
Finished:
- 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 op_excl.c */