         } cleave "gopher://%s:%s/%s%s" sprintf
     ] if >url ;
 
+: gopher-link. ( gopher-link -- )
+    dup type>> CHAR: i = [
+        name>> print
+    ] [
+        [ name>> ] keep [
+            presented ,,
+            COLOR: blue foreground ,,
+        ] H{ } make format nl
+    ] if ;
+
 : gopher-text ( object -- lines )
     utf8 decode string-lines { "." } split1 drop ;
 


PRIVATE>

: gopher ( url -- object )
    gopher* swap {
        { A_TEXT [ gopher-text ] }
        { A_MENU [ gopher-menu ] }
        { A_INDEX [ gopher-menu ] }
        { A_GIF [ gopher-gif ] }
        [ drop ]
    } case ;

: gopher. ( url -- )
    gopher {
        { [ dup byte-array? ] [ . ] }
        { [ dup image? ] [ image. ] }
        [
            [
                dup gopher-link? [
                    dup type>> CHAR: i = [
                        name>> print
                    ] [
                        [ name>> ] keep [
                            presented ,,
                            COLOR: blue foreground ,,
                        ] H{ } make format nl
                    ] if
                ] [
                    print
                ] if
            ] each
        ]
    } cond ;


ERROR: not-a-gopher-url url ;

: gopher ( url -- item-type byte-array )
    dup url? [ >url ] unless
    dup protocol>> "gopher" = [ not-a-gopher-url ] unless {
        [ host>> ]
