op_filnf.c (1505B)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 /*********************************************************************** 7 ** 8 ** Name: op_filnf.c 9 ** 10 ** Description: Test Program to verify the PR_FILE_NOT_FOUND_ERROR 11 ** This test program also uses the TRUNCATE option 12 ** 13 ** Modification History: 14 ** 03-June-97 AGarcia- Initial version 15 ***********************************************************************/ 16 17 /*********************************************************************** 18 ** Includes 19 ***********************************************************************/ 20 /* Used to get the command line option */ 21 #include "prinit.h" 22 #include "prmem.h" 23 #include "prio.h" 24 #include "prerror.h" 25 #include <stdio.h> 26 #include "plgetopt.h" 27 28 static PRFileDesc* t1; 29 PRIntn error_code; 30 31 int main(int argc, char** argv) { 32 t1 = PR_Open("./tmp-ttools/err03.tmp", PR_TRUNCATE | PR_RDWR, 0666); 33 if (t1 == NULL) { 34 if (PR_GetError() == PR_FILE_NOT_FOUND_ERROR) { 35 printf("error code is %d \n", PR_GetError()); 36 printf("PASS\n"); 37 return 0; 38 } else { 39 printf("error code is %d \n", PR_GetError()); 40 printf("FAIL\n"); 41 return 1; 42 } 43 } 44 PR_Close(t1); 45 printf("opened a file that should not exist\n"); 46 printf("FAIL\n"); 47 return 1; 48 }