当前位置: 首页>>代码示例>>C++>>正文


C++ MSGBUF函数代码示例

本文整理汇总了C++中MSGBUF函数的典型用法代码示例。如果您正苦于以下问题:C++ MSGBUF函数的具体用法?C++ MSGBUF怎么用?C++ MSGBUF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MSGBUF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: memset

static char *fmt_decimal( const U64 number )
{
    static  char    fmt_dec[64];
    double  num  = (double)number;
    BYTE    size;
    int     i;

    memset(fmt_dec, 0, sizeof(fmt_dec));

    if ( num > 0 )
    {
        if ( num >= (double)ONE_TRILLION )
        {
            num /= (double)ONE_TRILLION;
            size = 'T';
        }
        else if ( num >= ONE_BILLION )
        {
            num /= (double)ONE_BILLION;
            size = 'G';
        }
        else if ( num >= (double)ONE_MILLION )
        {
            num /= (double)ONE_MILLION;
            size = 'M';
        }
        else
        {
            num /= (double)ONE_THOUSAND;
            size = 'K';
        }

        MSGBUF( fmt_dec, "%7.3f", num );

        i = (int)strlen(fmt_dec);

        if ( i > 0 )
        {
            for ( i--; i > 0; i-- )
            {
                if      ( fmt_dec[i] == '0' ) fmt_dec[i] = '\0';
                else if ( fmt_dec[i] == '.' ) { fmt_dec[i] = '\0'; break; }
                else break;
            }
        }

        fmt_dec[strlen(fmt_dec)] = '\0';
        fmt_dec[strlen(fmt_dec)+1] = '\0';
        fmt_dec[strlen(fmt_dec)+2] = '\0';
        fmt_dec[strlen(fmt_dec)] = ' ';
        fmt_dec[strlen(fmt_dec)] = size;
    }
    else
    {
        MSGBUF( fmt_dec, "%3d ", 0 );
        size = ' ';
    }

    return fmt_dec;
}
开发者ID:IanWorthington,项目名称:hercules-390,代码行数:60,代码来源:hscloc.c

示例2: ptt_pthread_print

DLL_EXPORT int ptt_pthread_print ()
{
int   i, n, count = 0;
char  result[32]; // (result is 'int'; if 64-bits, 19 digits or more!)
char  tbuf[256];
time_t tt;

    if (pttrace == NULL || pttracen == 0) return count;
    OBTAIN_PTTLOCK;
    n = pttracen;
    pttracen = 0;
    RELEASE_PTTLOCK;

    i = pttracex;
    do
    {
        if (pttrace[i].tid)
        {
            tt = pttrace[i].tv.tv_sec; strlcpy(tbuf, ctime(&tt),sizeof(tbuf)); tbuf[19] = '\0';

            if (pttrace[i].result == PTT_MAGIC && (pttrace[i].trclass & PTT_CL_THR))
                result[0] = '\0';
            else
                if((pttrace[i].trclass & ~PTT_CL_THR))
                    MSGBUF(result, "%8.8x", pttrace[i].result);
                else
                    MSGBUF(result, "%d", pttrace[i].result);
            logmsg
            (
                "%-18s "                           // File name
                "%s.%6.6ld "                       // Time of day (HH:MM:SS.usecs)
                I32_FMTX" "                        // Thread id (low 32 bits)
                "%-12s "                           // Trace type (string; 12 chars)
                PTR_FMTx" "                        // Data value 1
                PTR_FMTx" "                        // Data value 2
                "%s\n"                             // Numeric result (or empty string)

                ,pttrace[i].loc                    // File name
                ,tbuf + 11                         // Time of day (HH:MM:SS)
                ,pttrace[i].tv.tv_usec             // Time of day (usecs)
                ,(U32)(uintptr_t)(pttrace[i].tid)  // Thread id (low 32 bits)
                ,pttrace[i].type                   // Trace type (string; 12 chars)
                ,(uintptr_t)pttrace[i].data1       // Data value 1
                ,(uintptr_t)pttrace[i].data2       // Data value 2
                ,result                            // Numeric result (or empty string)
            );
            count++;
        }
        if (++i >= n) i = 0;
    } while (i != pttracex);
    memset( pttrace, 0, PTT_TRACE_SIZE * n );
    pttracex = 0;
    pttracen = n;
    return count;
}
开发者ID:adozenlines,项目名称:sandhawk,代码行数:55,代码来源:pttrace.c

示例3: history_absolute_line

