Esempio n. 1
0
void ctap_cmp_ok(int a, const char *op, int b, const char *file, unsigned long line, const char *fmt, ...)
{
	int k = strcmp(op, "||") == 0 ? (a || b)
	      : strcmp(op, "&&") == 0 ? (a && b)
	      : strcmp(op, "|")  == 0 ? (a |  b)
	      : strcmp(op, "^")  == 0 ? (a ^  b)
	      : strcmp(op, "&")  == 0 ? (a &  b)
	      : strcmp(op, "==") == 0 ? (a == b)
	      : strcmp(op, "!=") == 0 ? (a != b)
	      : strcmp(op, "<")  == 0 ? (a <  b)
	      : strcmp(op, "<=") == 0 ? (a <= b)
	      : strcmp(op, ">")  == 0 ? (a >  b)
	      : strcmp(op, ">=") == 0 ? (a >= b)
	      : strcmp(op, "<<") == 0 ? (a << b)
	      : strcmp(op, ">>") == 0 ? (a >> b)
	      : strcmp(op, "+")  == 0 ? (a +  b)
	      : strcmp(op, "-")  == 0 ? (a -  b)
	      : strcmp(op, "/")  == 0 ? (a /  b)
	      : strcmp(op, "%")  == 0 ? (a %  b)
	      : diag("unknown operator: '%s'", op);

	vmsg(fmt, msg);
	if (!_assert(k, 0, file, line, msg)) {
		diag("   %d %s %d failed", a, op, b);
	}
}
Esempio n. 2
0
static int retrieve_backup(userec_t *user)
{
    int     uid;
    char    src[PATHLEN], dst[PATHLEN];
    char    ans;

    if ((uid = searchuser(user->userid, user->userid))) {
	userec_t orig;
	passwd_sync_query(uid, &orig);
	strlcpy(user->passwd, orig.passwd, sizeof(orig.passwd));
	setumoney(uid, user->money);
	passwd_sync_update(uid, user);
	return 0;
    }

    ans = vans("目前的 PASSWD 檔沒有此 ID,新增嗎?[y/N]");

    if (ans != 'y') {
	vmsg("目前的 PASSWDS 檔沒有此 ID,請先新增此帳號");
	return -1;
    }

    if (setupnewuser((const userec_t *)user) >= 0) {
	sethomepath(dst, user->userid);
	if (!dashd(dst)) {
	    snprintf(src, sizeof(src), "tmp/%s", user->userid);
	    if (!dashd(src) || !Rename(src, dst))
		mkuserdir(user->userid);
	}
	return 0;
    }
    return -1;
}
Esempio n. 3
0
static int
goodbye()
{
   /* guessi.091228 減少畫面重繪 回傳XO_NONE */
  if (vans("您確定要離開【 東方小城 】嗎? Y)再見 N)返回 [N] ") != 'y')
    return XO_NONE;

#ifdef LOG_BMW
  /* lkchu.981201: 水球記錄處理 */
  bmw_log();
#endif

  /* itoc.000407: 離站畫面一併簡化 */
  if (!(cuser.ufo & UFO_MOTD))
  {
    clear();
    prints("親愛的 \033[32m%s(%s)\033[m,別忘了再度光臨【 %s 】\n以下是您在站內的註冊資料:\n",
           cuser.userid, cuser.username, str_site);
    acct_show(&cuser, 0);
    vmsg(NULL);
  }

  u_exit("EXIT ");

  /* guessi.060610 離站清空畫面 */
  clear();
  refresh();

  exit(0);
}
Esempio n. 4
0
void msglng(int id, char *text, ...)
{
	va_list ap;
	va_start(ap, text);
	vmsg(id, text, MB_OK, ap);
	va_end(ap);
}
Esempio n. 5
0
static int nxp_video_streamon(struct file *file, void *fh,
        enum v4l2_buf_type i)
{
    int ret;
    u32 pad;
    struct nxp_video *me = file->private_data;
    struct v4l2_subdev *subdev = _get_remote_subdev(me, i, &pad);
    void *hostdata_back;

     vmsg("%s: me %p, %s\n", __func__, me, me->name);

    if (me->vbq) {
        ret = vb2_streamon(me->vbq, i);
        if (ret < 0) {
            pr_err("%s: failed to vb2_streamon()\n", __func__);
            return ret;
        }
    } else {
        struct vb2_queue *vq = v4l2_m2m_get_vq(me->m2m_ctx, i);
        ret = vb2_streamon(vq, i);
        if (ret < 0) {
            pr_err("%s: m2m, failed to vb2_streamon()\n", __func__);
            return ret;
        }
    }

