#!usr/bin/perl ########################################################################### # # # Library Fuction Written by Julian Figueroa # # 1997 - 1998 # # # ########################################################################### # COPYRIGHT NOTICE # # Copyright 1997-1998 Julian Figueroa All Rights Reserved. # # # # News_updater may be used and modified free of charge by anyone so long # # as this copyright notice and the comments above remain intact. By # # using this code you agree to indemnify Julian from any # # liability that might arise from it's use. # # # # Selling the code for this program without prior written consent is # # expressly forbidden. In other words, please ask first before you try # # and make money off of the program. # # # # Obtain permission before redistributing this software over the Internet # # or in any other medium. In all cases copyright and header must remain # # intact. # ########################################################################### sub FILE_CHECK { @FILE_LIST = @_; foreach $FILE_TO_CHECK (@FILE_LIST) { if (!(-e $FILE_TO_CHECK)) { open(FILE_TO_OPEN, ">$FILE_TO_CHECK"); close(FILE_TO_OPEN); } } return(0); } #### CHECKS IF FILE IS LEGITIMATE THEN READS CONTENTS #### USE @RETURN_VALUE = &FILE_READ(FILE_ASSOCIATION, PATH); sub FILE_READ { @FILE_READ = @_; $FILE_PATH = $FILE_READ[1]; $FILE_ASSOCIATION = $FILE_READ[0]; { if (-e $FILE_PATH) { chmod ($FILE_PATH, 0777); open($FILE_ASSOCIATION, "$FILE_PATH"); @RETURN_STRING = <$FILE_ASSOCIATION>; } else { open($FILE_ASSOCIATION, ">$FILE_PATH"); @RETURN_STRING = ""; chmod ($FILE_PATH, 0777); } close($FILE_ASSOCIATION); return(@RETURN_STRING); } } sub TOUCH { @FILE_LIST = @_; foreach $FILE_TO_CHECK (@FILE_LIST) { open(FILE_TO_OPEN, ">$FILE_TO_CHECK"); close(FILE_TO_OPEN); chmod($FILE_TO_CHECK, 0777); } return(1); } sub DIRECTORY_CHECK { @DIR_LIST = @_; $STATUS = 0; foreach $DIR_TO_CHECK (@DIR_LIST) { if (!(open (DATADIR, "$DIR_TO_CHECK"))) { mkdir ("$DIR_TO_CHECK", 0777) } close DATADIR; } return($STATUS); } 1;