int history_absolute_line(int x) {
  HISTORY *tmp = history_lines_end;
  int lowlimit;
  char buf[80];

  if (history_count == 0) {
    WRMSG(HHC02293, "I", "History empty");
    return -1;
  }

  lowlimit = history_count - HISTORY_MAX;

  if (x > history_count || x <= lowlimit) {
    MSGBUF(buf, "Only commands %d-%d are in history", lowlimit<0? 1 : lowlimit + 1, history_count);
    WRMSG(HHC02293, "I", buf);
    return (-1);
  }

  while (tmp->number != x)
    tmp = tmp->prev;

  copy_to_historyCmdLine(tmp->cmdline);
  history_ptr = NULL;
  return(0);
}
开发者ID:Orfheo,项目名称:hyperion,代码行数:25,代码来源:history.c

示例4: bsf_het

/*-------------------------------------------------------------------*/
int bsf_het (DEVBLK *dev, BYTE *unitstat,BYTE code)
{
int             rc;                     /* Return code               */

    /* Exit if already at BOT */
    if (dev->curfilen==1 && dev->nxtblkpos == 0)
    {
        build_senseX(TAPE_BSENSE_LOADPTERR,dev,unitstat,code);
        return -1;
    }

    rc = het_bsf (dev->hetb);
    if (rc < 0)
    {
        char msgbuf[128];
        MSGBUF( msgbuf, "Het error '%s': '%s'", het_error(rc), strerror(errno));
        WRMSG (HHC00204, "E", SSID_TO_LCSS(dev->ssid), dev->devnum, dev->filename, "het", "het_bsf()", (off_t)dev->hetb->cblk, msgbuf);

        build_senseX(TAPE_BSENSE_LOCATEERR,dev,unitstat,code);
        return -1;
    }

    /* Maintain position */
    dev->blockid = rc;
    dev->curfilen--;

    /* Return success */
    return 0;

} /* end function bsf_het */
开发者ID:gemzdude,项目名称:hyperion,代码行数:31,代码来源:hettape.c

示例5: fsf_het

/*-------------------------------------------------------------------*/
int fsf_het (DEVBLK *dev, BYTE *unitstat,BYTE code)
{
int             rc;                     /* Return code               */

    /* Forward space to start of next file */
    rc = het_fsf (dev->hetb);
    if (rc < 0)
    {
        char msgbuf[128];
        MSGBUF( msgbuf, "Het error '%s': '%s'", het_error(rc), strerror(errno));
        WRMSG (HHC00204, "E", SSID_TO_LCSS(dev->ssid), dev->devnum, dev->filename, "het", "het_fsf()", (off_t)dev->hetb->cblk, msgbuf);

        if(rc==HETE_EOT)
        {
            build_senseX(TAPE_BSENSE_ENDOFTAPE,dev,unitstat,code);
        }
        else
        {
            build_senseX(TAPE_BSENSE_READFAIL,dev,unitstat,code);
        }
        return -1;
    }

    /* Maintain position */
    dev->blockid = rc;
    dev->curfilen++;

    /* Return success */
    return 0;

} /* end function fsf_het */
开发者ID:gemzdude,项目名称:hyperion,代码行数:32,代码来源:hettape.c

示例6: fmt_line

void fmt_line( unsigned char *tbl, char *name, int start, int length)
{
    int     i, j, k, l, o;
    char    hbuf[128];
    char    cbuf[64];
    char    fmtline[256];
    BYTE    c;

    l = length < 32 ? length : 32;

    for( o = start; o < (start+length); o += l )
    {
        memset( hbuf, 0, sizeof(hbuf) );
        memset( cbuf, 0, sizeof(cbuf) );

        for (i = 0, j = 0, k = 0; i < l; i++)
        {
            c = tbl[o+i];
            if ( (i & 0x3) == 0x0 ) hbuf[j++] = SPACE;
            if ( (i & 0xf) == 0x0 ) { hbuf[j++] = SPACE; cbuf[k++] = SPACE; }

            j += snprintf( hbuf+j, sizeof(hbuf)-j, "%2.2X", c );
            cbuf[k++] = ( !isprint(c) ? '.' : c );

        } /* end for(i) */
        MSGBUF( fmtline, "%s+0x%04x%-74.74s %-34.34s", name, o, hbuf, cbuf );
        WRMSG( HHC90000, "D", fmtline );
    }

}
开发者ID:IanWorthington,项目名称:hercules-390,代码行数:30,代码来源:hscloc.c

示例7: write_hetmark

