-; Struct utsname offsets and size
-utsname_sysname = 0
-utsname_nodename = utsname_sysname + 17
-utsname_release = utsname_nodename + 9
-utsname_version = utsname_release + 9
-utsname_machine = utsname_version + 9
-utsname_size = utsname_machine + 25
-utsname_fieldcount = 5
+; Struct utsname
+.struct utsname
+ sysname .byte 17
+ nodename .byte 9
+ release .byte 9
+ version .byte 9
+ machine .byte 25
+.endstruct
+
; Table with offsets into struct utsname
fieldoffs:
- .byte utsname_sysname
- .byte utsname_nodename
- .byte utsname_release
- .byte utsname_version
- .byte utsname_machine
+ .byte utsname::sysname
+ .byte utsname::nodename
+ .byte utsname::release
+ .byte utsname::version
+ .byte utsname::machine
+
+fieldcount = * - fieldoffs
;--------------------------------------------------------------------------
stx tmp1 ; Field number
next: ldy tmp1
- cpy #utsname_fieldcount
+ cpy #fieldcount
beq done
inc tmp1 ; Bump field counter
lda fieldoffs,y ; Get next field offset