本文整理汇总了C++中command_init函数的典型用法代码示例。如果您正苦于以下问题:C++ command_init函数的具体用法?C++ command_init怎么用?C++ command_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了command_init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: command_add_character
CommandCode command_add_character(u08 in_char) {
if( in_char != '#' )
{
// if incoming char is not '#', just add it and return
_append_char(in_char);
if( strlen(command_str) == 1 )
{
return CommandCodeFirstChar;
}
}
else
{
// user pressed '#'
if( strlen(command_str) <= 4 )
{
CommandCode temp = atoi(command_str);
command_init();
return temp;
}
else
{
command_init();
return CommandCodeInvalid;
}
}
return CommandCodeIncomplete;
}
开发者ID:BlackBears,项目名称:GreenhouseController-AVR,代码行数:28,代码来源:command.c
示例2: maintainer_script_alternative
int maintainer_script_alternative(struct pkginfo *pkg,
const char *scriptname, const char *desc,
const char *cidir, char *cidirrest,
const char *ifok, const char *iffallback) {
struct command cmd;
const char *oldscriptpath;
struct stat stab;
char buf[100];
oldscriptpath = pkgadminfile(pkg, &pkg->installed, scriptname);
sprintf(buf, _("old %s script"), desc);
command_init(&cmd, oldscriptpath, buf);
command_add_args(&cmd, scriptname, ifok,
versiondescribe(&pkg->available.version, vdew_nonambig),
NULL);
if (stat(oldscriptpath,&stab)) {
if (errno == ENOENT) {
debug(dbg_scripts,"maintainer_script_alternative nonexistent %s `%s'",
scriptname,oldscriptpath);
command_destroy(&cmd);
return 0;
}
warning(_("unable to stat %s '%.250s': %s"),
cmd.name, oldscriptpath, strerror(errno));
} else {
if (!do_script(pkg, &pkg->installed, &cmd, &stab, PROCWARN)) {
command_destroy(&cmd);
post_script_tasks();
return 1;
}
}
fprintf(stderr, _("dpkg - trying script from the new package instead ...\n"));
strcpy(cidirrest,scriptname);
sprintf(buf, _("new %s script"), desc);
command_destroy(&cmd);
command_init(&cmd, cidir, buf);
command_add_args(&cmd, scriptname, iffallback,
versiondescribe(&pkg->installed.version, vdew_nonambig),
NULL);
if (stat(cidir,&stab)) {
command_destroy(&cmd);
if (errno == ENOENT)
ohshit(_("there is no script in the new version of the package - giving up"));
else
ohshite(_("unable to stat %s `%.250s'"),buf,cidir);
}
do_script(pkg, &pkg->available, &cmd, &stab, 0);
fprintf(stderr, _("dpkg: ... it looks like that went OK.\n"));
command_destroy(&cmd);
post_script_tasks();
return 1;
}
开发者ID:pexip,项目名称:os-dpkg,代码行数:60,代码来源:help.c
示例3: cache_artwork_get
/*
* Get the cached artwork image for the given persistentid and maximum width/height
*
* If there is a cached entry for the given id and width/height, the parameter cached is set to 1.
* In this case format and data contain the cached values.
*
* @param persistentid persistent songalbumid or songartistid
* @param max_w maximum image width
* @param max_h maximum image height
* @param cached set by this function to 0 if no cache entry exists, otherwise 1
* @param format set by this function to the format of the cache entry
* @param evbuf event buffer filled by this function with the scaled image
* @return 0 if successful, -1 if an error occurred
*/
int
cache_artwork_get(int64_t persistentid, int max_w, int max_h, int *cached, int *format, struct evbuffer *evbuf)
{
struct cache_command cmd;
int ret;
if (!g_initialized)
return -1;
command_init(&cmd);
cmd.func = cache_artwork_get_impl;
cmd.arg.peristentid = persistentid;
cmd.arg.max_w = max_w;
cmd.arg.max_h = max_h;
cmd.arg.evbuf = evbuf;
ret = sync_command(&cmd);
*format = cmd.arg.format;
*cached = cmd.arg.cached;
command_deinit(&cmd);
return ret;
}
开发者ID:Illuminux,项目名称:forked-daapd,代码行数:40,代码来源:cache.c
示例4: cache_artwork_add
/*
* Adds the given (scaled) artwork image to the artwork cache
*
* @param persistentid persistent songalbumid or songartistid
* @param max_w maximum image width
* @param max_h maximum image height
* @param format ART_FMT_PNG for png, ART_FMT_JPEG for jpeg or 0 if no artwork available
* @param filename the full path to the artwork file (could be an jpg/png image or a media file with embedded artwork) or empty if no artwork available
* @param evbuf event buffer containing the (scaled) image
* @return 0 if successful, -1 if an error occurred
*/
int
cache_artwork_add(int64_t persistentid, int max_w, int max_h, int format, char *filename, struct evbuffer *evbuf)
{
struct cache_command cmd;
int ret;
if (!g_initialized)
return -1;
command_init(&cmd);
cmd.func = cache_artwork_add_impl;
cmd.arg.peristentid = persistentid;
cmd.arg.max_w = max_w;
cmd.arg.max_h = max_h;
cmd.arg.format = format;
cmd.arg.path = strdup(filename);
cmd.arg.evbuf = evbuf;
ret = sync_command(&cmd);
command_deinit(&cmd);
return ret;
}
开发者ID:Illuminux,项目名称:forked-daapd,代码行数:36,代码来源:cache.c
示例5: select_command_new
Command_t*
select_command_new(Object_t *obj)
{
SelectCommand_t *command = g_new(SelectCommand_t, 1);
command->obj = object_ref(obj);
return command_init(&command->parent, _("Select"), &select_command_class);
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:7,代码来源:imap_cmd_select.c
示例6: command_parse
int command_parse(int argc, char** argv, Command* data_ptr)
{
int result = 0;
if (data_ptr != NULL) {
int i;
command_init(argc, argv, data_ptr);
result = 1;
for (i = 0; i < argc; ++i) {
char* p = argv[i];
if (p != NULL) {
if (strcmp(p, "--help") == 0) {
i += command_parse_help(argc, argv, data_ptr, i);
} else if (strcmp(p, "--title") == 0 || strcmp(p, "-t") == 0) {
i += command_parse_title(argc, argv, data_ptr, i);
} else if (strcmp(p, "--action") == 0 || strcmp(p, "-a") == 0) {
i += command_parse_action(argc, argv, data_ptr, i);
} else if (strcmp(p, "--filter") == 0 || strcmp(p, "-f") == 0) {
i += command_parse_filter(argc, argv, data_ptr, i);
}
}
}
}
return result;
}
开发者ID:witchnaga,项目名称:filedlg,代码行数:31,代码来源:command.c
示例7: clear_command_new
Command_t*
clear_command_new(ObjectList_t *list)
{
ClearCommand_t *command = g_new(ClearCommand_t, 1);
command->list = list;
return command_init(&command->parent, _("Clear"), &clear_command_class);
}
开发者ID:jiapei100,项目名称:gimp,代码行数:7,代码来源:imap_cmd_clear.c
示例8: main
int
main(int argc, char **argv) {
int rc = 1;
opts.spaces = 2;
command_t cmd;
command_init(&cmd, argv[0], "1.0.0");
command_option(&cmd
, "-v"
, "--verbose"
, "enable verbose stuff"
, set_verbose);
command_option(&cmd
, "-s"
, "--spaces [count]"
, "optional number of spaces (defaults to 2)"
, set_spaces);
command_parse(&cmd, argc, argv);
for (int i = 0; i < cmd.argc; ++i) {
if (-1 == convert_file(cmd.argv[i])) goto cleanup;
}
rc = 0;
cleanup:
command_free(&cmd);
return rc;
}
开发者ID:stephenmathieson,项目名称:tabs-to-spaces,代码行数:29,代码来源:main.c
示例9: vmaintainer_script_installed
static int
vmaintainer_script_installed(struct pkginfo *pkg, const char *scriptname,
const char *desc, va_list args)
{
struct command cmd;
const char *scriptpath;
struct stat stab;
char buf[100];
scriptpath = pkgadminfile(pkg, &pkg->installed, scriptname);
sprintf(buf, _("installed %s script"), desc);
command_init(&cmd, scriptpath, buf);
command_add_arg(&cmd, scriptname);
command_add_argv(&cmd, args);
if (stat(scriptpath,&stab)) {
command_destroy(&cmd);
if (errno == ENOENT) {
debug(dbg_scripts, "vmaintainer_script_installed nonexistent %s",
scriptname);
return 0;
}
ohshite(_("unable to stat %s `%.250s'"), buf, scriptpath);
}
do_script(pkg, &pkg->installed, &cmd, &stab, 0);
command_destroy(&cmd);
return 1;
}
开发者ID:pexip,项目名称:os-dpkg,代码行数:31,代码来源:help.c
示例10: fd_fd_filter
static void DPKG_ATTR_SENTINEL
fd_fd_filter(int fd_in, int fd_out, const char *desc, const char *delenv[],
const char *file, ...)
{
va_list args;
struct command cmd;
pid_t pid;
int i;
pid = subproc_fork();
if (pid == 0) {
if (fd_in != 0) {
m_dup2(fd_in, 0);
close(fd_in);
}
if (fd_out != 1) {
m_dup2(fd_out, 1);
close(fd_out);
}
for (i = 0; delenv[i]; i++)
unsetenv(delenv[i]);
command_init(&cmd, file, desc);
command_add_arg(&cmd, file);
va_start(args, file);
command_add_argv(&cmd, args);
va_end(args);
command_exec(&cmd);
}
subproc_reap(pid, desc, 0);
}
开发者ID:CharizTeam,项目名称:dpkg,代码行数:33,代码来源:compress.c
示例11: execbackend
void execbackend(const char *const *argv) {
struct command cmd;
char *arg;
command_init(&cmd, cipaction->parg, NULL);
command_add_arg(&cmd, cipaction->parg);
/*
* Special case: dpkg-query takes the --admindir option, and if dpkg itself
* was given a different admin directory, we need to pass it along to it.
*/
if (strcmp(cipaction->parg, DPKGQUERY) == 0 &&
strcmp(admindir, ADMINDIR) != 0) {
arg = m_malloc((strlen("--admindir=") + strlen(admindir) + 1));
sprintf(arg, "--admindir=%s", admindir);
command_add_arg(&cmd, arg);
}
arg = m_malloc(2 + strlen(cipaction->olong) + 1);
sprintf(arg, "--%s", cipaction->olong);
command_add_arg(&cmd, arg);
/* Exlicitely separate arguments from options as any user-supplied
* separator got stripped by the option parser */
command_add_arg(&cmd, "--");
command_add_argl(&cmd, (const char **)argv);
command_exec(&cmd);
}
开发者ID:jtniehof,项目名称:dpkg,代码行数:29,代码来源:main.c
示例12: maintainer_script_new
int
maintainer_script_new(struct pkginfo *pkg,
const char *scriptname, const char *desc,
const char *cidir, char *cidirrest, ...)
{
struct command cmd;
struct stat stab;
va_list args;
char buf[100];
strcpy(cidirrest, scriptname);
sprintf(buf, _("new %s script"), desc);
va_start(args, cidirrest);
command_init(&cmd, cidir, buf);
command_add_arg(&cmd, scriptname);
command_add_argv(&cmd, args);
va_end(args);
if (stat(cidir,&stab)) {
command_destroy(&cmd);
if (errno == ENOENT) {
debug(dbg_scripts,"maintainer_script_new nonexistent %s `%s'",scriptname,cidir);
return 0;
}
ohshite(_("unable to stat %s `%.250s'"), buf, cidir);
}
do_script(pkg, &pkg->available, &cmd, &stab, 0);
command_destroy(&cmd);
post_script_tasks();
return 1;
}
开发者ID:pexip,项目名称:os-dpkg,代码行数:34,代码来源:help.c
示例13: main
int main(int argc, char** argv)
{
command_t cmd;
command_init(&cmd, "dhcore-test", "1.0");
command_option_pos(&cmd, "test", "Choose unit test", TRUE, cmd_gettest);
command_parse(&cmd, argc, argv, NULL);
if (IS_FAIL(core_init(CORE_INIT_ALL))) {
printf("core init error.\n");
return -1;
}
log_outputconsole(TRUE);
if (g_testidx == -1)
g_testidx = show_help();
if (g_testidx != -1)
g_tests[g_testidx].test_fn();
#if defined(_DEBUG_)
core_release(TRUE);
#else
core_release(FALSE);
#endif
return 1;
}
开发者ID:ataceyhun,项目名称:libdhcore,代码行数:27,代码来源:dhcore-test.c
示例14: cut_command_new
Command_t*
cut_command_new(ObjectList_t *list)
{
CutCommand_t *command = g_new(CutCommand_t, 1);
command->list = list;
command->paste_buffer = NULL;
return command_init(&command->parent, _("Cut"), &cut_command_class);
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:8,代码来源:imap_cmd_cut.c
示例15: move_up_command_new
Command_t*
move_up_command_new(ObjectList_t *list)
{
MoveUpCommand_t *command = g_new(MoveUpCommand_t, 1);
command->list = list;
command->add = FALSE;
return command_init(&command->parent, _("Move Up"), &move_up_command_class);
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:8,代码来源:imap_cmd_move_up.c
示例16: select_next_command_new
Command_t*
select_next_command_new(ObjectList_t *list)
{
SelectNextCommand_t *command = g_new(SelectNextCommand_t, 1);
command->list = list;
return command_init(&command->parent, _("Select Next"),
&select_next_command_class);
}
开发者ID:Minoos,项目名称:gimp,代码行数:8,代码来源:imap_cmd_select_next.c
示例17: create_command_new
Command_t*
create_command_new(ObjectList_t *list, Object_t *obj)
{
CreateCommand_t *command = g_new(CreateCommand_t, 1);
command->list = list;
command->obj = object_ref(obj);
return command_init(&command->parent, _("Create"), &create_command_class);
}
开发者ID:AdamGrzonkowski,项目名称:gimp-1,代码行数:8,代码来源:imap_cmd_create.c
示例18: object_down_command_new
Command_t*
object_down_command_new(ObjectList_t *list, Object_t *obj)
{
ObjectDownCommand_t *command = g_new(ObjectDownCommand_t, 1);
command->list = list;
command->obj = object_ref(obj);
return command_init(&command->parent, _("Move Down"),
&object_down_command_class);
}
开发者ID:jiapei100,项目名称:gimp,代码行数:9,代码来源:imap_cmd_object_down.c
示例19: init_risp
// Initialise the risp system.
static void init_risp(system_data_t *sysdata)
{
assert(sysdata);
assert(sysdata->risp == NULL);
sysdata->risp = risp_init(NULL);
assert(sysdata->risp);
command_init(sysdata->risp);
}
开发者ID:hyper,项目名称:rqd,代码行数:10,代码来源:rqd.c
示例20: delete_command_new
Command_t*
delete_command_new(ObjectList_t *list, Object_t *obj)
{
DeleteCommand_t *command = g_new(DeleteCommand_t, 1);
command->list = list;
command->obj = object_ref(obj);
return command_init(&command->parent, _("Delete"),
&delete_command_class);
}
开发者ID:jiapei100,项目名称:gimp,代码行数:9,代码来源:imap_cmd_delete.c
注:本文中的command_init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论