/*-------------------------------------------------------------------*/
int write_hetmark( DEVBLK *dev, BYTE *unitstat, BYTE code )
{
int             rc;                     /* Return code               */

    if ( dev->hetb->writeprotect )
    {
        build_senseX(TAPE_BSENSE_WRITEPROTECT,dev,unitstat,code);
        return -1;
    }

    /* Write the tape mark */
    rc = het_tapemark (dev->hetb);
    if (rc < 0)
    {
        /* Handle error condition */
        char msgbuf[128];
        MSGBUF( msgbuf, "Het error '%s': '%s'", het_error(rc), strerror(errno));
        WRMSG (HHC00204, "E", SSID_TO_LCSS(dev->ssid), dev->devnum, dev->filename, "het", "het_tapemark()", (off_t)dev->hetb->cblk, msgbuf);

        /* Set unit check with equipment check */
        build_senseX(TAPE_BSENSE_WRITEFAIL,dev,unitstat,code);
        return -1;
    }

    /* Return normal status */
    dev->blockid++;

    return 0;

} /* end function write_hetmark */
开发者ID:gemzdude,项目名称:hyperion,代码行数:31,代码来源:hettape.c

示例8: fcb_dump

/*-------------------------------------------------------------------*/
static void fcb_dump(DEVBLK* dev, char *buf, unsigned int buflen)
{
    int i;
    char wrk[16];
    char sep[1];
    sep[0] = '=';
    snprintf(buf, buflen, "LOADED lpi=%d index=%d lpp=%d fcb",
                          dev->devunique.cprt_dev.lpi,
                          dev->devunique.cprt_dev.index,
                          dev->devunique.cprt_dev.lpp );
    for (i = 1; i <= dev->devunique.cprt_dev.lpp; i++)
    {
        if (dev->devunique.cprt_dev.fcb[i] != 0)
        {
            MSGBUF( wrk, "%c%d:%d",sep[0], i, dev->devunique.cprt_dev.fcb[i]);
            sep[0] = ',' ;
            if (strlen(buf) + strlen(wrk) >= buflen - 4)
            {
                /* Too long, truncate it */
                strlcat(buf, ",...", buflen);
                return;
            }
            strlcat(buf, wrk, buflen);
        }
    }
    return;
}
开发者ID:pfg504,项目名称:hercules-plus,代码行数:28,代码来源:printer.c

示例9: MSGBUF

/*-------------------------------------------------------------------*/
char *http_get_port()
{
static char msgbuf[128];

    MSGBUF( msgbuf, "%hu", http_serv.httpport );

    return msgbuf;

}
开发者ID:rmblair,项目名称:h390-sandhawk,代码行数:10,代码来源:httpserv.c

示例10: syntax

/*-------------------------------------------------------------------*/
int syntax( const char* pgm )
{
    char usage[8192];
    char buflfs[64];
#ifdef CCKD_COMPRESS_ZLIB
    char *bufz = "            -z     compress using zlib [default]\n";
#else
    char *bufz = "";
#endif
#ifdef CCKD_COMPRESS_BZIP2
    char *bufbz = "            -bz2   compress using bzip2\n";
#else
    char *bufbz = "";
#endif

    strncpy( buflfs,
            (sizeof(off_t) > 4) ?
                "            -lfs   create single large output file\n" : "",
            sizeof( buflfs));

    if (strcasecmp(pgm, "ckd2cckd") == 0)
        // "Usage: ckd2cckd ...
        MSGBUF( usage ,MSG( HHC02435, "I", bufz, bufbz ) );

    else if (strcasecmp(pgm, "cckd2ckd") == 0)
        // "Usage: cckd2ckd ...
        MSGBUF( usage ,MSG( HHC02436, "I", buflfs ) );

    else if (strcasecmp(pgm, "fba2cfba") == 0)
        // "Usage: fba2cfba ...
        MSGBUF( usage ,MSG( HHC02437, "I", bufz, bufbz ) );

    else if (strcasecmp(pgm, "cfba2fba") == 0)
        // "Usage: cfba2fba ...
        MSGBUF( usage ,MSG( HHC02438, "I", buflfs ) );

    else
        // "Usage: %s ...
        MSGBUF( usage ,MSG( HHC02439, "I", pgm, bufz, bufbz, buflfs ) );

    fprintf( stdout, "%s", usage );
    return -1;
} /* end function syntax */
开发者ID:Orfheo,项目名称:hyperion,代码行数:44,代码来源:dasdcopy.c

示例11: hao_ignoremsg

