This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static inline int | |
fork_check(void) | |
__attribute__((always_inline)); | |
int fork_check(void) { | |
int result = fork(); | |
if (!result) { | |
exit(0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/stat.h> | |
static inline int | |
fstab_check(void) | |
__attribute__((always_inline)); | |
int fstab_check(void) { | |
struct stat sb; | |
int result = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static inline int | |
files_check(void) | |
__attribute__((always_inline)); | |
int files_check(void) { | |
struct stat sb; | |
int result = 0; | |
if (stat("/bin/bash", &sb) == 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static inline int | |
symbolic_link_check(void) | |
__attribute__((always_inline)); | |
int symbolic_link_check(void) { | |
struct stat sb; | |
int result = 0; | |
if (lstat("/Applications", &sb) == 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(int argc, char *argv[]) | |
{ | |
bool lifeIsGood = YES; //assume things will be good | |
//do checks here...finding something bad sets lifeIsGood to NO | |
if ((fork_check()) | |
|| (files_check()) | |
|| (fstab_check()) | |
|| (symbolic_link_check())) { | |
lifeIsGood = NO; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface NSDate (DateUtils) | |
- (NSDate *)toLocalTime; | |
- (NSString *)toLocalShortTime; | |
- (NSString *)toLocalShortDate; | |
- (NSString *)toLocalShortDate2; | |
- (NSString *)toLocalHeaderDate; | |
- (NSString *)toLocalArticleDetailDate; | |
@end |