~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/ui/helpline.c

Version: ~ [ linux-5.9-rc6 ] ~ [ linux-5.8.10 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.66 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.146 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.198 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.236 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.236 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 #include <stdio.h>
  3 #include <stdlib.h>
  4 #include <string.h>
  5 
  6 #include "../debug.h"
  7 #include "helpline.h"
  8 #include "ui.h"
  9 #include "../util.h"
 10 
 11 char ui_helpline__current[512];
 12 
 13 static void nop_helpline__pop(void)
 14 {
 15 }
 16 
 17 static void nop_helpline__push(const char *msg __maybe_unused)
 18 {
 19 }
 20 
 21 static int nop_helpline__show(const char *fmt __maybe_unused,
 22                                va_list ap __maybe_unused)
 23 {
 24         return 0;
 25 }
 26 
 27 static struct ui_helpline default_helpline_fns = {
 28         .pop    = nop_helpline__pop,
 29         .push   = nop_helpline__push,
 30         .show   = nop_helpline__show,
 31 };
 32 
 33 struct ui_helpline *helpline_fns = &default_helpline_fns;
 34 
 35 void ui_helpline__pop(void)
 36 {
 37         helpline_fns->pop();
 38 }
 39 
 40 void ui_helpline__push(const char *msg)
 41 {
 42         helpline_fns->push(msg);
 43 }
 44 
 45 void ui_helpline__vpush(const char *fmt, va_list ap)
 46 {
 47         char *s;
 48 
 49         if (vasprintf(&s, fmt, ap) < 0)
 50                 vfprintf(stderr, fmt, ap);
 51         else {
 52                 ui_helpline__push(s);
 53                 free(s);
 54         }
 55 }
 56 
 57 void ui_helpline__fpush(const char *fmt, ...)
 58 {
 59         va_list ap;
 60 
 61         va_start(ap, fmt);
 62         ui_helpline__vpush(fmt, ap);
 63         va_end(ap);
 64 }
 65 
 66 void ui_helpline__puts(const char *msg)
 67 {
 68         ui_helpline__pop();
 69         ui_helpline__push(msg);
 70 }
 71 
 72 int ui_helpline__vshow(const char *fmt, va_list ap)
 73 {
 74         return helpline_fns->show(fmt, ap);
 75 }
 76 
 77 void ui_helpline__printf(const char *fmt, ...)
 78 {
 79         va_list ap;
 80 
 81         ui_helpline__pop();
 82         va_start(ap, fmt);
 83         ui_helpline__vpush(fmt, ap);
 84         va_end(ap);
 85 }
 86 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp