From b6c1a04204e2f0dd65531e2d51ed652077d7b3f6 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 24 Jan 2007 01:59:30 +0000 Subject: [PATCH] Convert 822-date to be a simple wrapper around 'date -R'. 822-date is now deprecated and should not be used anymore. It might be removed sometime in the future. Closes: #31634, #367712, #314462 Thanks to Frank Lichtenheld. --- ChangeLog | 5 ++++ debian/changelog | 4 ++++ man/822-date.1 | 31 ++++++++++++++---------- man/ChangeLog | 5 ++++ scripts/822-date.pl | 58 ++++++++------------------------------------- 5 files changed, 42 insertions(+), 61 deletions(-) diff --git a/ChangeLog b/ChangeLog index 995466e5..0d17ebd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-01-24 Frank Lichtenheld + + * scripts/822-date.pl: Convert the script to be a simple wrapper + around 'date -R'. + 2007-01-23 Sven Joachim Guillem Jover diff --git a/debian/changelog b/debian/changelog index 3f1de3bc..47a1e48c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,10 @@ dpkg (1.14.0) UNRELEASED; urgency=low create directories when extracting the diff. Closes: #374645 * Fix up and down keystrokes in the dselect help message. Closes: #383438 Thanks to Sven Joachim. + * Convert 822-date to be a simple wrapper around 'date -R'. 822-date is + now deprecated and should not be used anymore. It might be removed + sometime in the future. Closes: #31634, #367712, #314462 + Thanks to Frank Lichtenheld. [ Updated dpkg translations ] * Romanian (Eddy Petrișor). diff --git a/man/822-date.1 b/man/822-date.1 index 2290da6c..afe9251b 100644 --- a/man/822-date.1 +++ b/man/822-date.1 @@ -1,16 +1,21 @@ .\" Hey, Emacs! This is an -*- nroff -*- source file. -.\" Authors: Ian Jackson -.TH 822\-date 1 "2006-02-28" "Debian Project" "dpkg utilities" +.TH 822\-date 1 "2007-01-24" "Debian Project" "dpkg utilities" .SH NAME -822\-date \- Print date and time in RFC822 format +822\-date \- Print date and time in RFC2822 format . .SH SYNOPSIS .B 822\-date . .SH DESCRIPTION .B 822\-date -displays the current date and time in the format described in RFC822, -using a numeric timezone offset as recommended in RFC1123. +displays the current date and time in the format described in RFC2822. +It does so by simply calling +.BR date (1) +with the \fB\-R\fP option. +.PP +.B Using 822\-date is deprecated since +.BR date (1) +provides the same functionality when called with the \fB\-R\fP. . .SH OPTIONS .B 822\-date @@ -21,15 +26,15 @@ This facility really ought to be part of .BR date (1). . .SH SEE ALSO -.I Standard for the Format of ARPA Internet Text Messages -(RFC822), -.br -.I Requirements for Internet Hosts -- Application and Support -(RFC1123) section 5.2.14, -.br +.I Internet Message Format +(RFC2822), .BR date (1). . .SH AUTHOR .B 822\-date -and this manpage were written by Ian Jackson. They are hereby placed -by him into the public domain. +is a really simple wrapper around +.BR date (1). +By its simplicity, the code is probably not copyrightable and +should be considered to be in the public domain. This man page +was written by Frank Lichtenheld based on an earlier version +by Ian Jackson and was also put in the public domain. diff --git a/man/ChangeLog b/man/ChangeLog index 16b80819..59f6a892 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2007-01-24 Frank Lichtenheld + + * 822-date.1: 822-date is now deprecated. Document this fact in + the man page. + 2007-01-16 Nicolas Francois * po/add_fr/dselect.cfg.5.fr.add: New translated man page. diff --git a/scripts/822-date.pl b/scripts/822-date.pl index 1cde7592..800625dd 100755 --- a/scripts/822-date.pl +++ b/scripts/822-date.pl @@ -1,56 +1,18 @@ #!/usr/bin/perl -- -# I hereby place this in the public domain - Ian Jackson, 1995. -# Changes by Klee Dienes also placed in public domain (1997). -# time structure: -# [ sec min hour mday mon year wday yday isdst ] +use strict; +use warnings; -@ARGV && die "usage: 822-date\n"; +my $dpkglibdir = "."; # This line modified by Makefile +push(@INC, $dpkglibdir); +require 'dpkg-gettext.pl'; +textdomain("dpkg-dev"); -$curtime = time; -@localtm = localtime ($curtime); -$localtms = localtime ($curtime); -@gmttm = gmtime ($curtime); -$gmttms = gmtime ($curtime); +require 'controllib.pl'; -if ($localtm[0] != $gmttm[0]) { - die (sprintf ("local timezone differs from GMT by a non-minute interval\n" - . "local time: %s\n" - . "GMT time: %s\n", $localtms, $gmttms)); -} +@ARGV && die _g("Usage: 822-date")."\n"; -$localmin = $localtm[1] + $localtm[2] * 60; -$gmtmin = $gmttm[1] + $gmttm[2] * 60; +&warn(_g("This program is deprecated. Please use 'date -R' instead.")); -if ((($gmttm[6] + 1) % 7) == $localtm[6]) { - $localmin += 1440; -} elsif ((($gmttm[6] - 1) % 7) == $localtm[6]) { - $localmin -= 1440; -} elsif ($gmttm[6] == $localtm[6]) { - 1; -} else { - die ("822-date: local time offset greater than or equal to 24 hours\n"); -} +print `date -R`; -$offset = $localmin - $gmtmin; -$offhour = $offset / 60; -$offmin = abs ($offset % 60); - -if (abs ($offhour) >= 24) { - die ("822-date: local time offset greater than or equal to 24 hours\n"); -} - -printf - ( - "%s, %2d %s %d %02d:%02d:%02d %s%02d%02d\n", - (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$localtm[6]], # day of week - $localtm[3], # day of month - (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$localtm[4]], # month - $localtm[5]+1900, # year - $localtm[2], # hour - $localtm[1], # minute - $localtm[0], # sec - ($offset >= 0) ? '+' : '-',# TZ offset direction - abs ($offhour), # TZ offset hour - $offmin, # TZ offset minute - ) || die "822-date: output error: $!\n"; -- 2.39.5