This is example.c in view mode; [Download] [Up]
#import <c.h>
#import <stdio.h>
#import <stdlib.h>
#ifdef SECURE
#import "cryptsum.h"
#endif
void main(int argc, char *argv[])
{
int status = EXIT_SUCCESS;
#ifdef SECURE
char *message = NULL;
switch(status = cs_checkkey("__TEXT", "__text", PASSWORD)) {
case CS_SUCCESS : break;
case CS_NOMATCH : message = "Checksum invalid!"; break;
case CS_NOENTRY : message = "No checksum entry present!"; break;
case CS_NOSECTION : message = "Attempt to checksum nonexistant section!"; break;
case CS_NOCHECKSUM : message = "No checksum table available!"; break;
case CERROR : default : message = "Unknown system error in checksum routine!"; break;
}
if(status == CS_SUCCESS) status = EXIT_SUCCESS;
else {
(void) fprintf(stderr, "%s\n", message);
status = EXIT_FAILURE;
}
#endif
exit(status);
}These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.