1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/nsprpub/pr/tests/op_filok.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/*********************************************************************** 1.10 +** 1.11 +** Name: op_filok.c 1.12 +** 1.13 +** Description: Test Program to verify the PR_Open finding an existing file. 1.14 +** 1.15 +** Modification History: 1.16 +** 03-June-97 AGarcia- Initial version 1.17 +***********************************************************************/ 1.18 + 1.19 +/*********************************************************************** 1.20 +** Includes 1.21 +***********************************************************************/ 1.22 +/* Used to get the command line option */ 1.23 +#include "prinit.h" 1.24 +#include "prmem.h" 1.25 +#include "prio.h" 1.26 +#include "prerror.h" 1.27 +#include <stdio.h> 1.28 + 1.29 +static PRFileDesc *t1; 1.30 + 1.31 +int main(int argc, char **argv) 1.32 +{ 1.33 + PR_STDIO_INIT(); 1.34 + 1.35 + t1 = PR_Open(argv[0], PR_RDONLY, 0666); 1.36 + 1.37 + if (t1 == NULL) { 1.38 + printf ("error code is %d \n", PR_GetError()); 1.39 + printf ("File %s should be found\n", argv[0]); 1.40 + return 1; 1.41 + } else { 1.42 + if (PR_Close(t1) == PR_SUCCESS) { 1.43 + printf ("Test passed \n"); 1.44 + return 0; 1.45 + } else { 1.46 + printf ("cannot close file\n"); 1.47 + printf ("error code is %d\n", PR_GetError()); 1.48 + return 1; 1.49 + } 1.50 + } 1.51 +}