static char *sccsid
= "@(#)xhdr.c 1.3 (Berkeley) 7/17/87";
* XHDR header [<messageid>|articlerange]
* header is a case-insensitive header field, minus any colons.
* articlerange is one of:
* an article number followed by a dash to indicate all following
* an article number followed by a dash followed by another
* XHDR subject retrieve subject of current article
* XHDR subject 5589-6325 retrieve subject of arts 5589 to 6325
* XHDR subject 5589- retrieve subject of arts 5589 and up
* XHDR subject 5589 retrieve subject of art 5589 only
* XHDR subject <123@ucbvax> retrieve subject of art <123@ucbvax>
* This command is an extention, and not included in RFC 977.
if (argc
< 2 || argc
> 3) {
printf("%d Usage: XHDR headerfield [artrange|<message-id>]\r\n",
printf("%d You only have permission to transfer, sorry.\r\n",
/* Handle message-id requests */
if (argc
== 3 && *argv
[2] == '<') { /* Message ID */
fp
= openartbyid(argv
[2]);
printf("%d No article by message-id %s, sorry.\r\n",
printf("%d 0 %s header of article %s.\r\n",
OK_HEAD
, argv
[1], argv
[2]);
print_header(fp
, argv
[1], argv
[2]);
* It must be a range of articles, which means that we need
* to be in a newsgroup already.
printf("%d You are not currently in a newsgroup.\r\n",
if (art_ptr
< 0 || art_ptr
>= num_arts
) {
printf("%d No article is currently selected.\r\n",
high
= low
= art_array
[art_ptr
];
cp
= index(argv
[2], '-');
low
= high
= atoi(argv
[2]);
high
= art_array
[num_arts
-1];
printf("%d %s fields follow\r\n", OK_HEAD
, argv
[1]);
if ((artnum
= art_array
[artptr
]) < low
)
(void) sprintf(buf
, "%d", artnum
);
print_header(fp
, argv
[1], buf
);
print_header(fp
, header
, artname
)
while (fgets(line
, sizeof (line
), fp
) != NULL
) {
if (*line
== '\n' || *line
== '\0') {
printf("%s (none)\r\n", artname
);
if (cp
= index(line
, ':')) {
if (streql(header
, line
)) {
if (cp1
= index(cp
+ 2, '\n'))
printf("%s %s\r\n", artname
, cp
+ 2);