本文整理汇总了C++中outfmt函数的典型用法代码示例。如果您正苦于以下问题:C++ outfmt函数的具体用法?C++ outfmt怎么用?C++ outfmt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了outfmt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TNC_TNCS_ReportMessageTypesLong
TNC_Result TNC_TNCS_ReportMessageTypesLong(
/*in*/ TNC_IMVID imvID,
/*in*/ TNC_VendorIDList supportedVendorIDs,
/*in*/ TNC_MessageSubtypeList supportedSubtypes,
/*in*/ TNC_UInt32 typeCount)
{
unsigned i;
if( typeCount > g_nImvMessageLongSubtypesCount )
{
g_pImvMessageLongSubtypes = (TNC_MessageSubtypeList) realloc( g_pImvMessageLongSubtypes, sizeof( *supportedSubtypes ) * typeCount );
g_pImvVendorIDs = (TNC_VendorIDList) realloc( g_pImvVendorIDs, sizeof(TNC_VendorID) * typeCount );
}
outfmt( OUT_LEVEL_NORMAL, "< TNC_TNCS_ReportMessageTypesLong (IMV %d)", imvID );
if( typeCount > 0 )
{
memcpy( g_pImvMessageLongSubtypes, supportedSubtypes, sizeof( *supportedSubtypes ) * typeCount );
memcpy( g_pImvVendorIDs, supportedVendorIDs, sizeof( *supportedVendorIDs ) * typeCount );
g_nImvMessageLongSubtypesCount = typeCount;
for( i=0; i < typeCount; ++i )
outfmt( OUT_LEVEL_NORMAL, "%c(vendor ID %#x, message subtype %#x)%c",
0 == i ? '\n' : ' ',
g_pImvVendorIDs[i],
g_pImvMessageLongSubtypes[i],
i == typeCount - 1 ? '\n' : ',' );
}
else
{
outfmt( OUT_LEVEL_NORMAL, "\nEmpty message list. No messages will be delivered to this IMV!\n" );
}
return TNC_RESULT_SUCCESS;
}
示例2: TNC_TNCS_SendMessageLong
TNC_Result TNC_TNCS_SendMessageLong(
/*in*/ TNC_IMVID imvID,
/*in*/ TNC_ConnectionID connectionID,
/*in*/ TNC_UInt32 messageFlags,
/*in*/ TNC_BufferReference message,
/*in*/ TNC_UInt32 messageLength,
/*in*/ TNC_VendorID messageVendorID,
/*in*/ TNC_MessageSubtype messageSubtype,
/*in*/ TNC_UInt32 destinationIMCID)
{
MESSAGE_LONG longTypeMessage;
outfmt( OUT_LEVEL_NORMAL, "< TNC_TNCS_SendMessageLong: IMV %d, CID %d, "
"msg length %d, vendor ID %#x msg subtype %#x, msg flags %#x, destIMCID %#x\n",
imvID, connectionID, messageLength, messageVendorID,
messageSubtype, messageFlags, destinationIMCID );
outfmt( OUT_LEVEL_VERBOSE, "< IMC message data:\n" );
outmessage( OUT_LEVEL_VERBOSE, message, messageLength );
longTypeMessage.imcID = destinationIMCID;
longTypeMessage.imvID = imvID;
longTypeMessage.message = message;
longTypeMessage.messageFlags = messageFlags;
longTypeMessage.messageLength = messageLength;
longTypeMessage.messageSubtype = messageSubtype;
longTypeMessage.messageVendorID = messageVendorID;
QueueAddMessageLong( &longTypeMessage );
return TNC_RESULT_SUCCESS;
}
示例3: exvwarning
static void
exvwarning(int sv_errno, const char *msg, va_list ap)
{
/* Partially emulate line buffered output so that:
* printf '%d\n' 1 a 2
* and
* printf '%d %d %d\n' 1 a 2
* both generate sensible text when stdout and stderr are merged.
*/
if (output.nextc != output.buf && output.nextc[-1] == '\n')
flushout(&output);
if (commandname)
outfmt(&errout, "%s: ", commandname);
else
outfmt(&errout, "%s: ", getprogname());
if (msg != NULL) {
doformat(&errout, msg, ap);
if (sv_errno >= 0)
outfmt(&errout, ": ");
}
if (sv_errno >= 0)
outfmt(&errout, "%s", strerror(sv_errno));
out2c('\n');
flushout(&errout);
}
示例4: synerror
STATIC void
synerror(char *msg)
{
if (commandname)
outfmt(&errout, "%s: %d: ", commandname, startlinno);
outfmt(&errout, "Syntax error: %s\n", msg);
error((char *)NULL);
}
示例5: setterm
void
setterm(const char *term)
{
if (el != NULL && term != NULL)
if (el_set(el, EL_TERMINAL, term) != 0) {
outfmt(out2, "sh: Can't set terminal type %s\n", term);
outfmt(out2, "sh: Using dumb terminal settings.\n");
}
}
示例6: vwarning
static void
vwarning(const char *msg, va_list ap)
{
if (commandname)
outfmt(out2, "%s: ", commandname);
else if (arg0)
outfmt(out2, "%s: ", arg0);
doformat(out2, msg, ap);
out2fmt_flush("\n");
}
示例7: ImvBatchEnding
unsigned ImvBatchEnding( TNC_ConnectionID cid )
{
TNC_Result rc = TNC_RESULT_SUCCESS;
if( NULL != imvFuncs.pfnBatchEnding )
{
outfmt( OUT_LEVEL_NORMAL, "> TNC_IMV_BatchEnding (IMV: %d, CID: %d)\n", IMV_ID, cid );
rc = imvFuncs.pfnBatchEnding( IMV_ID, cid );
outfmt( OUT_LEVEL_NORMAL, "> TNC_IMV_BatchEnding result: %d\n", rc );
}
return rc;
}
示例8: LoadIMV
int LoadIMV(const char *dllPath)
{
int err;
outfmt( OUT_LEVEL_NORMAL, "Loading IMV DLL: \"%s\"...", dllPath );
err = LoadImvDLL( dllPath, &imvFuncs );
if (err)
{
outfmt( OUT_LEVEL_NORMAL, " Error %d.\n", err);
return TNC_RESULT_OTHER;
}
outfmt( OUT_LEVEL_NORMAL, " Ok\n" );
return TNC_RESULT_SUCCESS;
}
示例9: NotifyImvConnectionState
unsigned NotifyImvConnectionState( TNC_ConnectionID cid, TNC_ConnectionState state )
{
TNC_Result rc = TNC_RESULT_SUCCESS;
extern char *g_pszConnStates[];
if( NULL != imvFuncs.pfnNotifyConnectionChange )
{
outfmt( OUT_LEVEL_NORMAL, "> TNC_IMV_NotifyConnectionChange (IMV: %d, CID: %d, state: `%s')\n",
IMV_ID, cid, g_pszConnStates[ state ] );
rc = imvFuncs.pfnNotifyConnectionChange( IMV_ID, cid, state );
outfmt( OUT_LEVEL_NORMAL, "> TNC_IMV_NotifyConnectionChange result: %d\n", rc );
}
return rc;
}
示例10: subevalvar_misc
static int
subevalvar_misc(char *p, const char *var, int subtype, int startloc,
int varflags)
{
char *startp;
struct nodelist *saveargbackq = argbackq;
int amount;
argstr(p, EXP_TILDE, NULL);
STACKSTRNUL(expdest);
argbackq = saveargbackq;
startp = stackblock() + startloc;
switch (subtype) {
case VSASSIGN:
setvar(var, startp, 0);
amount = startp - expdest;
STADJUST(amount, expdest);
return 1;
case VSQUESTION:
if (*p != CTLENDVAR) {
outfmt(out2, "%s\n", startp);
error((char *)NULL);
}
error("%.*s: parameter %snot set", (int)(p - var - 1),
var, (varflags & VSNUL) ? "null or " : "");
return 0;
default:
abort();
}
}
示例11: gather_month_strings
std::vector<std::basic_string<charT> >
gather_month_strings(const std::locale& locale, bool short_strings=true)
{
typedef std::basic_string<charT> string_type;
typedef std::vector<string_type> collection_type;
typedef std::basic_ostringstream<charT> ostream_type;
typedef std::ostreambuf_iterator<charT> ostream_iter_type;
typedef std::basic_ostringstream<charT> stringstream_type;
typedef std::time_put<charT> time_put_facet_type;
charT short_fmt[3] = { '%', 'b' };
charT long_fmt[3] = { '%', 'B' };
collection_type months;
string_type outfmt(short_fmt);
if (!short_strings) {
outfmt = long_fmt;
}
{
//grab the needed strings by using the locale to
//output each month
for (int m=0; m < 12; m++) {
tm tm_value;
tm_value.tm_mon = m;
stringstream_type ss;
ostream_iter_type oitr(ss);
std::use_facet<time_put_facet_type>(locale).put(oitr, ss, ss.fill(),
&tm_value,
&*outfmt.begin(),
&*outfmt.begin()+outfmt.size());
months.push_back(ss.str());
}
}
return months;
}
示例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) {
printalias(ap);
}
return (0);
}
while ((n = *++argv) != NULL) {
if ((v = strchr(n+1, '=')) == NULL) { /* n+1: funny ksh stuff */
if ((ap = *__lookupalias(n)) == NULL) {
outfmt(out2, "%s: %s not found\n", "alias", n);
ret = 1;
} else
printalias(ap);
} else {
*v++ = '\0';
setalias(n, v);
}
}
return (ret);
}
示例13: aliascmd
int
aliascmd(int argc, char **argv)
{
char *n, *v;
int ret = 0;
struct alias *ap;
if (argc == 1) {
printaliases();
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
printalias(ap);
else {
*v++ = '\0';
setalias(n, v);
}
}
return (ret);
}
示例14: chkmail
void
chkmail(void)
{
const char *mpath;
char *p;
char *q;
time_t *mtp;
struct stackmark smark;
#ifdef WINDOWS
struct stat statb;
#else
struct stat64 statb;
#endif
setstackmark(&smark);
mpath = mpathset() ? mpathval() : mailval();
for (mtp = mailtime; mtp < mailtime + MAXMBOXES; mtp++) {
p = padvance(&mpath, nullstr);
if (p == NULL)
break;
if (*p == '\0')
continue;
for (q = p ; *q ; q++);
#ifdef DEBUG
if (q[-1] != '/')
abort();
#endif
q[-1] = '\0'; /* delete trailing '/' */
#ifdef WINDOWS
if (stat(p, &statb) < 0) {
#else
if (stat64(p, &statb) < 0) {
#endif
*mtp = 0;
continue;
}
if (!changed && statb.st_mtime != *mtp) {
outfmt(
&errout, snlfmt,
pathopt ? pathopt : "you have mail"
);
}
*mtp = statb.st_mtime;
}
changed = 0;
popstackmark(&smark);
}
void
changemail(const char *val)
{
changed++;
}
示例15: strtoul
String *jnl_readprompt (const char *prompt)
{
char *buff, header[16], *p;
String *string;
uLong strln;
/* If recovery file open, read from it, otherwise read from terminal */
if (recover_file == NULL) goto readterminal;
if (fgets (header, sizeof header, recover_file) == NULL) goto closerecovery;
if (header[0] != '*') goto badrecovery;
if (strcmp (header + 1, "EOF\n") == 0) {
string = NULL;
goto writejournal;
}
strln = strtoul (header + 1, &p, 10);
if (*p != '\n') goto badrecovery;
buff = malloc (strln + 1);
if (fread (buff, strln, 1, recover_file) == 0) goto closerecovery;
string = string_create (strln, buff);
buff[strln] = 0;
outfmt (strlen (prompt) + strlen (buff), "%s%s\n", prompt, buff);
free (buff);
goto writejournal;
badrecovery:
outerr (strlen (header), "bad recovery file format at %s\n", header);
closerecovery:
fclose (recover_file);
recover_file = NULL;
/* Read from terminal screen after flushing any output */
readterminal:
output ();
string = os_readprompt (prompt);
/* Write journal record */
writejournal:
if (journal_file != NULL) {
if (string == NULL) fprintf (journal_file, "*EOF\n");
else {
strln = string_getlen (string);
fprintf (journal_file, "*%u\n", strln);
fwrite (string_getval (string), strln, 1, journal_file);
}
}
/* Return pointer to string (NULL for eof) */
return (string);
}