/*++ Copyright (c) 2013 Minoca Corp. All Rights Reserved Module Name: touch.c Abstract: This module implements support for the "touch" utility. Author: Evan Green 16-Aug-2013 Environment: POSIX --*/ // // ------------------------------------------------------------------- Includes // #include #include #include #include #include #include #include #include #include #include #include "swlib.h" // // ---------------------------------------------------------------- Definitions // // // Define the year after which it's assumed the century is 1900. // #define TWO_DIGIT_YEAR_CUTOFF 70 #define TOUCH_VERSION_MAJOR 1 #define TOUCH_VERSION_MINOR 0 #define TOUCH_USAGE \ "usage: touch [-acm][-r reference_file | -t time] file...\n\n" \ "The touch utility shall change the modification time, access time, or \n" \ "both of a file. It can also be used to create new files. If neither \n" \ "-a nor -m is specified, touch behaves as if both are specified. \n" \ "Options are:\n" \ " -a -- Change the access time of a file.\n" \ " -c, --no-create -- Do not create the file if it does not exist.\n" \ " -m -- Change the modification time of the file.\n" \ " -r, --reference -- Use the corresponding time of \n" \ " the given reference file instead of the current time.\n" \ " -t, --time