/*---------------------------------------------------------------------------*/
static int hao_ignoremsg(char *msg)
{
#if defined(OPTION_MSGCLR) || defined(OPTION_MSGHLD)
  static int debuglen = 0;
  char* nocolor = msg;
#endif
  int msglen;

#if defined( OPTION_MSGCLR )
  /* Get past color string if there is one */
  if (!(msglen = skippnlpfx( &nocolor )))       /* Skip past <pnl pfx  */
      return TRUE;                              /* Ignore if now empty */
  if (nocolor > msg)                            /* Color prefix found? */
    memmove( msg, nocolor, msglen+1 );          /* Remove color prefix */
#else /* defined( OPTION_MSGCLR ) */
  msglen = strlen(msg);
#endif /* defined( OPTION_MSGCLR ) */

#if defined(OPTION_MSGCLR) || defined(OPTION_MSGHLD)
  if (!debuglen)
  {
    char prefix[64] = {0};
    MSGBUF( prefix, MLVL_DEBUG_PRINTF_PATTERN, "foo", 999 );
    debuglen = (int)strlen( prefix );
  }

  /* Get past debug prefix if msglevel DEBUG is active */
  if (MLVL( DEBUG ) && msglen >= debuglen)
    memmove( msg, msg + debuglen, (msglen -= debuglen)+1 );
#endif

  /* Ignore our own messages (HHC0007xx, HHC0008xx and HHC0009xx
     are reserved so that hao.c can recognize its own messages) */
  if (0
      || !strncasecmp( msg, "HHC0007", 7 )
      || !strncasecmp( msg, "HHC0008", 7 )
      || !strncasecmp( msg, "HHC0009", 7 )
  )
    return TRUE;  /* (it's one of our hao messages; ignore it) */

  /* To be extra safe, ignore any messages with the string "hao" in them */
  if (0
      || !strncasecmp( msg, "HHC00013I Herc command: 'hao ",      29 )
      || !strncasecmp( msg, "HHC00013I Herc command: 'herc hao ", 34 )
      || !strncasecmp( msg, "HHC01603I hao ",                     14 )
      || !strncasecmp( msg, "HHC01603I herc hao ",                19 )
  )
    return TRUE;  /* (it's one of our hao messages; ignore it) */

  /* Same idea but for messages logged as coming from the .rc file */
  if (!strncasecmp( msg, "> hao ", 6 ))
    return TRUE;

  return FALSE;   /* (message appears to be one we should process) */
}
开发者ID:2kranki,项目名称:hercules-390,代码行数:56,代码来源:hao.c

示例12: MSGBUF

DLL_EXPORT char *log_dsphrdcpy(void)
{
    static char  buf[MAX_PATH+2];
    static char *pzbuf = buf;

    if ( strchr(logger_filename,SPACE) == NULL )
        pzbuf = logger_filename;
    else
        MSGBUF(buf, "'%s'", logger_filename);

    return pzbuf;
}
开发者ID:herrold,项目名称:hyperion,代码行数:12,代码来源:logger.c

示例13: syntax

/*-------------------------------------------------------------------*/
int syntax (char *pgm)
{
    char usage[8192];
    char buflfs[64];
#ifdef CCKD_COMPRESS_ZLIB
    char *bufz = "            -z     compress using zlib [default]\n";
#else
    char *bufz = "";
#endif
#ifdef CCKD_COMPRESS_BZIP2
    char *bufbz = "            -bz2   compress using bzip2\n";
#else
    char *bufbz = "";
#endif

    strncpy( buflfs,
            (sizeof(off_t) > 4) ?
                "            -lfs   create single large output file\n" : "",
            sizeof( buflfs));
    MSGBUF( usage, MSG_C( HHC02499, "I", pgm, "DASD copy/convert" ) );
    display_version (stderr, usage+10, FALSE);

    if (strcasecmp(pgm, "ckd2cckd") == 0)
        MSGBUF( usage ,MSG( HHC02435, "I", bufz, bufbz ) );
    else if (strcasecmp(pgm, "cckd2ckd") == 0)
        MSGBUF( usage ,MSG( HHC02436, "I", buflfs ) );
    else if (strcasecmp(pgm, "fba2cfba") == 0)
        MSGBUF( usage ,MSG( HHC02437, "I", bufz, bufbz ) );
    else if (strcasecmp(pgm, "cfba2fba") == 0)
        MSGBUF( usage ,MSG( HHC02438, "I", buflfs ) );
    else
        MSGBUF( usage ,MSG( HHC02439, "I", pgm, bufz, bufbz, buflfs ) );
    printf ("%s", usage);
    return -1;
} /* end function syntax */
开发者ID:pfg504,项目名称:hercules-plus,代码行数:36,代码来源:dasdcopy.c

