Changeset 1910 for ncurses/vendor/current/ncurses/tinfo/hashed_db.c
- Timestamp:
- Jan 13, 2017, 3:21:12 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified ncurses/vendor/current/ncurses/tinfo/hashed_db.c ¶
r85 r1910 1 1 /**************************************************************************** 2 * Copyright (c) 2006 Free Software Foundation, Inc.*2 * Copyright (c) 2006,2008 Free Software Foundation, Inc. * 3 3 * * 4 4 * Permission is hereby granted, free of charge, to any person obtaining a * … … 28 28 29 29 /**************************************************************************** 30 * Author: Thomas E. Dickey 2006 30 * Author: Thomas E. Dickey 2006-on * 31 31 ****************************************************************************/ 32 32 … … 37 37 #if USE_HASHED_DB 38 38 39 MODULE_ID("$Id: hashed_db.c,v 1.1 3 2006/08/19 19:48:38tom Exp $")39 MODULE_ID("$Id: hashed_db.c,v 1.14 2008/12/13 20:59:02 tom Exp $") 40 40 41 41 #if HASHED_DB_API >= 2 … … 50 50 { 51 51 DB *result = 0; 52 int code; 52 53 53 54 #if HASHED_DB_API >= 4 54 55 db_create(&result, NULL, 0); 55 result->open(result, 56 NULL, 57 path, 58 NULL, 59 DB_HASH, 60 modify ? DB_CREATE : DB_RDONLY, 61 0644); 56 if ((code = result->open(result, 57 NULL, 58 path, 59 NULL, 60 DB_HASH, 61 modify ? DB_CREATE : DB_RDONLY, 62 0644)) != 0) { 63 result = 0; 64 } 62 65 #elif HASHED_DB_API >= 3 63 66 db_create(&result, NULL, 0); 64 result->open(result, 65 path, 66 NULL, 67 DB_HASH, 68 modify ? DB_CREATE : DB_RDONLY, 69 0644); 67 if ((code = result->open(result, 68 path, 69 NULL, 70 DB_HASH, 71 modify ? DB_CREATE : DB_RDONLY, 72 0644)) != 0) { 73 result = 0; 74 } 70 75 #elif HASHED_DB_API >= 2 71 int code;72 73 76 if ((code = db_open(path, 74 77 DB_HASH, … … 78 81 (DB_INFO *) 0, 79 82 &result)) != 0) { 80 T(("cannot open %s: %s", path, strerror(code)));81 83 result = 0; 82 } else { 83 T(("opened %s", path)); 84 } 85 #else 86 result = dbopen(path, 87 modify ? (O_CREAT | O_RDWR) : O_RDONLY, 88 0644, 89 DB_HASH, 90 NULL); 84 } 85 #else 86 if ((result = dbopen(path, 87 modify ? (O_CREAT | O_RDWR) : O_RDONLY, 88 0644, 89 DB_HASH, 90 NULL)) == 0) { 91 code = errno; 92 } 93 #endif 91 94 if (result != 0) { 92 95 T(("opened %s", path)); 93 } 94 #endif 96 } else { 97 T(("cannot open %s: %s", path, strerror(code))); 98 } 95 99 return result; 96 100 }
Note:
See TracChangeset
for help on using the changeset viewer.