2
** Written by David Gerdes US Army Construction Engineering Research Lab
4
** Copyright 1992 USA-CERL All rights reserved.
10
** read from stdin and each line into a linked list of chars
11
** then print it back out. if there is any argument specified
12
** the lines will be printed out reversed.
16
#include <grass/linkm.h>
24
int main(int argc, char *argv[])
28
struct link List, *tmp, *p;
40
link_set_chunk_size(1);
41
head = (VOID_T *) link_init(sizeof(struct link));
44
while (NULL != gets(buf)) {
45
for (i = 0; buf[i] != '\0'; i++) {
46
tmp = (struct link *)link_new(head);
49
add_link_rev(&List, tmp);
58
while (p != NULL && p->next != NULL) {
60
link_dispose(head, p);
71
int add_link_rev(struct link *List, struct link *link)
80
int add_link(struct link *List, struct link *link)
85
while (p->next != NULL)
91
int dumplist(struct link *List)