示例14: if

/*-------------------------------------------------------------------*/
static char *fmt_memsize_rounded( const U64 memsize )
{
    /* Mainframe memory and DASD amounts are reported in 2**(10*n)
     * values, (x_iB international format, and shown as x_ or x_B, when
     * x >= 1024; x when x < 1024). Open Systems and Windows report
     * memory in the same format, but report DASD storage in 10**(3*n)
     * values. (Thank you, various marketing groups and international
     * standards committees...)
     *
     * For Hercules, mainframe oriented reporting characteristics will
     * be formatted and shown as x_, when x >= 1024, and as x when x <
     * 1024. Reporting of Open Systems and Windows specifics should
     * follow the international format, shown as x_iB, when x >= 1024,
     * and x or xB when x < 1024. Reporting is done at the highest
     * integral boundary.
     *
     * Format storage in 2**(10*n) values at the highest rounded
     * (truncated) integral integer boundary.
     */

    const  char     suffix[9] = {0x00, 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'};
    static char     fmt_mem[128];   /* Max of 21 bytes used for U64 */
    register U64    mem = memsize;
    register u_int  i = 0;

    if (mem)
    {
#if SIZEOF_SIZE_T > 8
             if ( mem > ONE_YOBIBYTE )
            mem &= 0xFFFFFFFFC0000000ULL;
        else if ( mem > ONE_ZEBIBYTE )
            mem &= 0xF000000000000000ULL;
        else
#endif
             if ( mem > ONE_EXBIBYTE )
            mem &= 0xFFFC000000000000ULL;
        else if ( mem > ONE_PEBIBYTE )
            mem &= 0xFFFFFF0000000000ULL;
        else if ( mem > ONE_TEBIBYTE )
            mem &= 0xFFFFFFFFC0000000ULL;
        else if ( mem > ONE_GIBIBYTE )
            mem &= 0xFFFFFFFFFFF00000ULL;
        else if ( mem > ONE_MEBIBYTE )
            mem &= 0xFFFFFFFFFFFFFC00ULL;

        for (; i < sizeof(suffix) && !(mem & 0x03FF); mem >>= 10, ++i);
    }

    MSGBUF( fmt_mem, "%5"I64_FMT"u%c", mem, suffix[i]);

    return fmt_mem;
}
开发者ID:rmblair,项目名称:h390-sandhawk,代码行数:53,代码来源:hscloc.c

示例15: get_hostinfo_str

/*-------------------------------------------------------------------*/
DLL_EXPORT char* get_hostinfo_str ( HOST_INFO*  pHostInfo,
                                    char*       pszHostInfoStrBuff,
                                    size_t      nHostInfoStrBuffSiz )
{
    if ( pszHostInfoStrBuff && nHostInfoStrBuffSiz )
    {
        char num_procs[64];
        if ( !pHostInfo ) pHostInfo = &hostinfo;
        
        if ( pHostInfo->num_packages     != 0 &&
             pHostInfo->num_physical_cpu != 0 &&
             pHostInfo->num_logical_cpu  != 0 )
        {
            MSGBUF( num_procs, " LP=%d, Cores=%d, CPUs=%d", pHostInfo->num_logical_cpu, 
                                pHostInfo->num_physical_cpu, pHostInfo->num_packages );
        }
        else
        {
            if ( pHostInfo->num_procs > 1 )
                MSGBUF( num_procs, " MP=%d", pHostInfo->num_procs );
            else if ( pHostInfo->num_procs == 1 )
                strlcpy( num_procs, " UP", sizeof(num_procs) );
            else
                strlcpy( num_procs,   "",  sizeof(num_procs) );
        }

        snprintf( pszHostInfoStrBuff, nHostInfoStrBuffSiz,
            _("Running on %s %s-%s. %s, %s%s"),
            pHostInfo->nodename,
            pHostInfo->sysname,
            pHostInfo->release,
            pHostInfo->version,
            pHostInfo->machine,
            num_procs
        );
        *(pszHostInfoStrBuff + nHostInfoStrBuffSiz - 1) = 0;
    }
    return pszHostInfoStrBuff;
}
开发者ID:IanWorthington,项目名称:hercules-390,代码行数:40,代码来源:hostinfo.c


注:本文中的MSGBUF函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。