    /* for mlc subdev */
    hostdata_back = v4l2_get_subdev_hostdata(subdev);
    v4l2_set_subdev_hostdata(subdev, me->name);
    ret = v4l2_subdev_call(subdev, video, s_stream, 1);
    v4l2_set_subdev_hostdata(subdev, hostdata_back);
    return ret;
}
Esempio n. 6
0
void msg(char *text, ...)
{
	va_list ap;
	va_start(ap, text);
	vmsg(-1, text, MB_OK, ap);
	va_end(ap);
}
Esempio n. 7
0
inline void jmsg(const char *format, ...)
{
  va_list va;
  va_start(va, format);
  vmsg(format, va);
  va_end(va);
}
Esempio n. 8
0
static int nxp_video_set_crop(struct file *file, void *fh,
        struct v4l2_crop *a)
{
    int ret;
    u32 pad;
    struct nxp_video *me = file->private_data;
    struct v4l2_subdev *subdev = _get_remote_subdev(me, a->type, &pad);
    struct v4l2_subdev_crop subdev_crop;

    vmsg("%s: name %s, crop pad %d\n", __func__, me->name, a->pad);

    subdev_crop.which = V4L2_SUBDEV_FORMAT_ACTIVE;
    /* TODO */
#if 0
    subdev_crop.pad = ((me->type == NXP_VIDEO_TYPE_CAPTURE) ||
        (me->type == NXP_VIDEO_TYPE_M2M)) ? 1 : 0;
#else
    if (me->type == NXP_VIDEO_TYPE_OUT) {
        if (a->pad == 0)
            subdev_crop.pad = pad;
        else
            subdev_crop.pad = a->pad;
    } else {
        /* add for clipper cropping */
        struct nxp_video_frame *frame;
        frame = &me->frame[0];
        frame->width = a->c.width;
        frame->height = a->c.height;
        /* end clipper cropping */

        if (a->pad == 0)
            subdev_crop.pad = 1;
        else
            subdev_crop.pad = a->pad;
    }
#endif
    subdev_crop.rect = a->c;

    vmsg("%s: call subdev set_crop\n", __func__);
    ret = v4l2_subdev_call(subdev, pad, set_crop, NULL, &subdev_crop);
    if (ret < 0) {
        pr_err("%s: failed to subdev set_crop, ret %d\n", __func__, ret);
        return ret;
    }

