iPXE
message.c File Reference

Message printing. More...

#include <stddef.h>
#include <stdint.h>
#include <stdarg.h>
#include <unistd.h>
#include <ipxe/ansicol.h>
#include <ipxe/message.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
static void vmsg (unsigned int row, const char *fmt, va_list args)
 Print message centred on specified row.
void msg (unsigned int row, const char *fmt,...)
 Print message centred on specified row.
void clearmsg (unsigned int row)
 Clear message on specified row.
static void valert (unsigned int row, const char *fmt, va_list args)
 Show alert message.
void alert (unsigned int row, const char *fmt,...)
 Show alert message.

Detailed Description

Message printing.

Definition in file message.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ vmsg()

void vmsg ( unsigned int row,
const char * fmt,
va_list args )
static

Print message centred on specified row.

Parameters
rowRow
fmtprintf() format string
argsprintf() argument list

Definition at line 47 of file message.c.

47 {
48 char buf[COLS];
49 size_t len;
50
51 len = vsnprintf ( buf, sizeof ( buf ), fmt, args );
52 mvprintw ( row, ( ( COLS - len ) / 2 ), "%s", buf );
53}
#define mvprintw(y, x, fmt,...)
Definition curses.h:649
ring len
Length.
Definition dwmac.h:226
#define COLS
Definition vga.h:27
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
Write a formatted string to a buffer.
Definition vsprintf.c:352
int ssize_t const char * fmt
Definition vsprintf.h:73

References COLS, fmt, len, mvprintw, and vsnprintf().

Referenced by msg(), and valert().

◆ msg()

void msg ( unsigned int row,
const char * fmt,
... )

Print message centred on specified row.

Parameters
rowRow
fmtprintf() format string
..printf() arguments

Definition at line 62 of file message.c.

62 {
63 va_list args;
64
65 va_start ( args, fmt );
66 vmsg ( row, fmt, args );
67 va_end ( args );
68}
static void vmsg(unsigned int row, const char *fmt, va_list args)
Print message centred on specified row.
Definition message.c:47
#define va_end(ap)
Definition stdarg.h:10
#define va_start(ap, last)
Definition stdarg.h:8
__builtin_va_list va_list
Definition stdarg.h:7

References fmt, va_end, va_start, and vmsg().

Referenced by ccmp_kie_decrypt(), ccmp_kie_mic(), cms_message_okx(), cms_verify_fail_okx(), cms_verify_okx(), draw_errors(), draw_form(), draw_info_row(), draw_instruction_row(), draw_title_row(), eap_rx_request(), eap_tx_response(), hv_post_message(), hv_wait_for_message(), igbvf_read_mbx_vf(), igbvf_read_posted_mbx(), igbvf_write_mbx_vf(), igbvf_write_posted_mbx(), intelvf_mbox_msg(), intelvf_mbox_poll(), intelvf_mbox_read(), intelvf_mbox_reset(), intelvf_mbox_set_mac(), intelvf_mbox_set_mtu(), intelvf_mbox_write(), intelxvf_mbox_queues(), intelxvf_mbox_version(), ipair_key(), ipair_rx(), ipair_rx_pair(), ipair_rx_pubkey(), ipair_rx_session(), ipair_tag(), ipair_tx(), netvsc_establish_buffer(), netvsc_initialise(), netvsc_ndis_version(), netvsc_recv_data(), netvsc_revoke_buffer(), netvsc_transmit(), ntlm_data_okx(), pci_msix_enable(), peerblk_parse_block(), peerblk_parse_header(), peerblk_parse_iv(), peerblk_parse_useless(), peerblk_retrieval_open(), reg_delay(), rndis_rx_data(), rndis_rx_status(), rndis_tx_data(), rndis_tx_defer(), rndis_tx_halt(), rndis_tx_initialise(), rndis_tx_oid(), sis190_phy_task(), slirp_guest_error(), tkip_kie_decrypt(), tkip_kie_mic(), usbio_config(), usbio_control_poll(), xcm_deliver(), xenstore_request(), xenstore_response(), xsmp_chassis_name(), xsmp_rx_session(), xsmp_rx_session_confirm(), xsmp_rx_session_hello(), xsmp_rx_session_reject(), xsmp_rx_session_shutdown(), xsmp_rx_xve(), xsmp_rx_xve_delete(), xsmp_rx_xve_install(), xsmp_rx_xve_modify(), xsmp_rx_xve_oper_req(), xsmp_rx_xve_ready(), xsmp_rx_xve_update(), xsmp_session_name(), xsmp_tx_session(), xsmp_tx_xve(), xsmp_tx_xve_nack(), xsmp_tx_xve_notify(), and xsmp_tx_xve_params().

◆ clearmsg()

void clearmsg ( unsigned int row)

Clear message on specified row.

Parameters
rowRow

Definition at line 75 of file message.c.

75 {
76 move ( row, 0 );
77 clrtoeol();
78}
static int move(int y, int x)
Definition curses.h:594
static int clrtoeol(void)
Definition curses.h:554

References clrtoeol(), and move().

Referenced by draw_errors(), draw_info_row(), draw_instruction_row(), draw_setting_rows(), draw_title_row(), and valert().

◆ valert()

void valert ( unsigned int row,
const char * fmt,
va_list args )
static

Show alert message.

Parameters
rowRow
fmtprintf() format string
argsprintf() argument list

Definition at line 87 of file message.c.

87 {
88
89 clearmsg ( row );
91 vmsg ( row, fmt, args );
92 sleep ( 2 );
94 clearmsg ( row );
95}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
#define color_set(cpno, opts)
Definition curses.h:241
#define CPAIR_NORMAL
Normal text.
Definition ansicol.h:41
#define CPAIR_ALERT
Error text.
Definition ansicol.h:53
void clearmsg(unsigned int row)
Clear message on specified row.
Definition message.c:75
unsigned int sleep(unsigned int secs)
Sleep (interruptibly) for a fixed number of seconds.
Definition timer.c:134

References clearmsg(), color_set, CPAIR_ALERT, CPAIR_NORMAL, fmt, NULL, sleep(), and vmsg().

Referenced by alert().

◆ alert()

void alert ( unsigned int row,
const char * fmt,
... )

Show alert message.

Parameters
rowRow
fmtprintf() format string
...printf() arguments

Definition at line 104 of file message.c.

104 {
105 va_list args;
106
107 va_start ( args, fmt );
108 valert ( row, fmt, args );
109 va_end ( args );
110}
static void valert(unsigned int row, const char *fmt, va_list args)
Show alert message.
Definition message.c:87

References fmt, va_end, va_start, and valert().

Referenced by main_loop(), and tls_new_alert().