本文整理汇总了C++中printmsg函数的典型用法代码示例。如果您正苦于以下问题:C++ printmsg函数的具体用法?C++ printmsg怎么用?C++ printmsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printmsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: frdmsg
short frdmsg(char *str)
{
char *smax;
char *s = str;
smax = s + MAXPACK - 1;
for (;;) {
if (sread(s, 1, M_fPacketTimeout) <= 0)
{
printmsg(0,"frdmsg: timeout reading message");
*s++ = '\0';
goto msgerr;
}
if (*s == '\r')
break;
if (*s < ' ')
continue;
if (s++ >= smax)
{
printmsg(0,"frdmsg: buffer overflow");
*--s = '\0';
goto msgerr;
} /* if (s++ >= smax) */
}
*s = '\0';
return DCP_OK;
msgerr:
printmsg(0,"frdmsg: Message received \"%s\"", str);
return DCP_FAILED;
} /* frdmsg */
示例2: imStatus
static void imStatus(IMFILE *imf)
{
#ifdef UDEBUG
if (imf->buffer != NULL)
printmsg(18,"imStatus: "
#ifdef BIT32ENV
"%p"
#else
"%Fp"
#endif
" buffer address, %ld bytes used, %ld bytes capacity, "
"current position %ld%s%s",
imf->buffer,
imf->inUse,
imf->length,
imf->position,
imeof(imf) ? ", EOF" : "",
imerror(imf) ? ", ERROR" : "");
#endif
else if (imf->filename != NULL)
{
/* Only report the file is on disk once */
if ((imf->flag & IM_FLAG_DISKR) == 0)
{
imf->flag |= IM_FLAG_DISKR;
printmsg(5,"imStatus: File resides on disk as %s with %ld bytes",
imf->filename,
imlength( imf ));
}
}
else
printmsg(5,"imstatus: No backing store exists for file");
} /* imStatus */
示例3: main
int main(int argc,char** argv)
{
const char* server_name;
int port =__COMMON_PORT__;
if (argc > 2) {
port = atoi(argv[2]);
if(port <= 0) {
printmsg("DIE! Invalid port");
exit(1);
}
}
if (argc > 1) {
server_name = argv[1];
}
else {
server_name = "localhost";
}
if(signal(SIGPIPE,SIG_IGN)==SIG_ERR) {
printmsg("DIE! signal(SIGPIPE)");
exit(1);
}
sOperacion ops[500];
int totalops = cargar_archivo(&ops[0]);
main_proc(server_name,port,ops,totalops);
}
示例4: ddelay
void ddelay( const KEWSHORT milliseconds )
{
MSG msg;
WORD TimerId = 1;
BOOL bTimerDone = KWFalse;
/*--------------------------------------------------------------------*/
/* A 0-delay call means give up control to Windows */
/*--------------------------------------------------------------------*/
if (milliseconds == 0)
{
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return;
}
TimerId = SetTimer( hOurWindow,
TimerId,
(milliseconds > 55) ? (WORD)milliseconds : (WORD)55 ,
NULL );
if ( TimerId == 0 )
{
printmsg(0, "WindowsDelay: Unable to set Windows Timer");
panic();
return;
} /* if */
/*--------------------------------------------------------------------*/
/* LOCAL MESSAGE LOOP - Service Windows while waiting for */
/* the timer message. */
/*--------------------------------------------------------------------*/
while(!bTimerDone && GetMessage(&msg, NULL, NULL, NULL))
{
TranslateMessage(&msg);
switch( msg.message )
{
case WM_TIMER:
bTimerDone = KWTrue;
/* Fall through and dispatch message */
default:
DispatchMessage(&msg);
break;
} /* switch( msg.message ) */
} /* while */
if (KillTimer( hOurWindow, TimerId ) == 0)
printmsg(0, "WindowsDelay: Unable to kill Windows Timer %d",
(int) TimerId );
} /* ddelay */
示例5: do_test
/* Check if negative offsets are handled correctly by mmap. */
static int
do_test (void)
{
const int prot = PROT_READ | PROT_WRITE;
const int flags = MAP_SHARED;
const unsigned long length = 0x10000;
const unsigned long offset = 0xace00000;
const unsigned long size = offset + length;
void *addr;
int fd;
char fname[] = "tst-mmap-offset-XXXXXX";
fd = mkstemp64 (fname);
if (fd < 0)
return printmsg (1, "mkstemp");
if (unlink (fname))
return printmsg (1, "unlink");
if (ftruncate64 (fd, size))
return printmsg (0, "ftruncate64");
addr = mmap (NULL, length, prot, flags, fd, offset);
if (MAP_FAILED == addr)
return printmsg (1, "mmap");
/* This memcpy is likely to SIGBUS if mmap has messed up with offset. */
memcpy (addr, fname, sizeof (fname));
return 0;
}
示例6: iflowcontrol
void iflowcontrol( KWBoolean flow )
{
#ifdef ARTICOMM_INT14 /* Richard H. Gumpertz ([email protected]), 28 Sep 1993 */
union REGS regs; /* Scratch area for interrupt calls. */
/*
With INT14, don't open and close the port; toggle it in place
by using INT14/AX=800A, which is again Artisoft-specific.
*/
printmsg(4, "iflowcontrol: %sabling in-band flow control",
(flow ? "en" : "dis"));
regs.x.ax = 0x800A;
regs.h.bl = (unsigned char) (flow ? 2 : 1);
/* 2 is hardware, 1 is XON/XOFF */
regs.x.dx = portNum;
int86(0x14, ®s, ®s);
#else /* ARTICOMM_INT14 */
if (flow)
{
printmsg(4, "iflowcontrol: in-band flow control not supported");
}
#endif /* ARTICOMM_INT14 */
ShowModem();
} /* iflowcontrol */
示例7: pWinSockInit
KWBoolean pWinSockInit( void )
{
/*--------------------------------------------------------------------*/
/* Load the library */
/*--------------------------------------------------------------------*/
if (!hWinsock)
hWinsock = LoadLibrary("WINSOCK.DLL");
else {
printmsg(0,"pWinSockInit: called twice with no termination");
panic();
}
if (!hWinsock)
{
printmsg(0, "pWinSockInit: could not find Winsock.DLL");
return KWFalse;
}
/*--------------------------------------------------------------------*/
/* Initialize pointers to functions with in the libraries */
/*--------------------------------------------------------------------*/
#ifdef __TURBOC__
#pragma warn -sus
#endif
paccept = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 1,0));
pbind = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 2,0));
pclosesocket = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 3,0));
pconnect = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 4,0));
phtonl = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 8,0));
phtons = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 9,0));
pinet_addr = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 10,0));
plisten = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 13,0));
pntohl = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 14,0));
pntohs = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 15,0));
precv = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 16,0));
pselect = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 18,0));
psend = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 19,0));
psetsockopt = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 21,0));
pshutdown = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 22,0));
psocket = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 23,0));
pgethostbyname = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 52,0));
pgetservbyname = GetProcAddress(hWinsock, (LPSTR)MAKELONG( 55,0));
pWSAGetLastError = GetProcAddress(hWinsock, (LPSTR)MAKELONG(111,0));
pWSACancelBlockingCall = GetProcAddress(hWinsock, (LPSTR)MAKELONG(113,0));
pWSAIsBlocking = GetProcAddress(hWinsock, (LPSTR)MAKELONG(114,0));
pWSAStartup = GetProcAddress(hWinsock, (LPSTR)MAKELONG(115,0));
pWSACleanup = GetProcAddress(hWinsock, (LPSTR)MAKELONG(116,0));
#ifdef __TURBOC__
#pragma warn .sus
#endif
return KWTrue;
} /* pWinSockInit */
示例8: viewcmd
bool viewcmd(char *itemName, CFErrorRef *err) {
char *cmd, *viewname;
SOSViewActionCode ac = kSOSCCViewQuery;
CFStringRef viewspec;
viewname = strchr(itemName, ':');
if(viewname == NULL) return false;
*viewname = 0;
viewname++;
cmd = itemName;
if(strcmp(cmd, "enable") == 0) {
ac = kSOSCCViewEnable;
} else if(strcmp(cmd, "disable") == 0) {
ac = kSOSCCViewDisable;
} else if(strcmp(cmd, "query") == 0) {
ac = kSOSCCViewQuery;
} else {
return false;
}
if(strchr(viewname, ',') == NULL) { // original single value version
viewspec = convertStringToView(viewname);
if(!viewspec) return false;
SOSViewResultCode rc = SOSCCView(viewspec, ac, err);
CFStringRef resultString = convertViewReturnCodeToString(rc);
printmsg(CFSTR("View Result: %@ : %@\n"), resultString, viewspec);
return true;
}
if(ac == kSOSCCViewQuery) return false;
// new multi-view version
char *viewlist = strdup(viewname);
char *token;
char *tofree = viewlist;
CFMutableSetRef viewSet = CFSetCreateMutable(NULL, 0, &kCFCopyStringSetCallBacks);
while ((token = strsep(&viewlist, ",")) != NULL) {
CFStringRef resultString = convertStringToView(token);
CFSetAddValue(viewSet, resultString);
}
printmsg(CFSTR("viewSet provided is %@\n"), viewSet);
free(tofree);
bool retcode;
if(ac == kSOSCCViewEnable) retcode = SOSCCViewSet(viewSet, NULL);
else retcode = SOSCCViewSet(NULL, viewSet);
fprintf(outFile, "SOSCCViewSet returned %s\n", (retcode)? "true": "false");
return true;
}
示例9: AutoBounceSMTP
static KWBoolean
AutoBounceSMTP(
int status,
IMFILE *imf,
const MAIL_ADDR *sender,
SMTP_ADDR *toAddress,
int count,
const char *relay,
const KWBoolean validate,
const unsigned int timeout
)
{
int subscript;
switch(status)
{
case KWNSSuccess:
/* No problem, so do not force termination */
return KWFalse;
case KWNSNoNet:
printmsg(0,"Network connection lost with %s"
", requeuing for retry.",
relay);
shutdownSMTP(0);
return KWTrue;
case KWNSNetTimeout:
printmsg(0,"Network timeout occurred, breaking off exchange with %s"
" and requeuing for retry.",
relay );
shutdownSMTP(timeout);
return KWTrue;
case KWNSTransientError:
printmsg(0,"Transient procotol error with %s"
", requeuing for retry.",
relay);
shutdownSMTP(timeout);
return KWTrue;
default:
Bounce(imf,
sender,
"SMTP Protocol Permanent Error occurred",
GET_TRACE_BUFFER(),
relay,
validate);
/* Treat all bounced addresses as processed */
for (subscript = 0; subscript < count; subscript++)
toAddress[subscript].processed = KWTrue;
return KWTrue;
} /* switch(status) */
} /* SMTPAutoBounce */
示例10: getSeq
unsigned long getSeq()
{
char seqfile[FILENAME_MAX];
FILE *stream;
unsigned long seq = 0;
mkfilename(seqfile, E_spooldir, SFILENAME);
if ((stream = FOPEN(seqfile, "r+", IMAGE_MODE)) == nil(FILE))
{
printerr( seqfile );
if ((stream = FOPEN(seqfile, "w", IMAGE_MODE)) == nil(FILE))
{
printerr( seqfile );
panic();
}
}
else {
if ( fread( &seq, sizeof seq, 1, stream ) != 1 )
printerr( seqfile );
}
/*--------------------------------------------------------------------*/
/* Generate a new seed for our sequence if we can't read one */
/*--------------------------------------------------------------------*/
if ( ! seq++ )
{
seq = ((unsigned long) getpid()) % 10000000;
/* Start number small, semi-unique*/
printmsg(0,"Resetting sequence number to %lu (0x%08lx)",
seq,
seq );
}
/*--------------------------------------------------------------------*/
/* Update sequence number */
/*--------------------------------------------------------------------*/
rewind( stream );
if ((fwrite( &seq, sizeof seq, 1, stream ) != 1) || fclose(stream))
{
printerr( seqfile );
panic();
}
#ifdef UDEBUG
printmsg(8, "getseq: seq#=%ld", seq);
#endif
return seq;
} /* getseq */
示例11: freeBuf
void
freeBuf( void *oldBuffer, const char *file, const size_t line )
{
while( top != NULL )
{
BUFQUEUE *save = top;
KWBoolean done = (KWBoolean) ( top->userBuffer == oldBuffer ?
KWTrue : KWFalse );
if ( top->signature != SIGNATURE )
{
printmsg(0, "freeBuf: Invalid buffer queue at %p", top );
bugout( file, line );
}
if ( top->userBuffer == oldBuffer )
done = KWTrue;
#ifdef UDEBUG
printmsg(done ? 8 : 2,"%s(%d): freeBuf: %slicit "
"free of %p (%d,%d) for %u bytes",
file,
line,
done ? "ex" : "im",
top,
top->entry,
entries,
top->length );
entries--;
#endif
/*--------------------------------------------------------------------*/
/* Pop the current entry off the stack and free it */
/*--------------------------------------------------------------------*/
top = top->previous;
free( save );
if ( done )
return;
} /* while( top != NULL ) */
/*--------------------------------------------------------------------*/
/* If we didn't find the block to free, we have a serious */
/* internal error -- report it and exit. */
/*--------------------------------------------------------------------*/
printmsg( 0, "freeBuf: Unable to locate requested memory block at %p",
oldBuffer );
bugout( file, line );
} /* freeBuf */
示例12: gotpacket
static void
gotpacket(char msg[], int len)
{
int i;
/* What did we get? */
switch (msg[0]) {
case 'a':
break;
case 'b':
printmsg(msg, len, 0);
break;
case 'c':
printmsg(msg, len, 1);
break;
case 'd':
case 'f':
printmsg(msg, len, 2);
break;
case 'e':
timestamp();
fprintf(stdout, "%s ", tbuf);
fputs("-!- [Error] ", stdout);
for (i = 1; i < len; i++)
fputc(msg[i], stdout);
fputc('\n', stdout);
break;
case 'g':
timestamp();
fprintf(stdout, "%s ", tbuf);
fputs("-!- [Error] Connection closed by server\n", stdout);
running = 0;
break;
case 'i':
printicmd(msg, len);
break;
case 'j':
sendlogin(); /* Now we can log in. */
break;
case 'k':
timestamp();
fprintf(stdout, "%s ", tbuf);
fputs("-!- [Beep] You were beeped by ", stdout);
for (i = 1; i < len; i++)
fputc(msg[i], stdout);
fputc('\n', stdout);
break;
case 'l':
case 'm':
break;
default:
fputs("Received invalid packet.\n", stdout);
break;
}
}
示例13: internal
static KWBoolean internal( const char *command )
{
static char *commands[] = { "break", "cd", "chdir", "copy",
"ctty", "date", "del", "dir",
"echo", "erase", "for", "md",
"mkdir", "rd", "rem", "ren",
"rename", "rmdir", "time", "type",
"ver", "verify", "vol",
NULL };
char **list;
/*--------------------------------------------------------------------*/
/* Empty commands are a special signal to use the command */
/* processor to run the arguments. */
/*--------------------------------------------------------------------*/
if ( *command == '\0' )
{
printmsg(4,"internal: Empty command, using command processor");
return KWTrue;
}
/*--------------------------------------------------------------------*/
/* Determine command list to use */
/*--------------------------------------------------------------------*/
if (E_internal == NULL )
list = commands;
else
list = E_internal;
/*--------------------------------------------------------------------*/
/* Scan the list for the command */
/*--------------------------------------------------------------------*/
while( *list != NULL )
{
if (equali(*list++,command))
{
printmsg(4,"\"%s\" is an internal command",command);
return KWTrue;
} /* if */
} /* while( *list != NULL ) */
/*--------------------------------------------------------------------*/
/* The command is not in the list; return KWFalse (external */
/* command) */
/*--------------------------------------------------------------------*/
printmsg(4,"\"%s\" is an external command",command);
return KWFalse;
} /* internal */
示例14: excluded
KWBoolean excluded(char *list, char *path)
{
char *t1, *t2, *t3;
int temp;
printmsg(5, "exclude: checking %s against %s", list, path);
t1 = strtok(list, ", ");
while (t1 != NULL)
{
t2 = strstr(path, t1);
while (t2 != NULL)
{
/* MUST be start of string or preceded by '!' */
if ((t2 == path) ||
(*(t2 - 1) == '!'))
{
/* is this the only entry left ? */
if (equal(t1, t2))
return KWTrue;
/* must be directly followed by a '!' */
t3 = strchr(t2, '!');
if (t3 != NULL)
{
*t3 = 0;
temp = strcmp(t1, t2);
*t3 = '!';
if (temp == 0)
return KWTrue;
}
}
/* search for another occurence */
t2 = strstr(t2 + 1, t1);
}
t1 = strtok(NULL, ", ");
} /* while (t1 != NULL) */
printmsg(5, "exclude: results in KWFalse");
return KWFalse;
} /* excluded */
示例15: printmsg
struct UserTable *checkuser(const char *name)
{
int lower;
int upper;
if ( (name == NULL) || (strlen(name) == 0) )
{
printmsg(0,"checkuser: Invalid argument!");
panic();
}
#ifdef UDEBUG
printmsg(14,"checkuser: Searching for user id %s", name);
#endif
/*-------------------------------------------------------------------*/
/* Initialize the host name table if needed */
/*-------------------------------------------------------------------*/
if (userElements == 0) /* host table initialized yet? */
userElements = loaduser(); /* No --> load it */
lower = 0;
upper = (int) userElements - 1;
/*--------------------------------------------------------------------*/
/* Peform a binary search on the user table */
/*--------------------------------------------------------------------*/
while ( lower <= upper )
{
int midpoint;
int hit;
midpoint = (lower + upper) / 2;
hit = stricmp(name,users[midpoint].uid);
if (hit > 0)
lower = midpoint + 1;
else if (hit < 0)
upper = midpoint - 1;
else
return &users[midpoint];
}
/*--------------------------------------------------------------------*/
/* We didn't find the user. Return failure to caller */
/*--------------------------------------------------------------------*/
return BADUSER;
} /* checkuser */