Checks if the file specified in FileName is a valid .pnm file.
| 31 | |
| 32 | //! Checks if the file specified in FileName is a valid .pnm file. |
| 33 | ILboolean ilIsValidPnm(ILconst_string FileName) |
| 34 | { |
| 35 | ILHANDLE PnmFile; |
| 36 | ILboolean bPnm = IL_FALSE; |
| 37 | |
| 38 | if ( !iCheckExtension(FileName, IL_TEXT("pbm")) |
| 39 | && !iCheckExtension(FileName, IL_TEXT("pgm")) |
| 40 | && !iCheckExtension(FileName, IL_TEXT("ppm")) |
| 41 | && !iCheckExtension(FileName, IL_TEXT("pnm"))) { |
| 42 | ilSetError(IL_INVALID_EXTENSION); |
| 43 | return bPnm; |
| 44 | } |
| 45 | |
| 46 | PnmFile = iopenr(FileName); |
| 47 | if (PnmFile == NULL) { |
| 48 | ilSetError(IL_COULD_NOT_OPEN_FILE); |
| 49 | return bPnm; |
| 50 | } |
| 51 | |
| 52 | bPnm = ilIsValidPnmF(PnmFile); |
| 53 | icloser(PnmFile); |
| 54 | |
| 55 | return bPnm; |
| 56 | } |
| 57 | |
| 58 | |
| 59 | //! Checks if the ILHANDLE contains a valid .pnm file at the current position. |
no test coverage detected