home *** CD-ROM | disk | FTP | other *** search
- *:*********************************************************************
- *:
- *: Program: SAMETIME.PRG
- *:
- *: System: Give a file the same time stamp as another
- *: Author: John Wright
- *:
- *: Procs & Fncts: FORCE_MAIN
- *:
- *:*********************************************************************
- * 12/17/91 - Created this program.
-
- #INCLUDE date.hdr
- #INCLUDE jdfil.hdr
- #INCLUDE string.hdr
- #INCLUDE system.hdr
-
- *!*********************************************************************
- *!
- *! Procedure: FORCE_MAIN
- *!
- *!*********************************************************************
- PROCEDURE force_main
- PARAMETERS CHAR(127) cmd_line
-
- VARDEF
- CHAR pattern
- CHAR _first_file
- CHAR _second_file
- CHAR(8) _file_date
- CHAR(6) _file_time
- ENDDEF
-
- pattern = LTRIM(cmd_line)
-
- IF pattern = "" .OR. "?" $ pattern
- ?"Syntax: SAMETIME <file> Stamp file with current date & time"
- ?" SAMETIME <file> <file2> Stamp file with date & time of file2"
- ?""
- QUIT
- ENDIF
-
- * Set the variable to the current date and time.
- _file_date = DTOC(TODAY())
- IF SUBSTR(TIME(),1,2) < "12"
- _file_time = SUBSTR(TIME(),1,5)+"a"
- ELSE
- _file_time = SUBSTR(TIME(),1,5)+"p"
- ENDIF
-
- IF " " $ pattern
- _first_file = SUBSTR(pattern,1,AT(" ",pattern)-1)
- _second_file = SUBSTR(pattern,RAT(" ",pattern)+1,(LEN(pattern)-LEN(_first_file)+1))
- IF EXIST(_second_file)
- _file_date = Fgetdate(_second_file)
- _file_time = Fgettime(_second_file)
- ENDIF
- ELSE
- _first_file = pattern
- ENDIF
-
- IF EXIST(_first_file)
- ?"File: "+_first_file
- Fsetdate(_first_file,_file_date)
- ?"Date: "+_file_date
- Fsettime(_first_file,_file_time)
- ?"Time: "+_file_time
- ?""
- ENDIF
-
- QUIT
-
- ENDPRO
-
- *: EOF: SAMETIME.PRG
-