
#include <exec/types.h>
#include <stdio.h>
#include <linklibs/nisse.h>

STRING dummy size 256

DEFLNG a-z

STRUCT node
 STRING nm
 ADDRESS nxt
END STRUCT

DECLARE STRUCT node *head,*new.item,*curr,*temp

SUB make.node
 make.node = ALLOC(SIZEOF(node))
END SUB

head = make.node
IF head = NULL THEN
  printf("head node can't be allocated!\n")
  STOP
END IF

head->nm = ""
head->nxt = NULL
curr = head

REPEAT
 GetLine("type a name (or QUIT): ",dummy)
 new.item = make.node
 IF new.item <> NULL THEN
  new.item->nm = dummy
  new.item->nxt = NULL

  curr->nxt = new.item
  curr = curr->nxt
 ELSE
  printf("new node can't be allocated!\n")
 END IF
UNTIL UCASE$(dummy) = "QUIT" OR new.item=NULL

CRTClrScr
curr = head->nxt
WHILE curr <> NULL
  IF UCASE$(curr->nm) <> "QUIT"  THEN
     printf("%s\n",curr->nm)
  END if
  curr = curr->nxt
WEND