    return 0;
}
Esempio n. 9
0
static int _hw_configure(struct nxp_decimator *me)
{
    struct nxp_capture *parent = nxp_decimator_to_parent(me);
    int module = parent->get_module_num(parent);

    vmsg("decimator %s: source(%dx%d), target(%dx%d)\n", __func__,
            me->src_width, me->src_height,
            me->target_width, me->target_height);

#if 0
    NX_VIP_SetClipRegion(module, 0, 0, me->src_width, me->src_height);

    NX_VIP_SetDecimation(module,
            me->src_width, me->src_height,
            me->target_width, me->target_height);

    NX_VIP_SetDecimatorFormat(module,
            _convert_to_vip_format(me->code) , false, false, false);
#else
    // check clipper on & clipper region
    {
    #if defined(CONFIG_ARCH_S5P4418)
        int left, top, right, bottom;
        NX_VIP_GetClipRegion(module, &left, &top, &right, &bottom);
        if ((me->src_width != (right - left)) || (me->src_height != (bottom - top))) {
            pr_err("%s: current clipper setting is differ from me\n", __func__);
            pr_err("clipper(%d,%d--%d,%d)\n", left, top, right, bottom);
            pr_err("me(%d,%d--%d,%d)\n", 0, 0, me->src_width, me->src_height);
            pr_err("setting force me to clipper: %d,%d --> %d,%d\n", right, bottom, YUV_YSTRIDE(right-127), bottom);

            NX_VIP_SetClipRegion(module, 0, 0, right, bottom);
            NX_VIP_SetDecimation(module,
                    right, bottom,
                    YUV_YSTRIDE(right - 127), bottom);

        } else {
            NX_VIP_SetClipRegion(module, 0, 0, me->src_width, me->src_height);
            NX_VIP_SetDecimation(module,
                    me->src_width, me->src_height,
                    me->target_width, me->target_height);
        }
    #else
        NX_VIP_SetClipRegion(module, 0, 0, me->src_width, me->src_height);
        NX_VIP_SetDecimation(module,
                me->src_width, me->src_height,
                me->target_width, me->target_height);
    #endif

    #if defined(CONFIG_ARCH_S5P4418)
        NX_VIP_SetDecimatorFormat(module,
                _convert_to_vip_format(me->code) , false, false, false);
    #elif defined(CONFIG_ARCH_S5P6818)
        NX_VIP_SetDecimatorFormat(module, _convert_to_vip_format(me->code));
    #endif
    }
#endif

    return 0;
}
Esempio n. 10
0
void
hearmsg(const char *fmt, ...)
{
    va_list ap;

    va_start(ap, fmt);

    if (off(player, ISDEAF))
        vmsg(fmt, ap);
    else if (wizard)
    {
        msg("Couldn't hear: ");
        vmsg(fmt, ap);
    }

    va_end(ap);
}
Esempio n. 11
0
void ctap_ne_string(const char *x, const char *y, const char *file, unsigned long line, const char *fmt, ...)
{
	vmsg(fmt, msg);
	if (!_assert(!(x && y && strcmp(x, y) == 0), 1, file, line, msg)) {
		ctap_diag(stderr, "         got: '%s'", x);
		ctap_diag(stderr, "    expected: <anything else>");
	}
}
Esempio n. 12
0
void ctap_ne_ptr(const void *x, const void *y, const char *file, unsigned long line, const char *fmt, ...)
{
	vmsg(fmt, msg);
	if (!_assert(x != y, 1, file, line, msg)) {
		ctap_diag(stderr, "         got: %p", x);
		ctap_diag(stderr, "    expected: <anything else>", y);
	}
}
Esempio n. 13
0
void ctap_ne_i64(int64_t x, int64_t y, const char *file, unsigned long line, const char *fmt, ...)
{
	vmsg(fmt, msg);
	if (!_assert(x != y, 1, file, line, msg)) {
		ctap_diag(stderr, "         got: %lli (%x)", x, x);
		ctap_diag(stderr, "    expected: <anything else>");
	}
}
Esempio n. 14
0
/*VARARGS*/
void
pwarn(const char *fmt, ...)
{
	va_list ap;
	va_start(ap, fmt);
	vmsg(0, fmt, ap);
	va_end(ap);
}
Esempio n. 15
0
void ctap_eq_i64(int64_t x, int64_t y, const char *file, unsigned long line, const char *fmt, ...)
{
	vmsg(fmt, msg);
	if (!_assert(x == y, 1, file, line, msg)) {
		ctap_diag(stderr, "         got: %lli (%x)", x, x);
		ctap_diag(stderr, "    expected: %lli (%x)", y, y);
	}
}
Esempio n. 16
0
void
seemsg(const char *fmt, ...)
{
    va_list ap;

    va_start(ap, fmt);

    if (off(player, ISBLIND))
        vmsg(fmt, ap);
    else if (wizard)
    {
        msg("Couldn't see: ");
        vmsg(fmt, ap);
    }

    va_end(ap);
}
Esempio n. 17
0
/*VARARGS*/
void
pfatal(const char *fmt, ...)
{
	va_list ap;

	va_start(ap, fmt);
	vmsg(1, fmt, ap);
	va_end(ap);
}
Esempio n. 18
0
void
perr(const char *fmt, ...)
{
    va_list ap;

    va_start(ap, fmt);
    vmsg(1 | F_ERROR, fmt, ap);
    va_end(ap);
}
Esempio n. 19
0
void
panic(const char *fmt, ...)
{
    va_list ap;

    va_start(ap, fmt);
    vmsg(1, fmt, ap);
    va_end(ap);
    exit(FSCK_EXIT_CHECK_FAILED);
}
////////////////////////////////////////////////////////////////////////////////
/// global static  ShowMsg
/// @brief Output a formatted string to messages window [analog of printf()]
/// only when the verbose flag of plugin's options is true
/// @param  format const char * printf() style message string.
/// @return void
/// @author TQN
/// @date 09/11/2004
////////////////////////////////////////////////////////////////////////////////
static void ShowMsg(const char *format, ...)
{
    if (g_options.bVerbose)
    {
        va_list va;
        va_start(va, format);
        (void) vmsg(format, va);
        va_end(va);
    }
}
Esempio n. 21
0
int idaapi logmsg(const char *format, ...) {
	if (!isLoggingEnabled())
		return -1;

	va_list va;
	va_start(va, format);
	int nbytes = vmsg(format, va);
	va_end(va);
	return nbytes;
}
Esempio n. 22
0
ssize_t dvmsg(int code, void *, const char *format, va_list va)
{
  if (code == 0)
    return vmsg(format, va);
  if ( code > 0 )
    vwarning(format, va);
  else
    verror(format, va);
  return 0;
}
Esempio n. 23
0
void
panic(const char *fmt, ...)
{
	va_list ap;

	va_start(ap, fmt);
	vmsg(1, fmt, ap);
	va_end(ap);
	exit(8);
}
Esempio n. 24
0
File: lib.c Progetto: fintano/PintOS
void
fail (const char *format, ...) 
{
  va_list args;

  va_start (args, format);
  vmsg (format, args, ": FAILED\n");
  va_end (args);

  exit (1);
}
Esempio n. 25
0
static int nxp_video_streamoff(struct file *file, void *fh,
        enum v4l2_buf_type i)
{
    int ret;
    u32 pad;
    struct nxp_video *me;
    struct v4l2_subdev *subdev;
    void *hostdata_back;


