นี่คือตัวอย่างโปรแกรมจากหนังสือ "Beginning Linux Programming":
#include <stdio.h> #include <term.h> #include <curses.h> #include <stdlib.h> int main() { setupterm("unlisted", fileno(stdout), (int *)0); printf("Done.\n"); exit(0); }
เรียกใช้ฉันได้ผลลัพธ์นี้:
./badterm 'unlisted': unknown terminal type.
ตามคำจำกัดความของฟังก์ชัน setupterm จะต้องส่งคืน 0: "ไม่มีรายการที่ตรงกันในฐานข้อมูล terminfo" แทนที่จะเป็นเช่นนั้น โปรแกรมจะยุติลง ทำไม?