comparison src/strftime.c @ 5495:1f0b15040456

Merge.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 01 May 2011 18:44:03 +0100
parents 308d34e9f07d
children
comparison
equal deleted inserted replaced
5494:861f2601a38b 5495:1f0b15040456
1 /* strftime - custom formatting of date and/or time 1 /* strftime - custom formatting of date and/or time
2 Copyright (C) 1989, 1991, 1992 Free Software Foundation, Inc. 2 Copyright (C) 1989, 1991, 1992 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This file is part of XEmacs.
5 it under the terms of the GNU General Public License as published by 5
6 the Free Software Foundation; either version 2, or (at your option) 6 XEmacs is free software: you can redistribute it and/or modify it
7 any later version. 7 under the terms of the GNU General Public License as published by the
8 8 Free Software Foundation, either version 3 of the License, or (at your
9 This program is distributed in the hope that it will be useful, 9 option) any later version.
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
12 GNU General Public License for more details. 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
15
14 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
15 along with this program; see the file COPYING. If not, write to 17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
18
19 /* Synched up with: FSF 19.30. */ 18 /* Synched up with: FSF 19.30. */
20 19
21 /* This file has been ... uhhhhh ... Mule-ized. Yeah. 20 /* This file has been ... uhhhhh ... Mule-ized. Yeah.
22 21
23 (Everything here is external format. This is DANGEROUS and 22 (Everything here is external format. This is DANGEROUS and
128 127
129 static char const * const months[] = 128 static char const * const months[] =
130 { 129 {
131 "January", "February", "March", "April", "May", "June", 130 "January", "February", "March", "April", "May", "June",
132 "July", "August", "September", "October", "November", "December" 131 "July", "August", "September", "October", "November", "December"
132 };
133
134 static char const * const roman_upper[] =
135 {
136 "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"
137 };
138
139 static char const * const roman_lower[] =
140 {
141 "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix", "x", "xi", "xii"
133 }; 142 };
134 143
135 /* Add character C to STRING and increment LENGTH, 144 /* Add character C to STRING and increment LENGTH,
136 unless LENGTH would exceed MAX. */ 145 unless LENGTH would exceed MAX. */
137 146
599 add_char ((tm->tm_year + 1900) / 1000 + '0'); 608 add_char ((tm->tm_year + 1900) / 1000 + '0');
600 length += 609 length +=
601 add_num3 (&string[length], 610 add_num3 (&string[length],
602 (1900 + tm->tm_year) % 1000, max - length, zero); 611 (1900 + tm->tm_year) % 1000, max - length, zero);
603 break; 612 break;
613 case '\xe6':
614 length +=
615 add_str (&string[length], roman_lower[tm->tm_mon],
616 max - length);
617 break;
618 case '\xC6':
619 length +=
620 add_str (&string[length], roman_upper[tm->tm_mon],
621 max - length);
622 break;
604 } 623 }
605 } 624 }
606 } 625 }
607 add_char (0); 626 add_char (0);
608 return length - 1; 627 return length - 1;