本文整理汇总了C++中out1fmt函数的典型用法代码示例。如果您正苦于以下问题:C++ out1fmt函数的具体用法?C++ out1fmt怎么用?C++ out1fmt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了out1fmt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: printlim
static void printlim(enum limtype how, const struct rlimit *limit,
const struct limits *l)
{
rlim_t val;
val = limit->rlim_max;
if (how & SOFT)
val = limit->rlim_cur;
if (val == RLIM_INFINITY)
out1fmt("unlimited\n");
else {
val /= l->factor;
out1fmt("%" PRIdMAX "\n", (intmax_t) val);
}
}
开发者ID:Agochka,项目名称:klibc,代码行数:16,代码来源:miscbltin.c
示例2: letcmd
/*
* The exp(1) builtin.
*/
int
letcmd(int argc, char **argv)
{
const char *p;
char *concat;
char **ap;
arith_t i;
if (argc > 1) {
p = argv[1];
if (argc > 2) {
/*
* Concatenate arguments.
*/
STARTSTACKSTR(concat);
ap = argv + 2;
for (;;) {
while (*p)
STPUTC(*p++, concat);
if ((p = *ap++) == NULL)
break;
STPUTC(' ', concat);
}
STPUTC('\0', concat);
p = grabstackstr(concat);
}
} else
p = "";
i = arith(p);
out1fmt(ARITH_FORMAT_STR "\n", i);
return !i;
}
开发者ID:camilitodebepensar,项目名称:freebsd-pi,代码行数:37,代码来源:arith_yacc.c
示例3: printalias
static void
printalias(const struct alias *a)
{
out1fmt("%s=", a->name);
out1qstr(a->val);
out1c('\n');
}
开发者ID:0xbda2d2f8,项目名称:freebsd,代码行数:7,代码来源:alias.c
示例4: wordexpcmd
int
wordexpcmd(int argc, char **argv)
{
size_t len;
int i;
out1fmt("%08x", argc - 1);
for (i = 1, len = 0; i < argc; i++)
len += strlen(argv[i]);
out1fmt("%08x", (int)len);
for (i = 1; i < argc; i++) {
out1str(argv[i]);
out1c('\0');
}
return (0);
}
开发者ID:akat1,项目名称:impala,代码行数:16,代码来源:expand.c
示例5: showvars
int
showvars(shinstance *psh, const char *name, int flag, int show_value)
{
struct var **vpp;
struct var *vp;
const char *p;
static struct var **list; /* static in case we are interrupted */
static int list_len;
int count = 0;
if (!list) {
list_len = 32;
list = ckmalloc(psh, list_len * sizeof(*list));
}
for (vpp = psh->vartab ; vpp < psh->vartab + VTABSIZE ; vpp++) {
for (vp = *vpp ; vp ; vp = vp->next) {
if (flag && !(vp->flags & flag))
continue;
if (vp->flags & VUNSET && !(show_value & 2))
continue;
if (count >= list_len) {
list = ckrealloc(psh, list,
(list_len << 1) * sizeof(*list));
list_len <<= 1;
}
list[count++] = vp;
}
}
qsort(list, count, sizeof(*list), sort_var);
for (vpp = list; count--; vpp++) {
vp = *vpp;
if (name)
out1fmt(psh, "%s ", name);
for (p = vp->text ; *p != '=' ; p++)
out1c(psh, *p);
if (!(vp->flags & VUNSET) && show_value) {
out1fmt(psh, "=");
print_quoted(psh, ++p);
}
out1c(psh, '\n');
}
return 0;
}
开发者ID:dezelin,项目名称:kBuild,代码行数:47,代码来源:var.c
示例6: wordexpcmd
int
wordexpcmd(shinstance *psh, int argc, char **argv)
{
size_t len;
int i;
out1fmt(psh, "%d", argc - 1);
out1c(psh, '\0');
for (i = 1, len = 0; i < argc; i++)
len += strlen(argv[i]);
out1fmt(psh, "%zd", len);
out1c(psh, '\0');
for (i = 1; i < argc; i++) {
out1str(psh, argv[i]);
out1c(psh, '\0');
}
return (0);
}
开发者ID:egraba,项目名称:kbuild_openbsd,代码行数:18,代码来源:expand.c
示例7: trapcmd
int
trapcmd(int argc, char **argv)
{
char *action;
char **ap;
int signo;
nextopt(nullstr);
ap = argptr;
if (!*ap) {
for (signo = 0 ; signo < NSIG ; signo++) {
if (trap[signo] != NULL) {
out1fmt(
"trap -- %s %s\n",
single_quote(trap[signo]),
signal_names[signo]
);
}
}
return 0;
}
if (!ap[1])
action = NULL;
else
action = *ap++;
while (*ap) {
if ((signo = decode_signal(*ap, 0)) < 0) {
outfmt(out2, "trap: %s: bad trap\n", *ap);
return 1;
}
INTOFF;
if (action) {
if (action[0] == '-' && action[1] == '\0')
action = NULL;
else {
if (*action)
trapcnt++;
action = savestr(action);
}
}
if (trap[signo]) {
if (*trap[signo])
trapcnt--;
ckfree(trap[signo]);
}
trap[signo] = action;
if (signo != 0)
setsignal(signo);
INTON;
ap++;
}
return 0;
}
开发者ID:alimon,项目名称:dash,代码行数:53,代码来源:trap.c
示例8: bgcmd
int
bgcmd(int argc, char **argv)
{
struct job *jp;
int i;
nextopt("");
do {
jp = getjob(*argptr, 0);
if (jp->jobctl == 0)
error("job not created under job control");
set_curjob(jp, 1);
out1fmt("[%ld] %s", (long)(jp - jobtab + 1), jp->ps[0].cmd);
for (i = 1; i < jp->nprocs; i++)
out1fmt(" | %s", jp->ps[i].cmd );
out1c('\n');
flushall();
restartjob(jp);
} while (*argptr && *++argptr);
return 0;
}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:21,代码来源:jobs.c
示例9: printalias
static void
printalias(const struct alias *a)
{
char *p;
out1fmt("%s=", a->name);
/* Don't print the space added above. */
p = a->val + strlen(a->val) - 1;
*p = '\0';
out1qstr(a->val);
*p = ' ';
out1c('\n');
}
开发者ID:ChaosJohn,项目名称:freebsd,代码行数:13,代码来源:alias.c
示例10: jobidcmd
int
jobidcmd(int argc __unused, char **argv)
{
struct job *jp;
int i;
jp = getjob(argv[1]);
for (i = 0 ; i < jp->nprocs ; ) {
out1fmt("%d", (int)jp->ps[i].pid);
out1c(++i < jp->nprocs? ' ' : '\n');
}
return 0;
}
开发者ID:0xffea,项目名称:MINIX3,代码行数:13,代码来源:jobs.c
示例11: pwd_main
int
pwd_main(int argc, char **argv)
{
char *dir = getpwd();
out1fmt(snlfmt, dir ? dir : "");
if (dir != NULL)
{
free(dir);
}
return 0;
}
开发者ID:hominlinx,项目名称:hot-pot-lab,代码行数:13,代码来源:cd.c
示例12: aliascmd
/*
* TODO - sort output
*/
int
aliascmd(int argc, char **argv)
{
char *n, *v;
int ret = 0;
struct alias *ap;
if (argc == 1) {
int i;
for (i = 0; i < ATABSIZE; i++)
for (ap = atab[i]; ap; ap = ap->next) {
if (*ap->name != '\0') {
out1fmt("alias %s=", ap->name);
print_quoted(ap->val);
out1c('\n');
}
}
return (0);
}
while ((n = *++argv) != NULL) {
if ((v = strchr(n+1, '=')) == NULL) { /* n+1: funny ksh stuff */
if ((ap = lookupalias(n, 0)) == NULL) {
outfmt(out2, "alias: %s not found\n", n);
ret = 1;
} else {
out1fmt("alias %s=", n);
print_quoted(ap->val);
out1c('\n');
}
} else {
*v++ = '\0';
setalias(n, v);
}
}
return (ret);
}
开发者ID:dezelin,项目名称:kBuild,代码行数:41,代码来源:alias.c
示例13: minus_o
STATIC void
minus_o(char *name, int val)
{
int doneset, i;
if (name == NULL) {
if (val) {
/* "Pretty" output. */
out1str("Current option settings\n");
for (i = 0; i < NOPTS; i++)
out1fmt("%-16s%s\n", optlist[i].name,
optlist[i].val ? "on" : "off");
} else {
/* Output suitable for re-input to shell. */
for (doneset = i = 0; i < NOPTS; i++)
if (optlist[i].val) {
if (!doneset) {
out1str("set");
doneset = 1;
}
out1fmt(" -o %s", optlist[i].name);
}
if (doneset)
out1c('\n');
}
} else {
for (i = 0; i < NOPTS; i++)
if (equal(name, optlist[i].name)) {
if (!val && privileged && equal(name, "privileged")) {
(void) setuid(getuid());
(void) setgid(getgid());
}
setoption(optlist[i].letter, val);
return;
}
error("Illegal option -o %s", name);
}
}
开发者ID:mkatri,项目名称:minix,代码行数:38,代码来源:options.c
示例14: printsignals
/*
* Print a list of valid signal names.
*/
static void
printsignals(void)
{
int n, outlen;
outlen = 0;
for (n = 1; n < _NSIG; n++) {
if (strsigname(n)) {
out1fmt("%s", strsigname(n));
outlen += strlen(strsigname(n));
} else {
out1fmt("%d", n);
outlen += 3; /* good enough */
}
++outlen;
if (outlen > 70 || n == _NSIG - 1) {
out1str("\n");
outlen = 0;
} else {
out1c(' ');
}
}
}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:26,代码来源:trap.c
示例15: jobidcmd
int
jobidcmd(int argc, char **argv)
{
struct job *jp;
int i;
nextopt("");
jp = getjob(*argptr, 0);
for (i = 0 ; i < jp->nprocs ; ) {
out1fmt("%ld", (long)jp->ps[i].pid);
out1c(++i < jp->nprocs ? ' ' : '\n');
}
return 0;
}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:14,代码来源:jobs.c
示例16: printsignals
/*
* Print a list of valid signal names.
*/
static void
printsignals(void)
{
int n, outlen;
outlen = 0;
for (n = 1; n < sys_nsig; n++) {
if (sys_signame[n]) {
out1fmt("%s", sys_signame[n]);
outlen += strlen(sys_signame[n]);
} else {
out1fmt("%d", n);
outlen += 3; /* good enough */
}
++outlen;
if (outlen > 71 || n == sys_nsig - 1) {
out1str("\n");
outlen = 0;
} else {
out1c(' ');
}
}
}
开发者ID:AlexZhao,项目名称:freebsd,代码行数:26,代码来源:trap.c
示例17: printsignals
/*
* Print a list of valid signal names
*/
static void
printsignals(void)
{
int n;
out1str("EXIT ");
for (n = 1; n < NSIG; n++) {
out1fmt("%s", sys_signame[n]);
if ((n == NSIG/2) || n == (NSIG - 1))
out1str("\n");
else
out1c(' ');
}
}
开发者ID:2fast4u88,项目名称:oxygen_system_core,代码行数:18,代码来源:trap.c
示例18: print_quoted
void
print_quoted(shinstance *psh, const char *p)
{
const char *q;
if (strcspn(p, "|&;<>()$`\\\"' \t\n*?[]#~=%") == strlen(p)) {
out1fmt(psh, "%s", p);
return;
}
while (*p) {
if (*p == '\'') {
out1fmt(psh, "\\'");
p++;
continue;
}
q = strchr(p, '\'');
if (!q) {
out1fmt(psh, "'%s'", p );
return;
}
out1fmt(psh, "'%.*s'", (int)(q - p), p );
p = q;
}
}
开发者ID:dezelin,项目名称:kBuild,代码行数:24,代码来源:var.c
示例19: cbsdlua_loadcmd
int cbsdlua_loadcmd(int argc, char **argv) {
int error;
// lua_State *L = luaL_newstate();
// luaL_openlibs(L);
if (argc!=2) {
out1fmt("Use: cbsdlua_load <path>\n");
return 1;
}
lua_loadscript(L,argv[1]);
// lua_close(L);
return 0;
}
开发者ID:rhooper,项目名称:cbsd,代码行数:16,代码来源:cbsdlua.c
示例20: printsignals
/*
* Print a list of valid signal names
*/
static void
printsignals(void)
{
int n;
out1str("EXIT ");
#ifndef HAVE_SYS_SIGNAME
init_sys_signame();
#endif
for (n = 1; n < NSIG; n++) {
out1fmt("%s", sys_signame[n]);
if ((n == NSIG/2) || n == (NSIG - 1))
out1str("\n");
else
out1c(' ');
}
}
开发者ID:dezelin,项目名称:kBuild,代码行数:21,代码来源:trap.c
注:本文中的out1fmt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论