--------------------------------------------------------------------* * Special file name operations * *--------------------------------------------------------------------*/ ! * \brief convertSepCharsInPath() * * \param[in] path * \param[in] type UNIX_PATH_SEPCHAR, WIN_PATH_SEPCHAR * \return 0 if OK, 1 on error * * * Notes: * (1
| 2699 | * </pre> |
| 2700 | */ |
| 2701 | l_int32 |
| 2702 | convertSepCharsInPath(char *path, |
| 2703 | l_int32 type) |
| 2704 | { |
| 2705 | l_int32 i; |
| 2706 | size_t len; |
| 2707 | |
| 2708 | PROCNAME("convertSepCharsInPath"); |
| 2709 | if (!path) |
| 2710 | return ERROR_INT("path not defined", procName, 1); |
| 2711 | if (type != UNIX_PATH_SEPCHAR && type != WIN_PATH_SEPCHAR) |
| 2712 | return ERROR_INT("invalid type", procName, 1); |
| 2713 | |
| 2714 | len = strlen(path); |
| 2715 | if (type == UNIX_PATH_SEPCHAR) { |
| 2716 | for (i = 0; i < len; i++) { |
| 2717 | if (path[i] == '\\') |
| 2718 | path[i] = '/'; |
| 2719 | } |
| 2720 | } else { /* WIN_PATH_SEPCHAR */ |
| 2721 | for (i = 0; i < len; i++) { |
| 2722 | if (path[i] == '/') |
| 2723 | path[i] = '\\'; |
| 2724 | } |
| 2725 | } |
| 2726 | return 0; |
| 2727 | } |
| 2728 | |
| 2729 | |
| 2730 | /*! |
no outgoing calls
no test coverage detected