本文整理汇总了C++中pager_open函数的典型用法代码示例。如果您正苦于以下问题:C++ pager_open函数的具体用法?C++ pager_open怎么用?C++ pager_open使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pager_open函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: command_lskern
int
command_lskern(int argc, char *argv[])
{
struct preloaded_file *fp;
char lbuf[80];
int ch, verbose;
verbose = 0;
optind = 1;
optreset = 1;
pager_open();
for (fp = preloaded_files; fp; fp = fp->f_next) {
snprintf(lbuf, sizeof(lbuf), " %p: %s (%s, 0x%lx)\n",
(void *) fp->f_addr, fp->f_name, fp->f_type, (long) fp->f_size);
pager_output(lbuf);
if (fp->f_args != NULL) {
pager_output(" args: ");
pager_output(fp->f_args);
pager_output("\n");
}
}
pager_close();
return(CMD_OK);
}
示例2: list_timezones
static int list_timezones(int argc, char **argv, void *userdata) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus *bus = userdata;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
int r;
char** zones;
r = sd_bus_call_method(bus,
"org.freedesktop.timedate1",
"/org/freedesktop/timedate1",
"org.freedesktop.timedate1",
"ListTimezones",
&error,
&reply,
NULL);
if (r < 0)
return log_error_errno(r, "Failed to request list of time zones: %s",
bus_error_message(&error, r));
r = sd_bus_message_read_strv(reply, &zones);
if (r < 0)
return bus_log_parse_error(r);
(void) pager_open(arg_pager_flags);
strv_print(zones);
return 0;
}
示例3: efipart_print
static void
efipart_print(int verbose)
{
char line[80];
EFI_BLOCK_IO *blkio;
EFI_HANDLE h;
EFI_STATUS status;
u_int unit;
pager_open();
for (unit = 0, h = efi_find_handle(&efipart_dev, 0);
h != NULL; h = efi_find_handle(&efipart_dev, ++unit)) {
sprintf(line, " %s%d:", efipart_dev.dv_name, unit);
if (pager_output(line))
break;
status = BS->HandleProtocol(h, &blkio_guid, (void **)&blkio);
if (!EFI_ERROR(status)) {
sprintf(line, " %llu blocks",
(unsigned long long)(blkio->Media->LastBlock + 1));
if (pager_output(line))
break;
if (blkio->Media->RemovableMedia)
if (pager_output(" (removable)"))
break;
}
if (pager_output("\n"))
break;
}
pager_close();
}
示例4: pager_open_if_enabled
static void pager_open_if_enabled(void) {
if (arg_no_pager)
return;
pager_open(false);
}
示例5: pager_open_if_enabled
static void pager_open_if_enabled(void) {
/* Cache result before we open the pager */
if (arg_no_pager)
return;
pager_open(false);
}
示例6: list_timezones
static int list_timezones(int argc, char **argv, void *userdata) {
_cleanup_strv_free_ char **zones = NULL;
int r;
r = get_timezones(&zones);
if (r < 0)
return log_error_errno(r, "Failed to read list of time zones: %m");
(void) pager_open(arg_no_pager, false);
strv_print(zones);
return 0;
}
示例7: list_vconsole_keymaps
static int list_vconsole_keymaps(int argc, char **argv, void *userdata) {
_cleanup_strv_free_ char **l = NULL;
int r;
r = get_keymaps(&l);
if (r < 0)
return log_error_errno(r, "Failed to read list of keymaps: %m");
(void) pager_open(arg_no_pager, false);
strv_print(l);
return 0;
}
示例8: main
int main(int argc, char *argv[]) {
int r, k;
r = parse_argv(argc, argv);
if (r <= 0)
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();
umask(0022);
r = 0;
if (argc > optind) {
int i;
for (i = optind; i < argc; i++) {
k = apply_file(argv[i], false);
if (k < 0 && r == 0)
r = k;
}
} else {
_cleanup_strv_free_ char **files = NULL;
char **f;
r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char**) CONF_PATHS_STRV("binfmt.d"));
if (r < 0) {
log_error_errno(r, "Failed to enumerate binfmt.d files: %m");
goto finish;
}
if (arg_cat_config) {
(void) pager_open(arg_no_pager, false);
r = cat_files(NULL, files, 0);
goto finish;
}
/* Flush out all rules */
write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
STRV_FOREACH(f, files) {
k = apply_file(*f, true);
if (k < 0 && r == 0)
r = k;
}
}
示例9: command_configuration
static int
command_configuration(int argc, char *argv[])
{
char line[80];
UINTN i;
snprintf(line, sizeof(line), "NumberOfTableEntries=%lu\n",
(unsigned long)ST->NumberOfTableEntries);
pager_open();
if (pager_output(line)) {
pager_close();
return (CMD_OK);
}
for (i = 0; i < ST->NumberOfTableEntries; i++) {
EFI_GUID *guid;
printf(" ");
guid = &ST->ConfigurationTable[i].VendorGuid;
if (!memcmp(guid, &mps, sizeof(EFI_GUID)))
printf("MPS Table");
else if (!memcmp(guid, &acpi, sizeof(EFI_GUID)))
printf("ACPI Table");
else if (!memcmp(guid, &acpi20, sizeof(EFI_GUID)))
printf("ACPI 2.0 Table");
else if (!memcmp(guid, &smbios, sizeof(EFI_GUID)))
printf("SMBIOS Table %p",
ST->ConfigurationTable[i].VendorTable);
else if (!memcmp(guid, &dxe, sizeof(EFI_GUID)))
printf("DXE Table");
else if (!memcmp(guid, &hoblist, sizeof(EFI_GUID)))
printf("HOB List Table");
else if (!memcmp(guid, &memtype, sizeof(EFI_GUID)))
printf("Memory Type Information Table");
else if (!memcmp(guid, &debugimg, sizeof(EFI_GUID)))
printf("Debug Image Info Table");
else if (!memcmp(guid, &fdtdtb, sizeof(EFI_GUID)))
printf("FDT Table");
else
printf("Unknown Table (%s)", guid_to_string(guid));
snprintf(line, sizeof(line), " at %p\n",
ST->ConfigurationTable[i].VendorTable);
if (pager_output(line))
break;
}
pager_close();
return (CMD_OK);
}
示例10: efinet_dev_print
static void
efinet_dev_print(int verbose)
{
char line[80];
EFI_HANDLE h;
int unit;
pager_open();
for (unit = 0, h = efi_find_handle(&efinet_dev, 0);
h != NULL; h = efi_find_handle(&efinet_dev, ++unit)) {
sprintf(line, " %s%d:\n", efinet_dev.dv_name, unit);
if (pager_output(line))
break;
}
pager_close();
}
示例11: list_timezones
static int list_timezones(sd_bus *bus, char **args, unsigned n) {
_cleanup_strv_free_ char **zones = NULL;
int r;
assert(args);
assert(n == 1);
r = get_timezones(&zones);
if (r < 0)
return log_error_errno(r, "Failed to read list of time zones: %m");
pager_open(arg_no_pager, false);
strv_print(zones);
return 0;
}
示例12: command_lsmod
static int
command_lsmod(int argc, char *argv[])
{
struct loaded_module *am;
struct module_metadata *md;
char lbuf[80];
int ch, verbose;
verbose = 0;
optind = 1;
optreset = 1;
while ((ch = getopt(argc, argv, "v")) != -1) {
switch(ch) {
case 'v':
verbose = 1;
break;
case '?':
default:
/* getopt has already reported an error */
return(CMD_OK);
}
}
pager_open();
for (am = loaded_modules; (am != NULL); am = am->m_next) {
sprintf(lbuf, " %p: %s (%s, 0x%lx)\n",
(void *) am->m_addr, am->m_name, am->m_type, (long) am->m_size);
pager_output(lbuf);
if (am->m_args != NULL) {
pager_output(" args: ");
pager_output(am->m_args);
pager_output("\n");
}
if (verbose)
/* XXX could add some formatting smarts here to display some better */
for (md = am->m_metadata; md != NULL; md = md->md_next) {
sprintf(lbuf, " 0x%04x, 0x%lx\n", md->md_type, (long) md->md_size);
pager_output(lbuf);
}
}
pager_close();
return(CMD_OK);
}
示例13: efinet_dev_print
static void
efinet_dev_print(int verbose)
{
CHAR16 *text;
EFI_HANDLE h;
int unit;
pager_open();
for (unit = 0, h = efi_find_handle(&efinet_dev, 0);
h != NULL; h = efi_find_handle(&efinet_dev, ++unit)) {
printf(" %s%d:", efinet_dev.dv_name, unit);
text = efi_devpath_name(efi_lookup_devpath(h));
if (text != NULL) {
printf(" %S", text);
efi_free_devpath_name(text);
}
if (pager_output("\n"))
break;
}
pager_close();
}
示例14: command_commandlist
/*
* Please note: although we use the pager for the list of commands,
* this routine is called from the ? FORTH function which then
* unconditionally prints some commands. This will lead to anomalous
* behavior. There's no 'pager_output' binding to FORTH to allow
* things to work right, so I'm documenting the bug rather than
* fixing it.
*/
static int
command_commandlist(int argc, char *argv[])
{
struct bootblk_command **cmdp;
int res;
char name[20];
res = 0;
pager_open();
res = pager_output("Available commands:\n");
SET_FOREACH(cmdp, Xcommand_set) {
if (res)
break;
if (((*cmdp)->c_name != NULL) && ((*cmdp)->c_desc != NULL)) {
sprintf(name, " %-15s ", (*cmdp)->c_name);
pager_output(name);
pager_output((*cmdp)->c_desc);
res = pager_output("\n");
}
}
pager_close();
return(CMD_OK);
}
示例15: hexdump
/*
* Display a region in traditional hexdump format.
*/
void
hexdump(caddr_t region, size_t len)
{
caddr_t line;
int x, c;
char lbuf[80];
#define emit(fmt, args...) {sprintf(lbuf, fmt , ## args); pager_output(lbuf);}
pager_open();
for (line = region; line < (region + len); line += 16) {
emit("%08lx ", (long) line);
for (x = 0; x < 16; x++) {
if ((line + x) < (region + len)) {
emit("%02x ", *(u_int8_t *)(line + x));
} else {
emit("-- ");
}
if (x == 7)
emit(" ");
}
emit(" |");
for (x = 0; x < 16; x++) {
if ((line + x) < (region + len)) {
c = *(u_int8_t *)(line + x);
if ((c < ' ') || (c > '~')) /* !isprint(c) */
c = '.';
emit("%c", c);
} else {
emit(" ");
}
}
emit("|\n");
}
pager_close();
}