#include <stdlib.h>#include <string.h>#include <sys/types.h>#include "loadinfo.h"Go to the source code of this file.
Defines | |
| #define | NULL 0 |
Functions | |
| char * | _nl_find_language (char *name) const |
| int | _nl_explode_name (char *name, const char **language, const char **modifier, const char **territory, const char **codeset, const char **normalized_codeset, const char **special, const char **sponsor, const char **revision) |
|
|
Definition at line 34 of file explodename.c. |
|
||||||||||||||||||||||||||||||||||||||||
|
Definition at line 53 of file explodename.c. 00064 {
00065 enum { undecided, xpg, cen } syntax;
00066 char *cp;
00067 int mask;
00068
00069 *modifier = NULL;
00070 *territory = NULL;
00071 *codeset = NULL;
00072 *normalized_codeset = NULL;
00073 *special = NULL;
00074 *sponsor = NULL;
00075 *revision = NULL;
00076
00077 /* Now we determine the single parts of the locale name. First
00078 look for the language. Termination symbols are `_' and `@' if
00079 we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */
00080 mask = 0;
00081 syntax = undecided;
00082 *language = cp = name;
00083 cp = _nl_find_language (*language);
00084
00085 if (*language == cp)
00086 /* This does not make sense: language has to be specified. Use
00087 this entry as it is without exploding. Perhaps it is an alias. */
00088 cp = strchr (*language, '\0');
00089 else if (cp[0] == '_')
00090 {
00091 /* Next is the territory. */
00092 cp[0] = '\0';
00093 *territory = ++cp;
00094
00095 while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@'
00096 && cp[0] != '+' && cp[0] != ',' && cp[0] != '_')
00097 ++cp;
00098
00099 mask |= TERRITORY;
00100
00101 if (cp[0] == '.')
00102 {
00103 /* Next is the codeset. */
00104 syntax = xpg;
00105 cp[0] = '\0';
00106 *codeset = ++cp;
00107
00108 while (cp[0] != '\0' && cp[0] != '@')
00109 ++cp;
00110
00111 mask |= XPG_CODESET;
00112
00113 if (*codeset != cp && (*codeset)[0] != '\0')
00114 {
00115 *normalized_codeset = _nl_normalize_codeset (*codeset,
00116 cp - *codeset);
00117 if (strcmp (*codeset, *normalized_codeset) == 0)
00118 free ((char *) *normalized_codeset);
00119 else
00120 mask |= XPG_NORM_CODESET;
00121 }
00122 }
00123 }
00124
00125 if (cp[0] == '@' || (syntax != xpg && cp[0] == '+'))
00126 {
00127 /* Next is the modifier. */
00128 syntax = cp[0] == '@' ? xpg : cen;
00129 cp[0] = '\0';
00130 *modifier = ++cp;
00131
00132 while (syntax == cen && cp[0] != '\0' && cp[0] != '+'
00133 && cp[0] != ',' && cp[0] != '_')
00134 ++cp;
00135
00136 mask |= XPG_MODIFIER | CEN_AUDIENCE;
00137 }
00138
00139 if (syntax != xpg && (cp[0] == '+' || cp[0] == ',' || cp[0] == '_'))
00140 {
00141 syntax = cen;
00142
00143 if (cp[0] == '+')
00144 {
00145 /* Next is special application (CEN syntax). */
00146 cp[0] = '\0';
00147 *special = ++cp;
00148
00149 while (cp[0] != '\0' && cp[0] != ',' && cp[0] != '_')
00150 ++cp;
00151
00152 mask |= CEN_SPECIAL;
00153 }
00154
00155 if (cp[0] == ',')
00156 {
00157 /* Next is sponsor (CEN syntax). */
00158 cp[0] = '\0';
00159 *sponsor = ++cp;
00160
00161 while (cp[0] != '\0' && cp[0] != '_')
00162 ++cp;
00163
00164 mask |= CEN_SPONSOR;
00165 }
00166
00167 if (cp[0] == '_')
00168 {
00169 /* Next is revision (CEN syntax). */
00170 cp[0] = '\0';
00171 *revision = ++cp;
00172
00173 mask |= CEN_REVISION;
00174 }
00175 }
00176
00177 /* For CEN syntax values it might be important to have the
00178 separator character in the file name, not for XPG syntax. */
00179 if (syntax == xpg)
00180 {
00181 if (*territory != NULL && (*territory)[0] == '\0')
00182 mask &= ~TERRITORY;
00183
00184 if (*codeset != NULL && (*codeset)[0] == '\0')
00185 mask &= ~XPG_CODESET;
00186
00187 if (*modifier != NULL && (*modifier)[0] == '\0')
00188 mask &= ~XPG_MODIFIER;
00189 }
00190
00191 return mask;
00192 }
|
|
|
Definition at line 41 of file explodename.c. 00043 {
00044 while (name[0] != '\0' && name[0] != '_' && name[0] != '@'
00045 && name[0] != '+' && name[0] != ',')
00046 ++name;
00047
00048 return (char *) name;
00049 }
|
1.3.9.1