    me = file->private_data;
    subdev = _get_remote_subdev(me, i, &pad);

    if (me->vbq) {
        ret = vb2_streamoff(me->vbq, i);
        if (ret < 0) {
            printk(KERN_ERR "%s: failed to vb2_streamoff() %s\n", __func__, me->name);
            return 0;
        }
    } else {
        struct vb2_queue *vq = v4l2_m2m_get_vq(me->m2m_ctx, i);
        ret = vb2_streamoff(vq, i);
        if (ret < 0) {
            pr_err(KERN_ERR "%s: m2m, failed to vb2_streamoff() %s\n", __func__, me->name);
            return 0;
        }
    }

    vmsg("%s %s\n", __func__, me->name);

    hostdata_back = v4l2_get_subdev_hostdata(subdev);
    v4l2_set_subdev_hostdata(subdev, me->name);
    ret = v4l2_subdev_call(subdev, video, s_stream, 0);
    v4l2_set_subdev_hostdata(subdev, hostdata_back);

    vmsg("%s: %s exit\n", __func__, me->name);

    return ret;
}
Esempio n. 26
0
File: lib.c Progetto: fintano/PintOS
void
msg (const char *format, ...) 
{
  va_list args;
  
  if (quiet)
    return;
 //printf(" %X\n",args);
  va_start (args, format);
  
 //printf(" %X\n",args);
  vmsg (format, args, "\n");
  va_end (args);
}
Esempio n. 27
0
 LRESULT  CDlgOne::OnShowEdit(WORD, WORD, HWND, BOOL& )
 {
     const int msg_size = 256;
     std::vector<wchar_t> vmsg(msg_size);
     edit.GetWindowTextW(&vmsg[0], msg_size);
     std::wstring msg(&vmsg[0]);
     // _T("Button Show pressed")
     MessageBox(msg.c_str());

     std::wofstream wof("file.dat");
     wof << msg.c_str() << std::endl;
     wof.close();

     return 1;
 }
Esempio n. 28
0
int
TagPruner(int bid)
{
    boardheader_t  *bp=NULL;
    char direct[PATHLEN];

    assert(bid >= 0);   /* bid == 0 means in mailbox */
    if (bid && currstat != RMAIL) {
        bp = getbcache(bid);
        if (is_readonly_board(bp->brdname))
            return DONOTHING;
        setbdir(direct, bp->brdname);
    } else if(currstat == RMAIL) {
        sethomedir(direct, cuser.userid);
    } else {
        vmsg("抱歉,程式異常 - 請至 " BN_BUGREPORT " 報告您剛的詳細步驟。");
        return FULLUPDATE;
    }

    if (IsEmptyTagList() || (currstat == READING && !(currmode & MODE_BOARD)))
        return DONOTHING;
    if (vans("刪除所有標記[N]?") != 'y')
        return READ_REDRAW;

    // ready to start.
    outmsg("處理中,請稍後...");
    refresh();

    // first, delete and backup all files
    apply_record(direct, _iter_delete_tagged, sizeof(fileheader_t), direct);

    // now, delete the header
#ifdef SAFE_ARTICLE_DELETE
    if(bp && !(currmode & MODE_DIGEST) &&
            bp->nuser >= SAFE_ARTICLE_DELETE_NUSER)
        safe_delete_range(currdirect, 0, 0);
    else
#endif
        delete_range(currdirect, 0, 0);

    TagNum = 0;
    if (bid)
        setbtotal(bid);
    else if(currstat == RMAIL)
        setupmailusage();

    return NEWDIRECT;
}
Esempio n. 29
0
static void
a_newtitle(const menu_t * pm)
{
    char            buf[PATHLEN];
    fileheader_t    item, *fhdr;

    fhdr = &pm->header[pm->now - pm->page];
    memcpy(&item, fhdr, FHSZ);
    strlcpy(buf, item.title + 3, sizeof(buf));
    if (getdata_buf(b_lines - 1, 0, "   新標題: ", buf, 60, DOECHO)) {
	strlcpy(item.title + 3, buf, sizeof(item.title) - 3);
	setadir(buf, pm->path);
        if (substitute_fileheader(buf, fhdr, &item, pm->now + 1) != 0)
            vmsg("無法變更名稱,可能目錄有其它板主正在修改。請退出本層目錄後再重試。");
    }
}
Esempio n. 30
0
void
log_error_msg(const char *format, ...)
{
    va_list args;
    va_start(args, format);
    if (g_config.generate_log == 1)
    {
        qvfprintf(g_log_file, format, args);
    }
    else
    {
        vmsg(format, args);
    }

    va_end(args);
}