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


C++ cupsArrayCount函数代码示例

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


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

示例1: service_checkout

static void
service_checkout(void)
{
  int	fd;				/* File descriptor */


 /*
  * Create or remove the "keep-alive" file based on whether there are active
  * jobs or shared printers to advertise...
  */

  if (cupsArrayCount(ActiveJobs) ||	/* Active jobs */
      WebInterface ||			/* Web interface enabled */
      NeedReload ||			/* Doing a reload */
      (Browsing && BrowseLocalProtocols && cupsArrayCount(Printers)))
					/* Printers being shared */
  {
    cupsdLogMessage(CUPSD_LOG_DEBUG, "Creating keep-alive file \"" CUPS_KEEPALIVE "\".");

    if ((fd = open(CUPS_KEEPALIVE, O_RDONLY | O_CREAT | O_EXCL, S_IRUSR)) >= 0)
      close(fd);
  }
  else
  {
    cupsdLogMessage(CUPSD_LOG_DEBUG, "Removing keep-alive file \"" CUPS_KEEPALIVE "\".");

    unlink(CUPS_KEEPALIVE);
  }
}
开发者ID:apple,项目名称:cups,代码行数:29,代码来源:main.c

示例2: launchd_checkout

static void
launchd_checkout(void)
{
  int	fd;				/* File descriptor */


 /*
  * Create or remove the launchd KeepAlive file based on whether
  * there are active jobs, polling, browsing for remote printers or
  * shared printers to advertise...
  */

  if (cupsArrayCount(ActiveJobs) ||
      (Browsing && BrowseLocalProtocols && cupsArrayCount(Printers)))
  {
    cupsdLogMessage(CUPSD_LOG_DEBUG,
                    "Creating launchd keepalive file \"" CUPS_KEEPALIVE
                    "\"...");

    if ((fd = open(CUPS_KEEPALIVE, O_RDONLY | O_CREAT | O_EXCL, S_IRUSR)) >= 0)
      close(fd);
  }
  else
  {
    cupsdLogMessage(CUPSD_LOG_DEBUG,
                    "Removing launchd keepalive file \"" CUPS_KEEPALIVE
                    "\"...");

    unlink(CUPS_KEEPALIVE);
  }
}
开发者ID:ChErePOdaViLka,项目名称:cups,代码行数:31,代码来源:main.c

示例3: cupsdPauseListening

