gtxt.c (7257d1b4) | gtxt.c (b599bd93) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 13 unchanged lines hidden (view full) --- 22/* 23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27/* Copyright (c) 1988 AT&T */ 28/* All Rights Reserved */ 29 | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 13 unchanged lines hidden (view full) --- 22/* 23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27/* Copyright (c) 1988 AT&T */ 28/* All Rights Reserved */ 29 |
30#pragma ident "%Z%%M% %I% %E% SMI" 31 | |
32/* __gtxt(): Common part to gettxt() and pfmt() */ 33 34#pragma weak _setcat = setcat 35 36#include "lint.h" 37#include "libc.h" 38#include <mtlib.h> 39#include <sys/types.h> --- 215 unchanged lines hidden (view full) --- 255 * try to open the catalogue again. 256 */ 257const char * 258__gtxt(const char *catname, int id, const char *dflt) 259{ 260 char *curloc; 261 struct db_info *db; 262 int err; | 30/* __gtxt(): Common part to gettxt() and pfmt() */ 31 32#pragma weak _setcat = setcat 33 34#include "lint.h" 35#include "libc.h" 36#include <mtlib.h> 37#include <sys/types.h> --- 215 unchanged lines hidden (view full) --- 253 * try to open the catalogue again. 254 */ 255const char * 256__gtxt(const char *catname, int id, const char *dflt) 257{ 258 char *curloc; 259 struct db_info *db; 260 int err; |
261 locale_t loc; |
|
263 264 /* Check for invalid message id */ 265 if (id < 0) 266 return (not_found); 267 if (id == 0) 268 return ((dflt && *dflt) ? dflt : not_found); 269 270 /* --- 5 unchanged lines hidden (view full) --- 276 if (cur_cat == NULL || !*cur_cat) { 277 lrw_unlock(&_rw_cur_cat); 278 return (not_found); 279 } 280 catname = cur_cat; 281 lrw_unlock(&_rw_cur_cat); 282 } 283 | 262 263 /* Check for invalid message id */ 264 if (id < 0) 265 return (not_found); 266 if (id == 0) 267 return ((dflt && *dflt) ? dflt : not_found); 268 269 /* --- 5 unchanged lines hidden (view full) --- 275 if (cur_cat == NULL || !*cur_cat) { 276 lrw_unlock(&_rw_cur_cat); 277 return (not_found); 278 } 279 catname = cur_cat; 280 lrw_unlock(&_rw_cur_cat); 281 } 282 |
284 curloc = setlocale(LC_MESSAGES, NULL); | 283 loc = uselocale(NULL); 284 curloc = current_locale(loc, LC_MESSAGES); |
285 286 /* First look up the cache */ 287 db = lookup_cache(NULL, curloc, catname); 288 if (db != NULL) { 289 /* 290 * The catalog has been loaded, and if id seems valid, 291 * then just return. 292 */ --- 56 unchanged lines hidden --- | 285 286 /* First look up the cache */ 287 db = lookup_cache(NULL, curloc, catname); 288 if (db != NULL) { 289 /* 290 * The catalog has been loaded, and if id seems valid, 291 * then just return. 292 */ --- 56 unchanged lines hidden --- |