PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - sapi/cli - php_cli_process_title.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 13 19 68.4 %
Date: 2014-04-16 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :   +----------------------------------------------------------------------+
       3             :   | PHP Version 5                                                        |
       4             :   +----------------------------------------------------------------------+
       5             :   | Copyright (c) 1997-2014 The PHP Group                                |
       6             :   +----------------------------------------------------------------------+
       7             :   | This source file is subject to version 3.01 of the PHP license,      |
       8             :   | that is bundled with this package in the file LICENSE, and is        |
       9             :   | available through the world-wide-web at the following url:           |
      10             :   | http://www.php.net/license/3_01.txt                                  |
      11             :   | If you did not receive a copy of the PHP license and are unable to   |
      12             :   | obtain it through the world-wide-web, please send a note to          |
      13             :   | license@php.net so we can mail you a copy immediately.               |
      14             :   +----------------------------------------------------------------------+
      15             :   | Author: Keyur Govande (kgovande@gmail.com)                           |
      16             :   +----------------------------------------------------------------------+
      17             : */
      18             : 
      19             : /* $Id$ */
      20             : 
      21             : #ifdef HAVE_CONFIG_H
      22             : #include "config.h"
      23             : #endif
      24             : 
      25             : #include "php.h"
      26             : #include "php_cli_process_title.h"
      27             : #include "ps_title.h"
      28             : 
      29             : /* {{{ proto boolean cli_set_process_title(string arg)
      30             :    Return a boolean to confirm if the process title was successfully changed or not */
      31           1 : PHP_FUNCTION(cli_set_process_title)
      32             : {
      33           1 :     char *title = NULL;
      34             :     int title_len;
      35             :     int rc;
      36             : 
      37           1 :     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &title, &title_len) == FAILURE) {
      38           0 :         return;
      39             :     }
      40             : 
      41           1 :     rc = set_ps_title(title);
      42           1 :     if (rc == PS_TITLE_SUCCESS) {
      43           1 :         RETURN_TRUE;
      44             :     }
      45             : 
      46           0 :     php_error_docref(NULL TSRMLS_CC, E_WARNING, "cli_set_process_title had an error: %s", ps_title_errno(rc));
      47           0 :     RETURN_FALSE;
      48             : }
      49             : /* }}} */
      50             : 
      51             : /* {{{ proto string cli_get_process_title()
      52             :    Return a string with the current process title. NULL if error. */
      53           1 : PHP_FUNCTION(cli_get_process_title)
      54             : {
      55           1 :         int length = 0;
      56           1 :         const char* title = NULL;
      57             :         int rc;
      58             : 
      59           1 :         if (zend_parse_parameters_none() == FAILURE) {
      60           0 :             return;
      61             :         }
      62             : 
      63           1 :         rc = get_ps_title(&length, &title);
      64           1 :         if (rc != PS_TITLE_SUCCESS) {
      65           0 :                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "cli_get_process_title had an error: %s", ps_title_errno(rc));
      66           0 :                 RETURN_NULL();
      67             :         }
      68             : 
      69           1 :         RETURN_STRINGL(title, length, 1);
      70             : }
      71             : /* }}} */
      72             : 
      73             : /*
      74             :  * Local variables:
      75             :  * tab-width: 4
      76             :  * c-basic-offset: 4
      77             :  * End:
      78             :  * vim600: noet sw=4 ts=4 fdm=marker
      79             :  * vim<600: noet sw=4 ts=4
      80             :  */

Generated by: LCOV version 1.10

Generated at Wed, 16 Apr 2014 12:48:03 +0000 (2 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.