void
cupsdPauseListening(void)
{
  cupsd_listener_t	*lis;		/* Current listening socket */


  if (cupsArrayCount(Listeners) < 1)
    return;

  if (cupsArrayCount(Clients) == MaxClients)
    cupsdLogMessage(CUPSD_LOG_WARN,
                    "Max clients reached, holding new connections...");
  else if (errno == ENFILE || errno == EMFILE)
    cupsdLogMessage(CUPSD_LOG_WARN,
                    "Too many open files, holding new connections for "
		    "30 seconds...");

  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdPauseListening: Clearing input bits...");

  for (lis = (cupsd_listener_t *)cupsArrayFirst(Listeners);
       lis;
       lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
    cupsdRemoveSelect(lis->fd);

  ListeningPaused = time(NULL) + 30;
}
开发者ID:jianglei12138,项目名称:cups,代码行数:26,代码来源:listen.c

示例4: compare_sections_files

static int				/* O - Result of comparison */
compare_sections_files(
    _cups_section_t *a,			/* I - First section */
    _cups_section_t *b)			/* I - Second section */
{
  int	ret = cupsArrayCount(b->files) - cupsArrayCount(a->files);

  if (ret)
    return (ret);
  else
    return (_cups_strcasecmp(a->name, b->name));
}
开发者ID:jianglei12138,项目名称:cups,代码行数:12,代码来源:makedocset.c

示例5: cupsLocalizeDestOption

const char *				/* O - Localized string */
cupsLocalizeDestOption(
    http_t       *http,			/* I - Connection to destination */
    cups_dest_t  *dest,			/* I - Destination */
    cups_dinfo_t *dinfo,		/* I - Destination information */
    const char   *option)		/* I - Option to localize */
{
  _cups_message_t	key,		/* Search key */
			*match;		/* Matching entry */


  if (!http || !dest || !dinfo)
    return (option);

  if (!dinfo->localizations)
    cups_create_localizations(http, dinfo);

  if (cupsArrayCount(dinfo->localizations) == 0)
    return (option);

  key.id = (char *)option;
  if ((match = (_cups_message_t *)cupsArrayFind(dinfo->localizations,
                                                &key)) != NULL)
    return (match->str);
  else
    return (option);
}
开发者ID:thangap,项目名称:tizen-release,代码行数:27,代码来源:dest-localization.c

示例6: _cupsStrFlush

void
_cupsStrFlush(void)
{
  _cups_sp_item_t	*item;		/* Current item */


  // DEBUG_printf(("_cupsStrFlush(cg=%p)\n", cg));
  DEBUG_printf(("    %d strings in array\n", cupsArrayCount(stringpool)));

#ifdef HAVE_PTHREAD_H
  pthread_mutex_lock(&sp_mutex);
#endif /* HAVE_PTHREAD_H */

  for (item = (_cups_sp_item_t *)cupsArrayFirst(stringpool);
       item;
       item = (_cups_sp_item_t *)cupsArrayNext(stringpool))
  {
    free(item->str);
    free(item);
  }

  cupsArrayDelete(stringpool);
  stringpool = NULL;

#ifdef HAVE_PTHREAD_H
  pthread_mutex_unlock(&sp_mutex);
#endif /* HAVE_PTHREAD_H */
}
开发者ID:syedaunnraza,项目名称:work,代码行数:28,代码来源:string.c

示例7: serverCleanJobs

void
serverCleanJobs(server_printer_t *printer)	/* I - Printer */
{
  server_job_t	*job;			/* Current job */
  time_t	cleantime;		/* Clean time */


  if (cupsArrayCount(printer->jobs) == 0)
    return;

  cleantime = time(NULL) - 60;

  _cupsRWLockWrite(&(printer->rwlock));
  for (job = (server_job_t *)cupsArrayFirst(printer->jobs);
       job;
       job = (server_job_t *)cupsArrayNext(printer->jobs))
    if (job->completed && job->completed < cleantime)
    {
      cupsArrayRemove(printer->jobs, job);
      serverDeleteJob(job);
    }
    else
      break;
  _cupsRWUnlock(&(printer->rwlock));
}
开发者ID:istopwg,项目名称:ippsample,代码行数:25,代码来源:job.c

示例8: list_nodes

static void
list_nodes(help_index_t *hi,		/* I - Help index */
           const char   *title,		/* I - Title string */
	   cups_array_t *nodes)		/* I - Nodes */
{
  help_node_t	*node,			/* Current node */
		*file;			/* File node */


  printf("%d\n", cupsArrayCount(nodes));
  for (node = (help_node_t *)cupsArrayFirst(nodes);
       node;
       node = (help_node_t *)cupsArrayNext(nodes))
  {
    if (node->anchor)
    {
      file = helpFindNode(hi, node->filename, NULL);
      printf("%d|%s#%s|%s|%s\n", node->score, node->filename, node->anchor,
             node->text, file ? file->text : node->filename);
    }
    else
      printf("%d|%s|%s|%s\n", node->score, node->filename, node->text,
             node->text);
  }
}
开发者ID:jelmer,项目名称:cups,代码行数:25,代码来源:websearch.c

示例9: cupsLocalizeDestValue

const char *				/* O - Localized string */
cupsLocalizeDestValue(
    http_t       *http,			/* I - Connection to destination */
    cups_dest_t  *dest,			/* I - Destination */
    cups_dinfo_t *dinfo,		/* I - Destination information */
    const char   *option,		/* I - Option to localize */
    const char   *value)		/* I - Value to localize */
{
  _cups_message_t	key,		/* Search key */
			*match;		/* Matching entry */
  char			pair[256];	/* option.value pair */


  if (!http || !dest || !dinfo)
    return (value);

  if (!dinfo->localizations)
    cups_create_localizations(http, dinfo);

  if (cupsArrayCount(dinfo->localizations) == 0)
    return (value);

  snprintf(pair, sizeof(pair), "%s.%s", option, value);
  key.id = pair;
  if ((match = (_cups_message_t *)cupsArrayFind(dinfo->localizations,
                                                &key)) != NULL)
    return (match->str);
  else
    return (value);
}
开发者ID:thangap,项目名称:tizen-release,代码行数:30,代码来源:dest-localization.c

示例10: serverFindPrinter

server_printer_t *			/* O - Printer or NULL */
serverFindPrinter(const char *resource)	/* I - Resource path */
{
  server_printer_t	key,		/* Search key */
			*match = NULL;	/* Matching printer */


  _cupsMutexLock(&printer_mutex);
  if (cupsArrayCount(Printers) == 1 || !strcmp(resource, "/ipp/print"))
  {
   /*
    * Just use the first printer...
    */

    match = cupsArrayFirst(Printers);
    if (strcmp(match->resource, resource) && strcmp(resource, "/ipp/print"))
      match = NULL;
  }
  else
  {
    key.resource = (char *)resource;
    match        = (server_printer_t *)cupsArrayFind(Printers, &key);
  }
  _cupsMutexUnlock(&printer_mutex);

  return (match);
}
开发者ID:istopwg,项目名称:ippsample,代码行数:27,代码来源:conf.c

示例11: mimeNumTypes

int
mimeNumTypes(mime_t *mime)		/* I - MIME database */
{
  DEBUG_printf(("mimeNumTypes(mime=%p)", mime));

  if (!mime)
  {
    DEBUG_puts("1mimeNumTypes: Returning 0.");
    return (0);
  }
  else
  {
    DEBUG_printf(("1mimeNumTypes: Returning %d.",
                  cupsArrayCount(mime->types)));
    return (cupsArrayCount(mime->types));
  }
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:17,代码来源:mime.c

示例12: ppdConflicts

int					/* O - Number of conflicts found */
ppdConflicts(ppd_file_t *ppd)		/* I - PPD to check */
{
  int			i,		/* Looping variable */
			conflicts;	/* Number of conflicts */
  cups_array_t		*active;	/* Active conflicts */
  _ppd_cups_uiconsts_t	*c;		/* Current constraints */
  _ppd_cups_uiconst_t	*cptr;		/* Current constraint */
  ppd_option_t	*o;			/* Current option */


  if (!ppd)
    return (0);

 /*
  * Clear all conflicts...
  */

  cupsArraySave(ppd->options);

  for (o = ppdFirstOption(ppd); o; o = ppdNextOption(ppd))
    o->conflicted = 0;

  cupsArrayRestore(ppd->options);

 /*
  * Test for conflicts...
  */

  active    = ppd_test_constraints(ppd, NULL, NULL, 0, NULL,
                                   _PPD_ALL_CONSTRAINTS);
  conflicts = cupsArrayCount(active);

 /*
  * Loop through all of the UI constraints and flag any options
  * that conflict...
  */

  for (c = (_ppd_cups_uiconsts_t *)cupsArrayFirst(active);
       c;
       c = (_ppd_cups_uiconsts_t *)cupsArrayNext(active))
  {
    for (i = c->num_constraints, cptr = c->constraints;
         i > 0;
	 i --, cptr ++)
      cptr->option->conflicted = 1;
  }

  cupsArrayDelete(active);

 /*
  * Return the number of conflicts found...
  */

  return (conflicts);
}
开发者ID:Cacauu,项目名称:cups,代码行数:56,代码来源:ppd-conflicts.c

示例13: cupsdSetBusyState

void
cupsdSetBusyState(void)
{
  int		newbusy;		/* New busy state */
  static int	busy = 0;		/* Current busy state */
  static const char * const busy_text[] =
  {					/* Text for busy states */
    "Not busy",
    "Dirty files",
    "Printing jobs",
    "Printing jobs and dirty files",
    "Active clients",
    "Active clients and dirty files",
    "Active clients and printing jobs",
    "Active clients, printing jobs, and dirty files"
  };
#ifdef HAVE_VPROC_TRANSACTION_BEGIN
  static vproc_transaction_t vtran = 0;	/* Current busy transaction */
#endif /* HAVE_VPROC_TRANSACTION_BEGIN */


  newbusy = (DirtyCleanTime ? 1 : 0) |
            (cupsArrayCount(PrintingJobs) ? 2 : 0) |
	    (cupsArrayCount(ActiveClients) ? 4 : 0);

  if (newbusy != busy)
  {
    busy = newbusy;

#ifdef HAVE_VPROC_TRANSACTION_BEGIN
    if (busy && !vtran)
      vtran = vproc_transaction_begin(NULL);
    else if (!busy && vtran)
    {
      vproc_transaction_end(NULL, vtran);
      vtran = 0;
    }
#endif /* HAVE_VPROC_TRANSACTION_BEGIN */

    cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdSetBusyState: %s", busy_text[busy]);
  }
}
开发者ID:ystk,项目名称:debian-cups,代码行数:42,代码来源:sysman.c

示例14: list_nodes

static void
list_nodes(const char   *title,		/* I - Title string */
	   cups_array_t *nodes)		/* I - Nodes */
{
  int		i;			/* Looping var */
  help_node_t	*node;			/* Current node */


  printf("%s (%d nodes):\n", title, cupsArrayCount(nodes));
  for (i = 1, node = (help_node_t *)cupsArrayFirst(nodes);
       node;
       i ++, node = (help_node_t *)cupsArrayNext(nodes))
  {
    if (node->anchor)
      printf("    %d: %s#%s \"%s\"", i, node->filename, node->anchor,
             node->text);
    else
      printf("    %d: %s \"%s\"", i, node->filename, node->text);

    printf(" (%d words)\n", cupsArrayCount(node->words));
  }
}
开发者ID:AnotherView,项目名称:cups,代码行数:22,代码来源:testhi.c

示例15: call

int					/* O - Status of call (0 = success) */
cupsSetCredentials(
    cups_array_t *credentials)		/* I - Array of credentials */
{
  _cups_globals_t *cg = _cupsGlobals();	/* Pointer to library globals */


  if (cupsArrayCount(credentials) < 1)
    return (-1);

  _httpFreeCredentials(cg->tls_credentials);
  cg->tls_credentials = _httpCreateCredentials(credentials);

  return (cg->tls_credentials ? 0 : -1);
}
开发者ID:MasterPlexus,项目名称:vendor_goldenve,代码行数:15,代码来源:usersys.c


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