term_t bif_read_file_info0_1(term_t Filename, process_t *ctx) { apr_status_t rs; apr_finfo_t fi; const char *file_name; apr_pool_t *tmp; apr_uint32_t wanted; if (!is_string(Filename)) return A_BADARG; apr_pool_create(&tmp, 0); file_name = ltoz(Filename, tmp); wanted = APR_FINFO_MTIME | APR_FINFO_CTIME | APR_FINFO_ATIME | APR_FINFO_NAME | APR_FINFO_SIZE | APR_FINFO_TYPE | APR_FINFO_USER | APR_FINFO_GROUP | APR_FINFO_PROT; rs = apr_stat(&fi, file_name, wanted, tmp); if (rs == 0 || APR_STATUS_IS_INCOMPLETE(rs)) { term_t finfo = make_file_info(&fi, proc_gc_pool(ctx)); result(finfo); } else result(make_tuple2(A_ERROR, decipher_status(rs), proc_gc_pool(ctx))); apr_pool_destroy(tmp); return AI_OK; }
int lua_apr_stat(lua_State *L) { const char *path, *name, *dir; apr_pool_t *memory_pool; lua_apr_stat_context context = { 0 }; apr_status_t status; memory_pool = to_pool(L); path = luaL_checkstring(L, 1); name = apr_filepath_name_get(path); dir = apr_pstrndup(memory_pool, path, name - path); context.firstarg = 2; context.lastarg = lua_gettop(L); check_stat_request(L, &context); status = apr_stat(&context.info, path, context.wanted, memory_pool); if (status != APR_SUCCESS && !APR_STATUS_IS_INCOMPLETE(status)) return push_error_status(L, status); /* XXX apr_stat() doesn't fill in finfo.name (tested on Linux) */ if (!(context.info.valid & APR_FINFO_NAME)) { context.info.valid |= APR_FINFO_NAME; context.info.name = name; } return push_stat_results(L, &context, dir); }
static void create_testfile(apr_pool_t *p, const char *fname) { apr_file_t *f = NULL; apr_status_t rv; char buf[120]; int i; apr_finfo_t finfo; printf("Creating a test file...\n"); rv = apr_file_open(&f, fname, APR_FOPEN_CREATE | APR_FOPEN_WRITE | APR_FOPEN_TRUNCATE | APR_FOPEN_BUFFERED, APR_UREAD | APR_UWRITE, p); if (rv) { aprerr("apr_file_open()", rv); } buf[0] = FILE_DATA_CHAR; buf[1] = '\0'; for (i = 0; i < FILE_LENGTH; i++) { /* exercise apr_file_putc() and apr_file_puts() on buffered files */ if ((i % 2) == 0) { rv = apr_file_putc(buf[0], f); if (rv) { aprerr("apr_file_putc()", rv); } } else { rv = apr_file_puts(buf, f); if (rv) { aprerr("apr_file_puts()", rv); } } } rv = apr_file_close(f); if (rv) { aprerr("apr_file_close()", rv); } rv = apr_stat(&finfo, fname, APR_FINFO_NORM, p); if (rv != APR_SUCCESS && ! APR_STATUS_IS_INCOMPLETE(rv)) { aprerr("apr_stat()", rv); } if (finfo.size != FILE_LENGTH) { fprintf(stderr, "test file %s should be %ld-bytes long\n" "instead it is %ld-bytes long\n", fname, (long int)FILE_LENGTH, (long int)finfo.size); exit(1); } }
term_t bif_list_dir1(term_t Dir, process_t *ctx) { apr_status_t rs; apr_pool_t *p; const char *path; apr_dir_t *dir; term_t r = nil; term_t cons = nil; if (!is_string(Dir)) return A_BADARG; apr_pool_create(&p, 0); path = ltoz(Dir, p); rs = apr_dir_open(&dir, path, p); if (rs == 0) { apr_finfo_t fi; for (;;) { rs = apr_dir_read(&fi, APR_FINFO_NAME | APR_FINFO_SIZE, dir); if (rs == 0 || APR_STATUS_IS_INCOMPLETE(rs)) { term_t name = ztol(fi.name, proc_gc_pool(ctx)); lst_add(r, cons, name, proc_gc_pool(ctx)); } if (APR_STATUS_IS_ENOENT(rs)) { rs = APR_SUCCESS; break; } } apr_dir_close(dir); } if (rs != 0 && !APR_STATUS_IS_ENOENT(rs)) result(make_tuple2(A_ERROR, decipher_status(rs), proc_gc_pool(ctx))); else result(make_tuple2(A_OK, r, proc_gc_pool(ctx))); apr_pool_destroy(p); return AI_OK; }
static int file_stat(lua_State *L) { lua_apr_stat_context context = { 0 }; lua_apr_file *file; apr_status_t status; file = file_check(L, 1, 1); context.firstarg = 2; context.lastarg = lua_gettop(L); check_stat_request(L, &context); status = apr_file_info_get(&context.info, context.wanted, file->handle); if (status != APR_SUCCESS && !APR_STATUS_IS_INCOMPLETE(status)) return push_file_error(L, file, status); return push_stat_results(L, &context, NULL); }
term_t bif_list_dir3_0_1(term_t Dir, process_t *ctx) { apr_status_t rs; apr_pool_t *p; const char *path; apr_dir_t *dir; term_t r = nil; term_t cons = nil; apr_uint32_t wanted = APR_FINFO_MTIME | APR_FINFO_CTIME | APR_FINFO_ATIME | APR_FINFO_NAME | APR_FINFO_SIZE | APR_FINFO_TYPE | APR_FINFO_USER | APR_FINFO_GROUP | APR_FINFO_PROT; if (!is_string(Dir)) return A_BADARG; apr_pool_create(&p, 0); path = ltoz(Dir, p); rs = apr_dir_open(&dir, path, p); if (rs == 0) { apr_finfo_t fi; for (;;) { rs = apr_dir_read(&fi, wanted, dir); if (rs == 0 || APR_STATUS_IS_INCOMPLETE(rs)) { term_t file_info = make_file_info(&fi, proc_gc_pool(ctx)); lst_add(r, cons, file_info, proc_gc_pool(ctx)); } else if (APR_STATUS_IS_ENOENT(rs)) { rs = 0; break; } } apr_dir_close(dir); } if (rs != 0) result(make_tuple2(A_ERROR, decipher_status(rs), proc_gc_pool(ctx))); else result(make_tuple2(A_OK, r, proc_gc_pool(ctx))); apr_pool_destroy(p); return AI_OK; }
static void test_mtime_set(abts_case *tc, void *data) { apr_file_t *thefile; apr_finfo_t finfo; apr_time_t epoch = 0; apr_status_t rv; /* This test sort of depends on the system clock being at least * marginally ccorrect; We'll be setting the modification time to * the epoch. */ rv = apr_file_open(&thefile, NEWFILENAME, APR_READ | APR_WRITE | APR_CREATE | APR_TRUNCATE | APR_BUFFERED | APR_DELONCLOSE, APR_OS_DEFAULT, p); APR_ASSERT_SUCCESS(tc, "open file", rv); /* Check that the current mtime is not the epoch */ rv = apr_stat(&finfo, NEWFILENAME, APR_FINFO_MTIME, p); if (APR_STATUS_IS_INCOMPLETE(rv)) { char *str; int i; str = apr_pstrdup(p, "APR_INCOMPLETE: Missing "); for (i = 0; vfi[i].bits; ++i) { if (vfi[i].bits & ~finfo.valid) { str = apr_pstrcat(p, str, vfi[i].description, " ", NULL); } } ABTS_FAIL(tc, str); } APR_ASSERT_SUCCESS(tc, "get initial mtime", rv); ABTS_TRUE(tc, finfo.mtime != epoch); /* Reset the mtime to the epoch and verify the result. * Note: we blindly assume that if the first apr_stat succeeded, * the second one will, too. */ rv = apr_file_mtime_set(NEWFILENAME, epoch, p); APR_ASSERT_SUCCESS(tc, "set mtime", rv); rv = apr_stat(&finfo, NEWFILENAME, APR_FINFO_MTIME, p); APR_ASSERT_SUCCESS(tc, "get modified mtime", rv); ABTS_TRUE(tc, finfo.mtime == epoch); apr_file_close(thefile); }
static void test_stat(abts_case *tc, void *data) { apr_finfo_t finfo; apr_status_t rv; rv = apr_stat(&finfo, FILENAME, APR_FINFO_NORM, p); if (APR_STATUS_IS_INCOMPLETE(rv)) { char *str; int i; str = apr_pstrdup(p, "APR_INCOMPLETE: Missing "); for (i = 0; vfi[i].bits; ++i) { if (vfi[i].bits & ~finfo.valid) { str = apr_pstrcat(p, str, vfi[i].description, " ", NULL); } } ABTS_FAIL(tc, str); } ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); }
static int add_ldap_certs(abts_case *tc) { apr_status_t status; apr_dir_t *thedir; apr_finfo_t dirent; apr_ldap_err_t *result = NULL; if ((status = apr_dir_open(&thedir, DIRNAME, p)) == APR_SUCCESS) { apr_ldap_opt_tls_cert_t *cert = (apr_ldap_opt_tls_cert_t *)apr_pcalloc(p, sizeof(apr_ldap_opt_tls_cert_t)); do { status = apr_dir_read(&dirent, APR_FINFO_MIN | APR_FINFO_NAME, thedir); if (APR_STATUS_IS_INCOMPLETE(status)) { continue; /* ignore un-stat()able files */ } else if (status != APR_SUCCESS) { break; } if (strstr(dirent.name, ".der")) { cert->type = APR_LDAP_CA_TYPE_DER; cert->path = apr_pstrcat (p, DIRNAME, "/", dirent.name, NULL); apr_ldap_set_option(p, NULL, APR_LDAP_OPT_TLS_CERT, (void *)cert, &result); ABTS_TRUE(tc, result->rc == LDAP_SUCCESS); } if (strstr(dirent.name, ".b64")) { cert->type = APR_LDAP_CA_TYPE_BASE64; cert->path = apr_pstrcat (p, DIRNAME, "/", dirent.name, NULL); apr_ldap_set_option(p, NULL, APR_LDAP_OPT_TLS_CERT, (void *)cert, &result); ABTS_TRUE(tc, result->rc == LDAP_SUCCESS); } } while (1); apr_dir_close(thedir); } return 0; }
static int dir_read(lua_State *L) { apr_status_t status; lua_apr_dir *directory; lua_apr_stat_context *context, backup_ctx; int raise_errors; directory = checkdir(L, 1, 1); if (lua_isuserdata(L, lua_upvalueindex(1))) { /* Iterator for directory:entries() */ context = lua_touserdata(L, lua_upvalueindex(1)); raise_errors = 1; } else { /* Standalone call to directory:read() */ backup_ctx.firstarg = 2; backup_ctx.lastarg = lua_gettop(L); check_stat_request(L, &backup_ctx); context = &backup_ctx; raise_errors = 0; } for (;;) { status = apr_dir_read(&context->info, context->wanted, directory->handle); if (APR_SUCCESS == status || APR_STATUS_IS_INCOMPLETE(status)) { if (!(context->info.valid & APR_FINFO_NAME \ && filename_symbolic(context->info.name))) return push_stat_results(L, context, directory->filepath); } else if (APR_STATUS_IS_ENOENT(status)) { return 0; } else if (raise_errors) { return raise_error_status(L, status); } else { return push_error_status(L, status); } } }
static int mediarss_index_directory(request_rec* r) { apr_status_t status; apr_dir_t* dir; apr_finfo_t dirent; if ((status = apr_dir_open(&dir, r->filename, r->pool)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, "Can't open directory for index: %s", r->filename); return HTTP_FORBIDDEN; } /* Content header */ char* url; url = ap_construct_url(r->pool, r->uri, r); ap_set_content_type(r, "text/xml; charset=utf-8"); ap_rputs("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n\n", r); if (strcmp(r->args, "format=mediarss") == 0) { ap_rputs("<rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss/\">\n", r); } else { ap_rputs("<rss version=\"2.0\">\n", r); } ap_rputs(" <channel>\n", r); ap_rvputs(r, " <title>Index of ", url, "</title>\n", NULL); ap_rvputs(r, " <link>", url, "</link>\n", NULL); /* Collect information about the files in the directory */ while (1) { status = apr_dir_read(&dirent, APR_FINFO_MIN | APR_FINFO_NAME, dir); if (APR_STATUS_IS_INCOMPLETE(status)) { continue; /* ignore un-stat()able files */ } else if (status != APR_SUCCESS) { break; } /* We are only interested in regular files. TODO Deal with symlinks. */ if (dirent.filetype == APR_REG) { request_rec* rr; rr = ap_sub_req_lookup_dirent(&dirent, r, AP_SUBREQ_NO_ARGS, NULL); if (rr != NULL) { if (rr->finfo.filetype == APR_REG && rr->status == HTTP_OK) { /* In case of media rss, only include the item if it is a media type */ if (strcmp(r->args, "format=mediarss") == 0 && mediarss_is_media_content(rr->content_type) == 0) { continue; } char size[16]; snprintf(size, sizeof(size), "%d", dirent.size); char date[APR_RFC822_DATE_LEN]; apr_rfc822_date(date, dirent.mtime); char* guid = ap_md5(r->pool, (unsigned char*) apr_pstrcat(r->pool, url, dirent.name, NULL)); ap_rputs(" <item>\n", r); ap_rvputs(r, " <guid>", guid, "</guid>\n", NULL); ap_rvputs(r, " <title>", dirent.name, "</title>\n", NULL); ap_rvputs(r, " <pubDate>", date, "</pubDate>\n", NULL); ap_rvputs(r, " <enclosure url=\"", url, dirent.name, "\" length=\"", size, "\"\n", NULL); ap_rvputs(r, " type=\"", rr->content_type, "\"/>\n", NULL); if (strcmp(r->args, "format=mediarss") == 0) { ap_rvputs(r, " <media:content url=\"", url, dirent.name, "\" fileSize=\"", size, "\"\n", NULL); ap_rvputs(r, " type=\"", rr->content_type, "\"/>\n", NULL); } ap_rputs(" </item>\n", r); } ap_destroy_sub_req(rr); } } } /* Content footer */ ap_rputs(" </channel>\n", r); ap_rputs("</rss>\n", r); apr_dir_close(dir); return OK; }
void status_to_name(lua_State *L, apr_status_t status) { /* Use a switch statement for fast number to string mapping: */ switch (status) { # ifdef APR_ANONYMOUS case APR_ANONYMOUS: lua_pushliteral(L, "ANONYMOUS"); return; # endif # ifdef APR_BADARG case APR_BADARG: lua_pushliteral(L, "BADARG"); return; # endif # ifdef APR_BADCH case APR_BADCH: lua_pushliteral(L, "BADCH"); return; # endif # ifdef APR_DETACH case APR_DETACH: lua_pushliteral(L, "DETACH"); return; # endif # ifdef APR_EABOVEROOT case APR_EABOVEROOT: lua_pushliteral(L, "EABOVEROOT"); return; # endif # ifdef APR_EABSOLUTE case APR_EABSOLUTE: lua_pushliteral(L, "EABSOLUTE"); return; # endif # ifdef APR_EACCES case APR_EACCES: lua_pushliteral(L, "EACCES"); return; # endif # ifdef APR_EAFNOSUPPORT case APR_EAFNOSUPPORT: lua_pushliteral(L, "EAFNOSUPPORT"); return; # endif # ifdef APR_EAGAIN case APR_EAGAIN: lua_pushliteral(L, "EAGAIN"); return; # endif # ifdef APR_EBADDATE case APR_EBADDATE: lua_pushliteral(L, "EBADDATE"); return; # endif # ifdef APR_EBADF case APR_EBADF: lua_pushliteral(L, "EBADF"); return; # endif # ifdef APR_EBADIP case APR_EBADIP: lua_pushliteral(L, "EBADIP"); return; # endif # ifdef APR_EBADMASK case APR_EBADMASK: lua_pushliteral(L, "EBADMASK"); return; # endif # ifdef APR_EBADPATH case APR_EBADPATH: lua_pushliteral(L, "EBADPATH"); return; # endif # ifdef APR_EBUSY case APR_EBUSY: lua_pushliteral(L, "EBUSY"); return; # endif # ifdef APR_ECONNABORTED case APR_ECONNABORTED: lua_pushliteral(L, "ECONNABORTED"); return; # endif # ifdef APR_ECONNREFUSED case APR_ECONNREFUSED: lua_pushliteral(L, "ECONNREFUSED"); return; # endif # ifdef APR_ECONNRESET case APR_ECONNRESET: lua_pushliteral(L, "ECONNRESET"); return; # endif # ifdef APR_EDSOOPEN case APR_EDSOOPEN: lua_pushliteral(L, "EDSOOPEN"); return; # endif # ifdef APR_EEXIST case APR_EEXIST: lua_pushliteral(L, "EEXIST"); return; # endif # ifdef APR_EFTYPE case APR_EFTYPE: lua_pushliteral(L, "EFTYPE"); return; # endif # ifdef APR_EGENERAL case APR_EGENERAL: lua_pushliteral(L, "EGENERAL"); return; # endif # ifdef APR_EHOSTUNREACH case APR_EHOSTUNREACH: lua_pushliteral(L, "EHOSTUNREACH"); return; # endif # ifdef APR_EINCOMPLETE case APR_EINCOMPLETE: lua_pushliteral(L, "EINCOMPLETE"); return; # endif # ifdef APR_EINIT case APR_EINIT: lua_pushliteral(L, "EINIT"); return; # endif # ifdef APR_EINPROGRESS case APR_EINPROGRESS: lua_pushliteral(L, "EINPROGRESS"); return; # endif # ifdef APR_EINTR case APR_EINTR: lua_pushliteral(L, "EINTR"); return; # endif # ifdef APR_EINVAL case APR_EINVAL: lua_pushliteral(L, "EINVAL"); return; # endif # ifdef APR_EINVALSOCK case APR_EINVALSOCK: lua_pushliteral(L, "EINVALSOCK"); return; # endif # ifdef APR_EMFILE case APR_EMFILE: lua_pushliteral(L, "EMFILE"); return; # endif # ifdef APR_EMISMATCH case APR_EMISMATCH: lua_pushliteral(L, "EMISMATCH"); return; # endif # ifdef APR_ENAMETOOLONG case APR_ENAMETOOLONG: lua_pushliteral(L, "ENAMETOOLONG"); return; # endif # ifdef APR_ENETUNREACH case APR_ENETUNREACH: lua_pushliteral(L, "ENETUNREACH"); return; # endif # ifdef APR_ENFILE case APR_ENFILE: lua_pushliteral(L, "ENFILE"); return; # endif # ifdef APR_ENODIR case APR_ENODIR: lua_pushliteral(L, "ENODIR"); return; # endif # ifdef APR_ENOENT case APR_ENOENT: lua_pushliteral(L, "ENOENT"); return; # endif # ifdef APR_ENOLOCK case APR_ENOLOCK: lua_pushliteral(L, "ENOLOCK"); return; # endif # ifdef APR_ENOMEM case APR_ENOMEM: lua_pushliteral(L, "ENOMEM"); return; # endif # ifdef APR_ENOPOLL case APR_ENOPOLL: lua_pushliteral(L, "ENOPOLL"); return; # endif # ifdef APR_ENOPOOL case APR_ENOPOOL: lua_pushliteral(L, "ENOPOOL"); return; # endif # ifdef APR_ENOPROC case APR_ENOPROC: lua_pushliteral(L, "ENOPROC"); return; # endif # ifdef APR_ENOSHMAVAIL case APR_ENOSHMAVAIL: lua_pushliteral(L, "ENOSHMAVAIL"); return; # endif # ifdef APR_ENOSOCKET case APR_ENOSOCKET: lua_pushliteral(L, "ENOSOCKET"); return; # endif # ifdef APR_ENOSPC case APR_ENOSPC: lua_pushliteral(L, "ENOSPC"); return; # endif # ifdef APR_ENOSTAT case APR_ENOSTAT: lua_pushliteral(L, "ENOSTAT"); return; # endif # ifdef APR_ENOTDIR case APR_ENOTDIR: lua_pushliteral(L, "ENOTDIR"); return; # endif # ifdef APR_ENOTEMPTY case APR_ENOTEMPTY: lua_pushliteral(L, "ENOTEMPTY"); return; # endif # ifdef APR_ENOTENOUGHENTROPY case APR_ENOTENOUGHENTROPY: lua_pushliteral(L, "ENOTENOUGHENTROPY"); return; # endif # ifdef APR_ENOTHDKEY case APR_ENOTHDKEY: lua_pushliteral(L, "ENOTHDKEY"); return; # endif # ifdef APR_ENOTHREAD case APR_ENOTHREAD: lua_pushliteral(L, "ENOTHREAD"); return; # endif # ifdef APR_ENOTIME case APR_ENOTIME: lua_pushliteral(L, "ENOTIME"); return; # endif # ifdef APR_ENOTIMPL case APR_ENOTIMPL: lua_pushliteral(L, "ENOTIMPL"); return; # endif # ifdef APR_ENOTSOCK case APR_ENOTSOCK: lua_pushliteral(L, "ENOTSOCK"); return; # endif # ifdef APR_EOF case APR_EOF: lua_pushliteral(L, "EOF"); return; # endif # ifdef APR_EPATHWILD case APR_EPATHWILD: lua_pushliteral(L, "EPATHWILD"); return; # endif # ifdef APR_EPIPE case APR_EPIPE: lua_pushliteral(L, "EPIPE"); return; # endif # ifdef APR_EPROC_UNKNOWN case APR_EPROC_UNKNOWN: lua_pushliteral(L, "EPROC_UNKNOWN"); return; # endif # ifdef APR_ERELATIVE case APR_ERELATIVE: lua_pushliteral(L, "ERELATIVE"); return; # endif # ifdef APR_ESPIPE case APR_ESPIPE: lua_pushliteral(L, "ESPIPE"); return; # endif # ifdef APR_ESYMNOTFOUND case APR_ESYMNOTFOUND: lua_pushliteral(L, "ESYMNOTFOUND"); return; # endif # ifdef APR_ETIMEDOUT case APR_ETIMEDOUT: lua_pushliteral(L, "ETIMEDOUT"); return; # endif # ifdef APR_EXDEV case APR_EXDEV: lua_pushliteral(L, "EXDEV"); return; # endif # ifdef APR_FILEBASED case APR_FILEBASED: lua_pushliteral(L, "FILEBASED"); return; # endif # ifdef APR_INCHILD case APR_INCHILD: lua_pushliteral(L, "INCHILD"); return; # endif # ifdef APR_INCOMPLETE case APR_INCOMPLETE: lua_pushliteral(L, "INCOMPLETE"); return; # endif # ifdef APR_INPARENT case APR_INPARENT: lua_pushliteral(L, "INPARENT"); return; # endif # ifdef APR_KEYBASED case APR_KEYBASED: lua_pushliteral(L, "KEYBASED"); return; # endif # ifdef APR_NOTDETACH case APR_NOTDETACH: lua_pushliteral(L, "NOTDETACH"); return; # endif # ifdef APR_NOTFOUND case APR_NOTFOUND: lua_pushliteral(L, "NOTFOUND"); return; # endif # ifdef APR_SUCCESS case APR_SUCCESS: lua_pushliteral(L, "SUCCESS"); return; # endif # ifdef APR_TIMEUP case APR_TIMEUP: lua_pushliteral(L, "TIMEUP"); return; # endif } /* If the switch statement fails we fall back to the following monstrosity :-) */ if (0) ; # ifdef APR_STATUS_IS_ANONYMOUS else if (APR_STATUS_IS_ANONYMOUS(status)) { lua_pushliteral(L, "ANONYMOUS"); return; } # endif # ifdef APR_STATUS_IS_BADARG else if (APR_STATUS_IS_BADARG(status)) { lua_pushliteral(L, "BADARG"); return; } # endif # ifdef APR_STATUS_IS_BADCH else if (APR_STATUS_IS_BADCH(status)) { lua_pushliteral(L, "BADCH"); return; } # endif # ifdef APR_STATUS_IS_DETACH else if (APR_STATUS_IS_DETACH(status)) { lua_pushliteral(L, "DETACH"); return; } # endif # ifdef APR_STATUS_IS_EABOVEROOT else if (APR_STATUS_IS_EABOVEROOT(status)) { lua_pushliteral(L, "EABOVEROOT"); return; } # endif # ifdef APR_STATUS_IS_EABSOLUTE else if (APR_STATUS_IS_EABSOLUTE(status)) { lua_pushliteral(L, "EABSOLUTE"); return; } # endif # ifdef APR_STATUS_IS_EACCES else if (APR_STATUS_IS_EACCES(status)) { lua_pushliteral(L, "EACCES"); return; } # endif # ifdef APR_STATUS_IS_EAFNOSUPPORT else if (APR_STATUS_IS_EAFNOSUPPORT(status)) { lua_pushliteral(L, "EAFNOSUPPORT"); return; } # endif # ifdef APR_STATUS_IS_EAGAIN else if (APR_STATUS_IS_EAGAIN(status)) { lua_pushliteral(L, "EAGAIN"); return; } # endif # ifdef APR_STATUS_IS_EBADDATE else if (APR_STATUS_IS_EBADDATE(status)) { lua_pushliteral(L, "EBADDATE"); return; } # endif # ifdef APR_STATUS_IS_EBADF else if (APR_STATUS_IS_EBADF(status)) { lua_pushliteral(L, "EBADF"); return; } # endif # ifdef APR_STATUS_IS_EBADIP else if (APR_STATUS_IS_EBADIP(status)) { lua_pushliteral(L, "EBADIP"); return; } # endif # ifdef APR_STATUS_IS_EBADMASK else if (APR_STATUS_IS_EBADMASK(status)) { lua_pushliteral(L, "EBADMASK"); return; } # endif # ifdef APR_STATUS_IS_EBADPATH else if (APR_STATUS_IS_EBADPATH(status)) { lua_pushliteral(L, "EBADPATH"); return; } # endif # ifdef APR_STATUS_IS_EBUSY else if (APR_STATUS_IS_EBUSY(status)) { lua_pushliteral(L, "EBUSY"); return; } # endif # ifdef APR_STATUS_IS_ECONNABORTED else if (APR_STATUS_IS_ECONNABORTED(status)) { lua_pushliteral(L, "ECONNABORTED"); return; } # endif # ifdef APR_STATUS_IS_ECONNREFUSED else if (APR_STATUS_IS_ECONNREFUSED(status)) { lua_pushliteral(L, "ECONNREFUSED"); return; } # endif # ifdef APR_STATUS_IS_ECONNRESET else if (APR_STATUS_IS_ECONNRESET(status)) { lua_pushliteral(L, "ECONNRESET"); return; } # endif # ifdef APR_STATUS_IS_EDSOOPEN else if (APR_STATUS_IS_EDSOOPEN(status)) { lua_pushliteral(L, "EDSOOPEN"); return; } # endif # ifdef APR_STATUS_IS_EEXIST else if (APR_STATUS_IS_EEXIST(status)) { lua_pushliteral(L, "EEXIST"); return; } # endif # ifdef APR_STATUS_IS_EFTYPE else if (APR_STATUS_IS_EFTYPE(status)) { lua_pushliteral(L, "EFTYPE"); return; } # endif # ifdef APR_STATUS_IS_EGENERAL else if (APR_STATUS_IS_EGENERAL(status)) { lua_pushliteral(L, "EGENERAL"); return; } # endif # ifdef APR_STATUS_IS_EHOSTUNREACH else if (APR_STATUS_IS_EHOSTUNREACH(status)) { lua_pushliteral(L, "EHOSTUNREACH"); return; } # endif # ifdef APR_STATUS_IS_EINCOMPLETE else if (APR_STATUS_IS_EINCOMPLETE(status)) { lua_pushliteral(L, "EINCOMPLETE"); return; } # endif # ifdef APR_STATUS_IS_EINIT else if (APR_STATUS_IS_EINIT(status)) { lua_pushliteral(L, "EINIT"); return; } # endif # ifdef APR_STATUS_IS_EINPROGRESS else if (APR_STATUS_IS_EINPROGRESS(status)) { lua_pushliteral(L, "EINPROGRESS"); return; } # endif # ifdef APR_STATUS_IS_EINTR else if (APR_STATUS_IS_EINTR(status)) { lua_pushliteral(L, "EINTR"); return; } # endif # ifdef APR_STATUS_IS_EINVAL else if (APR_STATUS_IS_EINVAL(status)) { lua_pushliteral(L, "EINVAL"); return; } # endif # ifdef APR_STATUS_IS_EINVALSOCK else if (APR_STATUS_IS_EINVALSOCK(status)) { lua_pushliteral(L, "EINVALSOCK"); return; } # endif # ifdef APR_STATUS_IS_EMFILE else if (APR_STATUS_IS_EMFILE(status)) { lua_pushliteral(L, "EMFILE"); return; } # endif # ifdef APR_STATUS_IS_EMISMATCH else if (APR_STATUS_IS_EMISMATCH(status)) { lua_pushliteral(L, "EMISMATCH"); return; } # endif # ifdef APR_STATUS_IS_ENAMETOOLONG else if (APR_STATUS_IS_ENAMETOOLONG(status)) { lua_pushliteral(L, "ENAMETOOLONG"); return; } # endif # ifdef APR_STATUS_IS_ENETUNREACH else if (APR_STATUS_IS_ENETUNREACH(status)) { lua_pushliteral(L, "ENETUNREACH"); return; } # endif # ifdef APR_STATUS_IS_ENFILE else if (APR_STATUS_IS_ENFILE(status)) { lua_pushliteral(L, "ENFILE"); return; } # endif # ifdef APR_STATUS_IS_ENODIR else if (APR_STATUS_IS_ENODIR(status)) { lua_pushliteral(L, "ENODIR"); return; } # endif # ifdef APR_STATUS_IS_ENOENT else if (APR_STATUS_IS_ENOENT(status)) { lua_pushliteral(L, "ENOENT"); return; } # endif # ifdef APR_STATUS_IS_ENOLOCK else if (APR_STATUS_IS_ENOLOCK(status)) { lua_pushliteral(L, "ENOLOCK"); return; } # endif # ifdef APR_STATUS_IS_ENOMEM else if (APR_STATUS_IS_ENOMEM(status)) { lua_pushliteral(L, "ENOMEM"); return; } # endif # ifdef APR_STATUS_IS_ENOPOLL else if (APR_STATUS_IS_ENOPOLL(status)) { lua_pushliteral(L, "ENOPOLL"); return; } # endif # ifdef APR_STATUS_IS_ENOPOOL else if (APR_STATUS_IS_ENOPOOL(status)) { lua_pushliteral(L, "ENOPOOL"); return; } # endif # ifdef APR_STATUS_IS_ENOPROC else if (APR_STATUS_IS_ENOPROC(status)) { lua_pushliteral(L, "ENOPROC"); return; } # endif # ifdef APR_STATUS_IS_ENOSHMAVAIL else if (APR_STATUS_IS_ENOSHMAVAIL(status)) { lua_pushliteral(L, "ENOSHMAVAIL"); return; } # endif # ifdef APR_STATUS_IS_ENOSOCKET else if (APR_STATUS_IS_ENOSOCKET(status)) { lua_pushliteral(L, "ENOSOCKET"); return; } # endif # ifdef APR_STATUS_IS_ENOSPC else if (APR_STATUS_IS_ENOSPC(status)) { lua_pushliteral(L, "ENOSPC"); return; } # endif # ifdef APR_STATUS_IS_ENOSTAT else if (APR_STATUS_IS_ENOSTAT(status)) { lua_pushliteral(L, "ENOSTAT"); return; } # endif # ifdef APR_STATUS_IS_ENOTDIR else if (APR_STATUS_IS_ENOTDIR(status)) { lua_pushliteral(L, "ENOTDIR"); return; } # endif # ifdef APR_STATUS_IS_ENOTEMPTY else if (APR_STATUS_IS_ENOTEMPTY(status)) { lua_pushliteral(L, "ENOTEMPTY"); return; } # endif # ifdef APR_STATUS_IS_ENOTENOUGHENTROPY else if (APR_STATUS_IS_ENOTENOUGHENTROPY(status)) { lua_pushliteral(L, "ENOTENOUGHENTROPY"); return; } # endif # ifdef APR_STATUS_IS_ENOTHDKEY else if (APR_STATUS_IS_ENOTHDKEY(status)) { lua_pushliteral(L, "ENOTHDKEY"); return; } # endif # ifdef APR_STATUS_IS_ENOTHREAD else if (APR_STATUS_IS_ENOTHREAD(status)) { lua_pushliteral(L, "ENOTHREAD"); return; } # endif # ifdef APR_STATUS_IS_ENOTIME else if (APR_STATUS_IS_ENOTIME(status)) { lua_pushliteral(L, "ENOTIME"); return; } # endif # ifdef APR_STATUS_IS_ENOTIMPL else if (APR_STATUS_IS_ENOTIMPL(status)) { lua_pushliteral(L, "ENOTIMPL"); return; } # endif # ifdef APR_STATUS_IS_ENOTSOCK else if (APR_STATUS_IS_ENOTSOCK(status)) { lua_pushliteral(L, "ENOTSOCK"); return; } # endif # ifdef APR_STATUS_IS_EOF else if (APR_STATUS_IS_EOF(status)) { lua_pushliteral(L, "EOF"); return; } # endif # ifdef APR_STATUS_IS_EPATHWILD else if (APR_STATUS_IS_EPATHWILD(status)) { lua_pushliteral(L, "EPATHWILD"); return; } # endif # ifdef APR_STATUS_IS_EPIPE else if (APR_STATUS_IS_EPIPE(status)) { lua_pushliteral(L, "EPIPE"); return; } # endif # ifdef APR_STATUS_IS_EPROC_UNKNOWN else if (APR_STATUS_IS_EPROC_UNKNOWN(status)) { lua_pushliteral(L, "EPROC_UNKNOWN"); return; } # endif # ifdef APR_STATUS_IS_ERELATIVE else if (APR_STATUS_IS_ERELATIVE(status)) { lua_pushliteral(L, "ERELATIVE"); return; } # endif # ifdef APR_STATUS_IS_ESPIPE else if (APR_STATUS_IS_ESPIPE(status)) { lua_pushliteral(L, "ESPIPE"); return; } # endif # ifdef APR_STATUS_IS_ESYMNOTFOUND else if (APR_STATUS_IS_ESYMNOTFOUND(status)) { lua_pushliteral(L, "ESYMNOTFOUND"); return; } # endif # ifdef APR_STATUS_IS_ETIMEDOUT else if (APR_STATUS_IS_ETIMEDOUT(status)) { lua_pushliteral(L, "ETIMEDOUT"); return; } # endif # ifdef APR_STATUS_IS_EXDEV else if (APR_STATUS_IS_EXDEV(status)) { lua_pushliteral(L, "EXDEV"); return; } # endif # ifdef APR_STATUS_IS_FILEBASED else if (APR_STATUS_IS_FILEBASED(status)) { lua_pushliteral(L, "FILEBASED"); return; } # endif # ifdef APR_STATUS_IS_INCHILD else if (APR_STATUS_IS_INCHILD(status)) { lua_pushliteral(L, "INCHILD"); return; } # endif # ifdef APR_STATUS_IS_INCOMPLETE else if (APR_STATUS_IS_INCOMPLETE(status)) { lua_pushliteral(L, "INCOMPLETE"); return; } # endif # ifdef APR_STATUS_IS_INPARENT else if (APR_STATUS_IS_INPARENT(status)) { lua_pushliteral(L, "INPARENT"); return; } # endif # ifdef APR_STATUS_IS_KEYBASED else if (APR_STATUS_IS_KEYBASED(status)) { lua_pushliteral(L, "KEYBASED"); return; } # endif # ifdef APR_STATUS_IS_NOTDETACH else if (APR_STATUS_IS_NOTDETACH(status)) { lua_pushliteral(L, "NOTDETACH"); return; } # endif # ifdef APR_STATUS_IS_NOTFOUND else if (APR_STATUS_IS_NOTFOUND(status)) { lua_pushliteral(L, "NOTFOUND"); return; } # endif # ifdef APR_STATUS_IS_TIMEUP else if (APR_STATUS_IS_TIMEUP(status)) { lua_pushliteral(L, "TIMEUP"); return; } # endif lua_pushinteger(L, status); }