void setnames(const char *fname, const char *cname = 0) { if(!cname) cname = fname; string name, pakname, mapname, cfgname; s_strncpy(name, cname, 100); char *slash = strpbrk(name, "/\\"); if(slash) { s_strncpy(pakname, name, slash-name+1); s_strcpy(cfgname, slash+1); } else { s_strcpy(pakname, "base"); s_strcpy(cfgname, name); }; if(strpbrk(fname, "/\\")) s_strcpy(mapname, fname); else s_sprintf(mapname)("base/%s", fname); s_sprintf(cgzname)("packages/%s.tmf", mapname); if(savebak==1) s_sprintf(bakname)("packages/%s.BAK", mapname); else s_sprintf(bakname)("packages/%s_%d.BAK", mapname, lastmillis); s_sprintf(pcfname)("packages/%s/package.cfg", pakname); s_sprintf(mcfname)("packages/%s/%s.cfg", pakname, cfgname); path(cgzname); path(bakname); };
void FileExplorer_SetPath(char * path) { if(path) s_strncpy(exploring_path,path,sizeof(exploring_path)); else s_strncpy(exploring_path,".",sizeof(exploring_path)); }
void FileExplorer_ListAdd(char * name, int isdir) { if(strcmp(name,".") == 0) return; if(strcmp(name, "..") == 0) { if(is_root) // add ".." only if there is not one entry yet is_root = 0; else return; } if(filenum < maxfiles) { if(isdir == 0) { if(_file_explorer_is_valid_rom_type(name) == 0) return; } list_isdir[filenum] = isdir; int size = strlen(name)+1; filename[filenum] = malloc(size); s_strncpy(filename[filenum],name,size); filenum ++; } }
/* * Unlocks the device with the passphrase specified. */ int nvm_unlock_device(const NVM_UID device_uid, const NVM_PASSPHRASE passphrase, const NVM_SIZE passphrase_len) { COMMON_LOG_ENTRY(); int rc = NVM_SUCCESS; struct device_discovery discovery; // check user has permission to make changes if (check_caller_permissions() != COMMON_SUCCESS) { rc = NVM_ERR_INVALIDPERMISSIONS; } else if (!is_supported_driver_available()) { rc = NVM_ERR_BADDRIVER; } else if ((rc = IS_NVM_FEATURE_SUPPORTED(modify_device_security)) != NVM_SUCCESS) { COMMON_LOG_ERROR("Modifying " NVM_DIMM_NAME " security is not supported."); } else if (device_uid == NULL) { COMMON_LOG_ERROR("Invalid parameter, device_uid is NULL"); rc = NVM_ERR_INVALIDPARAMETER; } else if (((rc = check_passphrase(passphrase, passphrase_len)) == NVM_SUCCESS) && ((rc = exists_and_manageable(device_uid, &discovery, 1)) == NVM_SUCCESS) && ((rc = check_unlock_device_capable(device_uid)) == NVM_SUCCESS)) { if ((rc = security_change_prepare(&discovery, passphrase, passphrase_len)) == NVM_SUCCESS) { // send a pass through command to unlock the device struct pt_payload_passphrase input_payload; memset(&input_payload, 0, sizeof (input_payload)); s_strncpy(input_payload.passphrase_current, NVM_PASSPHRASE_LEN, passphrase, passphrase_len); struct fw_cmd cmd; memset(&cmd, 0, sizeof (struct fw_cmd)); cmd.device_handle = discovery.device_handle.handle; cmd.opcode = PT_SET_SEC_INFO; cmd.sub_opcode = SUBOP_UNLOCK_UNIT; cmd.input_payload_size = sizeof (input_payload); cmd.input_payload = &input_payload; rc = ioctl_passthrough_cmd(&cmd); s_memset(&input_payload, sizeof (input_payload)); // clear any device context - security state has likely changed invalidate_devices(); } } COMMON_LOG_EXIT_RETURN_I(rc); return rc; }
int security_change_prepare(struct device_discovery *p_discovery, const NVM_PASSPHRASE passphrase, const NVM_SIZE passphrase_len) { COMMON_LOG_ENTRY(); int rc = NVM_SUCCESS; NVM_UID uid_str; rc = check_lock_state(p_discovery); if (rc != NVM_SUCCESS) { uid_copy(p_discovery->uid, uid_str); COMMON_LOG_ERROR_F("device lock state was not correct for the " "requested operation on the device %s", uid_str); } // Do not proceed if user sends passphrase in disabled state else if (passphrase_len > 0 && p_discovery->lock_state == LOCK_STATE_DISABLED) { uid_copy(p_discovery->uid, uid_str); COMMON_LOG_ERROR_F("Failed to modify security on device %s \ because passphrase is provided when the security is disabled", uid_str); rc = NVM_ERR_SECURITYDISABLED; } // if locked, try to unlock else if (p_discovery->lock_state == LOCK_STATE_LOCKED) { // send the pass through ioctl to unlock the dimm struct pt_payload_passphrase input_payload; memset(&input_payload, 0, sizeof (input_payload)); s_strncpy(input_payload.passphrase_current, NVM_PASSPHRASE_LEN, passphrase, passphrase_len); struct fw_cmd cmd; memset(&cmd, 0, sizeof (struct fw_cmd)); cmd.device_handle = p_discovery->device_handle.handle; cmd.opcode = PT_SET_SEC_INFO; cmd.sub_opcode = SUBOP_UNLOCK_UNIT; cmd.input_payload_size = sizeof (input_payload); cmd.input_payload = &input_payload; rc = ioctl_passthrough_cmd(&cmd); s_memset(&input_payload, sizeof (input_payload)); } COMMON_LOG_EXIT_RETURN_I(rc); return rc; }
/* * Helper method to make secure erase call */ int secure_erase(const NVM_PASSPHRASE passphrase, const NVM_SIZE passphrase_len, struct device_discovery *p_discovery) { int rc = NVM_ERR_UNKNOWN; // try to send the prepare/erase command combo up to 5 times int count = 0; do { // erase struct pt_payload_passphrase input_payload; memset(&input_payload, 0, sizeof (input_payload)); s_strncpy(input_payload.passphrase_current, NVM_PASSPHRASE_LEN, passphrase, passphrase_len); struct fw_cmd cmd; memset(&cmd, 0, sizeof (struct fw_cmd)); cmd.device_handle = p_discovery->device_handle.handle; cmd.opcode = PT_SET_SEC_INFO; cmd.sub_opcode = SUBOP_SEC_ERASE_UNIT; cmd.input_payload_size = sizeof (input_payload); cmd.input_payload = &input_payload; rc = ioctl_passthrough_cmd(&cmd); s_memset(&input_payload, sizeof (input_payload)); count++; } while (rc == NVM_ERR_DEVICEBUSY && count < 5); // log event if it succeeded if (rc == NVM_SUCCESS) { store_event_by_parts(EVENT_TYPE_MGMT, EVENT_SEVERITY_INFO, EVENT_CODE_MGMT_SECURITY_SECURE_ERASE, p_discovery->uid, 0, // no action required p_discovery->uid, NULL, NULL, DIAGNOSTIC_RESULT_UNKNOWN); } return rc; }
static const char* getLastChars (const char* string, int n, s_erc *error) { char* result = NULL; char tmp[7]; int i = 0; int j = s_strlen(string, error); if (S_CHK_ERR(error, S_CONTERR, "getLastChars", "Call to \"s_strlen\" failed")) return NULL; if (string == NULL || j < n ) return NULL; while (string[i] != '\0' && j > 0 ) { s_strncpy (tmp, string +i, 1, error); if (S_CHK_ERR(error, S_CONTERR, "getLastChars", "Call to \"s_strncpy\" failed")) return NULL; j -= 1; if ( j < n ) { s_sappend (&result, tmp, error); if (S_CHK_ERR(error, S_CONTERR, "getLastChars", "Call to \"s_sappend\" failed")) return NULL; } i += s_width(tmp, error); if (S_CHK_ERR(error, S_CONTERR, "getLastChars", "Call to \"s_width\" failed")) return NULL; } return result; }
int FileExplorer_SelectEntry(char * file) { if(strcmp(file,".") == 0) return 1; if(strcmp(file,"..") == 0) { FileExplorer_GoUp(); return 1; } char file_path[MAX_PATHLEN]; snprintf(file_path,sizeof(file_path),"%s%s",exploring_path,file); struct stat statbuf; stat(file_path,&statbuf); //Debug_DebugMsgArg("stat(%s)",file_path); if(S_ISDIR(statbuf.st_mode)) { char separator_str[2]; separator_str[0] = GetFolderSeparator(exploring_path); separator_str[1] = '\0'; //Debug_DebugMsgArg("Before: %s",exploring_path); s_strncat(exploring_path,file,sizeof(exploring_path)); s_strncat(exploring_path,separator_str,sizeof(exploring_path)); //Debug_DebugMsgArg("After: %s",exploring_path); FileExplorer_LoadFolder(); return 1; } else { s_strncpy(fileselected,file_path,sizeof(fileselected)); return 0; } return 0; }
static const char* getFirstChars ( const char* string, int n, s_erc *error) { char* result = NULL; char tmp[7]; int i = 0, j = 0; if (string == NULL) return NULL; while (string[i] != '\0' && j < n ) { s_strncpy (tmp, string +i, 1, error); if (S_CHK_ERR(error, S_CONTERR, "getFirstChars", "Call to \"s_strncpy\" failed")) return NULL; s_sappend (&result, tmp, error); if (S_CHK_ERR(error, S_CONTERR, "getFirstChars", "Call to \"s_sappend\" failed")) return NULL; j += 1; i += s_width(tmp, error); if (S_CHK_ERR(error, S_CONTERR, "getFirstChars", "Call to \"s_width\" failed")) return NULL; } if ( j == n ) return result; else return NULL; }
static const char* removeDoubles ( const char* string, s_erc *error) { char* result = NULL; char tmp[7]; char tmp2[7]; int i = 0; if (string == NULL) return NULL; while (string[i] != '\0') { /*check if next char is the same of the actual char, if so it skips it * and check for the next one ( care for the UTF8 format ) */ s_strncpy (tmp, string +i, 1, error); if (S_CHK_ERR(error, S_CONTERR, "removeDoubles", "Call to \"s_strncpy\" failed")) return NULL; s_strncpy (tmp2, string +i, 1, error); if (S_CHK_ERR(error, S_CONTERR, "removeDoubles", "Call to \"s_strncpy\" failed")) return NULL; int j = s_width(tmp2, error); if (S_CHK_ERR(error, S_CONTERR, "removeDoubles", "Call to \"s_width\" failed")) return NULL; while ( string[i] == string[i+j] ) { s_strncpy (tmp2, string +i, 1, error); if (S_CHK_ERR(error, S_CONTERR, "removeDoubles", "Call to \"s_strncpy\" failed")) return NULL; j += s_width(tmp2, error); } s_sappend (&result, tmp, error); if (S_CHK_ERR(error, S_CONTERR, "removeDoubles", "Call to \"s_sappend\" failed")) return NULL; i += j; /*next char that is not repeated*/ } result = s_strlwr( result, error ); if (S_CHK_ERR(error, S_CONTERR, "removeDoubles", "Call to \"s_strlwr\" failed")) return NULL; return result; }
/* * Disables data at rest security and removes the passphrase. * The device will be unlocked if it is currently locked. */ int nvm_remove_passphrase(const NVM_UID device_uid, const NVM_PASSPHRASE passphrase, const NVM_SIZE passphrase_len) { COMMON_LOG_ENTRY(); int rc = NVM_SUCCESS; struct device_discovery discovery; // check user has permission to make changes if (check_caller_permissions() != COMMON_SUCCESS) { rc = NVM_ERR_INVALIDPERMISSIONS; } else if (!is_supported_driver_available()) { rc = NVM_ERR_BADDRIVER; } else if ((rc = IS_NVM_FEATURE_SUPPORTED(modify_device_security)) != NVM_SUCCESS) { COMMON_LOG_ERROR("Modifying " NVM_DIMM_NAME " security is not supported."); } else if (device_uid == NULL) { COMMON_LOG_ERROR("Invalid parameter, device_uid is NULL"); rc = NVM_ERR_INVALIDPARAMETER; } else if (((rc = check_passphrase(passphrase, passphrase_len)) == NVM_SUCCESS) && ((rc = exists_and_manageable(device_uid, &discovery, 1)) == NVM_SUCCESS) && ((rc = check_passphrase_capable(device_uid)) == NVM_SUCCESS) && ((rc = security_change_prepare(&discovery, passphrase, passphrase_len)) == NVM_SUCCESS)) { // send a pass through command to disable security struct pt_payload_passphrase input_payload; memset(&input_payload, 0, sizeof (input_payload)); s_strncpy(input_payload.passphrase_current, NVM_PASSPHRASE_LEN, passphrase, passphrase_len); struct fw_cmd cmd; memset(&cmd, 0, sizeof (struct fw_cmd)); cmd.device_handle = discovery.device_handle.handle; cmd.opcode = PT_SET_SEC_INFO; cmd.sub_opcode = SUBOP_DISABLE_PASS; cmd.input_payload_size = sizeof (input_payload); cmd.input_payload = &input_payload; rc = ioctl_passthrough_cmd(&cmd); if (rc == NVM_SUCCESS) { // Log an event indicating we successfully removed the passphrase NVM_EVENT_ARG uid_arg; uid_to_event_arg(device_uid, uid_arg); log_mgmt_event(EVENT_SEVERITY_INFO, EVENT_CODE_MGMT_SECURITY_PASSWORD_REMOVED, device_uid, 0, // no action required uid_arg, NULL, NULL); } s_memset(&input_payload, sizeof (input_payload)); // clear any device context - security state has likely changed invalidate_devices(); } COMMON_LOG_EXIT_RETURN_I(rc); return rc; }
int main(const carg, const char *varg[]) { char *s; int i; s = NULL; i = 0; fprintf(stdout, "s_strcpy(NULL, \"\") == FALSE: "); if (s_strcpy(NULL, "") == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strncpy(NULL, \"\", 10) == FALSE: "); if (s_strncpy(NULL, "", 10) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strcat(NULL, \"\") == FALSE: "); if (s_strcat(NULL, "") == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strncat(NULL, \"\", 10) == FALSE: "); if (s_strncat(NULL, "", 10) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strcpy(&s, NULL) == FALSE: "); if (s_strcpy(&s, NULL) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strncpy(&s, NULL, 10) == FALSE: "); if (s_strncpy(&s, NULL, 10) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strcat(&s, NULL) == FALSE: "); if (s_strcat(&s, NULL) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strncat(&s, NULL, 10) == FALSE: "); if (s_strncat(&s, NULL, 10) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strcpy(&s, \"ab\"), strcmp(s, \"ab\") == 0: "); s_strcpy(&s, "ab"); if (strcmp(s, "ab") == 0) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strncpy(&s, \"ab\", 1), strcmp(s, \"a\") == 0: "); s_strncpy(&s, "ab", 1); if (strcmp(s, "a") == 0) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strcat(&s, \"ab\"), strcmp(s, \"aab\") == 0: "); s_strcat(&s, "ab"); if (strcmp(s, "aab") == 0) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strncat(&s, \"ab\", 1), strcmp(s, \"aaba\") == 0: "); s_strncat(&s, "ab", 1); if (strcmp(s, "aaba") == 0) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strcpy(&s, \"abcdefghij klmnop\"), s_strcpy(&s, s), strcmp(s, \"abcdefghij klmnop\") == 0: "); s_strcpy(&s, "abcdefghij klmnop"); s_strcpy(&s, s); if (strcmp(s, "abcdefghij klmnop") == 0) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strncpy(&s, s, 10), strcmp(s, \"abcdefghij\") == 0: "); s_strncpy(&s, s, 10); if (strcmp(s, "abcdefghij") == 0) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strcat(&s, s), strcmp(s, \"abcdefghijabcdefghij\") == 0: "); s_strcat(&s, s); if (strcmp(s, "abcdefghijabcdefghij") == 0) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_strncat(&s, s, 10), strcmp(s, \"abcdefghijabcdefghijabcdefghij\") == 0: "); s_strncat(&s, s, 10); if (strcmp(s, "abcdefghijabcdefghijabcdefghij") == 0) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_path(NULL, \"\", SYS_PATH_DELIM) == FALSE: "); if (s_path(NULL, "", SYS_PATH_DELIM) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_pathname(NULL, \"\", SYS_PATH_DELIM) == FALSE: "); if (s_pathname(NULL, "", SYS_PATH_DELIM) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_name(NULL, \"\", SYS_PATH_DELIM) == FALSE: "); if (s_name(NULL, "", SYS_PATH_DELIM) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_nameext(NULL, \"\", SYS_PATH_DELIM) == FALSE: "); if (s_nameext(NULL, "", SYS_PATH_DELIM) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_ext(NULL, \"\", SYS_PATH_DELIM) == FALSE: "); if (s_ext(NULL, "", SYS_PATH_DELIM) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_path(&s, NULL, SYS_PATH_DELIM) == FALSE: "); if (s_path(&s, NULL, SYS_PATH_DELIM) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_pathname(&s, NULL, SYS_PATH_DELIM) == FALSE: "); if (s_pathname(&s, NULL, SYS_PATH_DELIM) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_name(&s, NULL, SYS_PATH_DELIM) == FALSE: "); if (s_name(&s, NULL, SYS_PATH_DELIM) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_nameext(&s, NULL, SYS_PATH_DELIM) == FALSE: "); if (s_nameext(&s, NULL, SYS_PATH_DELIM) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_ext(&s, NULL, SYS_PATH_DELIM) == FALSE: "); if (s_ext(&s, NULL, SYS_PATH_DELIM) == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } s_strcpy(&s, "/path/name.ext"); s_path(&s, s, SYS_PATH_DELIM); fprintf(stdout, "s_strcpy(&s, \"/path/name.ext\"), s_path(&s, s, SYS_PATH_DELIM), strcmp(s, \"/path/\") == 0: "); if (strcmp(s, "/path/") == 0) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } s_strcpy(&s, "/path/name.ext"); s_pathname(&s, s, SYS_PATH_DELIM); fprintf(stdout, "s_strcpy(&s, \"/path/name.ext\"), s_pathname(&s, s, SYS_PATH_DELIM), strcmp(s, \"/path/name\") == 0: "); if (strcmp(s, "/path/name") == 0) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } s_strcpy(&s, "/path/name.ext"); s_name(&s, s, SYS_PATH_DELIM); fprintf(stdout, "s_strcpy(&s, \"/path/name.ext\"), s_name(&s, s, SYS_PATH_DELIM), strcmp(s, \"name\") == 0: "); if (strcmp(s, "name") == 0) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } s_strcpy(&s, "/path/name.ext"); s_nameext(&s, s, SYS_PATH_DELIM); fprintf(stdout, "s_strcpy(&s, \"/path/name.ext\"), s_nameext(&s, s, SYS_PATH_DELIM), strcmp(s, \"name.ext\") == 0: "); if (strcmp(s, "name.ext") == 0) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } s_strcpy(&s, "/path/name.ext"); s_ext(&s, s, SYS_PATH_DELIM); fprintf(stdout, "s_strcpy(&s, \"/path/name.ext\"), s_ext(&s, s, SYS_PATH_DELIM), strcmp(s, \".ext\") == 0: "); if (strcmp(s, ".ext") == 0) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } i += check_pathnameext("", "", "", "", "", ""); i += check_pathnameext("/", "/", "/", "", "", ""); i += check_pathnameext("path/", "path/", "path/", "", "", ""); i += check_pathnameext("name", "", "name", "name", "name", ""); i += check_pathnameext(".ext", "", "", "", ".ext", ".ext"); i += check_pathnameext("path/name", "path/", "path/name", "name", "name", ""); i += check_pathnameext("path/.ext", "path/", "path/", "", ".ext", ".ext"); i += check_pathnameext("name.ext", "", "name", "name", "name.ext", ".ext"); i += check_pathnameext("path/name.ext", "path/", "path/name", "name", "name.ext", ".ext"); i += check_pathnameext("path.e/", "path.e/", "path.e/", "", "", ""); i += check_pathnameext("path.e/name", "path.e/", "path.e/name", "name", "name", ""); i += check_pathnameext("path.e/.ext", "path.e/", "path.e/", "", ".ext", ".ext"); i += check_pathnameext("path.e/name.ext", "path.e/", "path.e/name", "name", "name.ext", ".ext"); fprintf(stdout, "s_sprintf(NULL, \"%%d abc %%s\", -2147483648, \"def\") == FALSE: "); if (s_sprintf(NULL, "%d abc %s", -2147483648, "def") == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "s_sprintf(&s, NULL, -2147483648, \"def\") == FALSE: "); if (s_sprintf(&s, NULL, -2147483648, "def") == FALSE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } s_sprintf(&s, "%d abc %s", -2147483648, "def"); fprintf(stdout, "s_sprintf(&s, \"%%d abc %%s\", -2147483648, \"def\"), strcmp(s, \"-2147483648 abc def\") == 0: "); if (strcmp(s, "-2147483648 abc def") == 0) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } fprintf(stdout, "is_equal_files(\"%s\", \"%s\") == TRUE: ", varg[0], varg[0]); if (is_equal_files(varg[0], varg[0]) == TRUE) fprintf(stdout, "OK\n"); else { fprintf(stdout, "failed.\n"); i++; } s_free(&s); fprintf(stderr, "Found %d errors.\n", i); return i; }
/* * Return the base path for the language catalog */ void get_locale_dir(COMMON_PATH locale_dir) { s_strncpy(locale_dir, COMMON_PATH_LEN, LOCALE_DIR, COMMON_PATH_LEN); }
/* * .so for linux */ char *dlib_suffix(char *buffer, COMMON_SIZE buffer_len) { s_strncpy(buffer, buffer_len, ".so", s_strnlen(".so", 4)); return buffer; }