Mon Mar 20 08:26:05 2006

Asterisk developer's documentation


Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

strcompat.c File Reference

#include <sys/types.h>
#include <stdio.h>
#include "asterisk/compat.h"

Go to the source code of this file.

Functions

int setenv (const char *name, const char *value, int overwrite)
char * strsep (char **str, const char *delims)
int unsetenv (const char *name)


Function Documentation

int setenv const char *  name,
const char *  value,
int  overwrite
 

Definition at line 33 of file strcompat.c.

References free, malloc, and name.

Referenced by builtin_function_env_write(), main(), and unsetenv().

00034 {
00035    unsigned char *buf;
00036    int buflen, ret;
00037 
00038    buflen = strlen(name) + strlen(value) + 2;
00039    if ((buf = malloc(buflen)) == NULL)
00040       return -1;
00041 
00042    if (!overwrite && getenv(name))
00043       return 0;
00044 
00045    snprintf(buf, buflen, "%s=%s", name, value);
00046    ret = putenv(buf);
00047 
00048    free(buf);
00049 
00050    return ret;
00051 }

char* strsep char **  str,
const char *  delims
 

Definition at line 8 of file strcompat.c.

Referenced by __login_exec(), acf_curl_exec(), acf_strftime(), acf_vmcount_exec(), add_realm_authentication(), admin_exec(), adsi_load(), adsi_message(), agi_exec_full(), aPGSQL_clear(), aPGSQL_connect(), aPGSQL_disconnect(), aPGSQL_fetch(), aPGSQL_query(), aPGSQL_reset(), append_mailbox(), apply_options(), apply_outgoing(), ast_device_state(), ast_el_strtoarr(), ast_feature_interpret(), ast_fileexists(), ast_filehelper(), ast_get_group(), ast_hint_state_changed(), ast_netsock_bind(), ast_parse_allow_disallow(), ast_parseable_goto(), ast_play_and_prepend(), ast_play_and_record(), ast_playtones_start(), ast_read_image(), ast_remotecontrol(), astman_get_variables(), attempt_reconnect(), authenticate_verify(), background_detect_exec(), builtin_function_if(), builtin_function_iftime(), builtin_function_set(), chanavail_exec(), collect_function_digits(), complete_confcmd(), complete_context_add_ignorepat(), complete_context_add_include(), complete_context_dont_include(), complete_context_remove_extension(), complete_context_remove_ignorepat(), conf_exec(), console_dial(), count_exec(), curl_exec(), cut_exec(), cut_internal(), decrypt_frame(), del_exec(), deltree_exec(), dial_exec_full(), do_directory(), eval_exec(), exec_exec(), exts_compare(), find_conf(), fix_complete_args(), forward_message(), function_fieldqty(), function_ilink(), function_remote(), get_exec(), get_group(), getSearchPath(), gosubif_exec(), handle_common_options(), handle_context_add_extension(), handle_dumpagihtml(), handle_show_dialplan(), has_voicemail(), hasvoicemail_exec(), iax2_register(), ind_load_module(), ivr_dispatch(), leave_voicemail(), load_config(), macro_exec(), make_components(), math_exec(), md5_exec(), messagecount(), modem_call(), modem_request(), notify_new_message(), page_exec(), parkandannounce_exec(), parse_dial_string(), pbx_builtin_execiftime(), pbx_builtin_gotoif(), pbx_builtin_gotoiftime(), pbx_builtin_importvar(), pbx_builtin_saynumber(), pbx_builtin_setglobalvar(), pbx_load_module(), peer_set_srcaddr(), process_text_line(), put_exec(), queue_exec(), random_exec(), read_config_maps(), readfile_exec(), realtime_multi_odbc(), realtime_odbc(), record_exec(), reg_source_db(), register_peer_exten(), register_verify(), reload_agents(), reload_queue_members(), reply_digest(), rpt_exec(), rpt_tele_thread(), sayunixtime_exec(), send_tone_telemetry(), sendurl_exec(), set_config_flags(), setup_zap(), sip_getheader(), sip_register(), sip_sipredirect(), softhangup_exec(), sort_exec(), sort_internal(), spawn_ras(), ss_thread(), verbose_exec(), vmauthenticate(), vpb_request(), zapateller_exec(), and zt_request().

00009 {
00010     char* token;
00011 
00012     if (*str==NULL) {
00013         /* No more tokens */
00014         return NULL;
00015     }
00016 
00017     token=*str;
00018     while (**str!='\0') {
00019         if (strchr(delims,**str)!=NULL) {
00020             **str='\0';
00021             (*str)++;
00022             return token;
00023         }
00024         (*str)++;
00025     }
00026     /* There is no other token */
00027     *str=NULL;
00028     return token;
00029 }

int unsetenv const char *  name  ) 
 

Definition at line 53 of file strcompat.c.

References name, and setenv().

Referenced by builtin_function_env_write().

00054 {
00055   setenv(name,"",0);
00056 }


Generated on Mon Mar 20 08:26:05 2006 for Asterisk - the Open Source PBX by  doxygen 1.3.9.1