#include "HTUtils.h" #include "tcp.h" #include "HTAccess.h" #include "HTList.h" #include "HTAlert.h" #include "LYCurses.h" #include "GridText.h" #include "LYUtils.h" #include "LYPrint.h" #include "LYGlobalDefs.h" #include "LYSignal.h" #include "LYStrings.h" #include "LYClean.h" #include "LYGetFile.h" #include "LYHistory.h" #include "LYSystem.h" #include "LYList.h" #ifdef VMS #include "HTVMSUtils.h" #endif /* VMS */ #include "LYLeaks.h" #define FREE(x) if (x) {free(x); x = NULL;} /* * printfile prints out the current file minus the links and targets * to a veriaty of places */ /* it parses an incoming link that looks like * * LYNXPRINT://LOCAL_FILE/lines=## * LYNXPRINT://MAIL_FILE/lines=## * LYNXPRINT://TO_SCREEN/lines=## * LYNXPRINT://PRINTER/lines=##/number=# */ #define TO_FILE 1 #define TO_SCREEN 2 #define MAIL 3 #define PRINTER 4 #ifdef VMS PRIVATE int remove_quotes PARAMS((char *string)); #endif /* VMS */ PUBLIC int printfile ARGS1(document *,newdoc) { static char tempfile[256]; static BOOLEAN first = TRUE; char buffer[LINESIZE]; char filename[LINESIZE]; char user_response[256]; int lines_in_file = 0; int printer_number = 0; int pages = 0; int type = 0, c, len; FILE *outfile_fp; char *cp; lynx_printer_item_type *cur_printer; char *sug_filename = NULL; char *link_info = NULL; DocAddress WWWDoc; int pagelen = 0; int ch, recall; int FnameTotal; int FnameNum; BOOLEAN FirstRecall = TRUE; #ifdef VMS extern BOOLEAN HadVMSInterrupt; #endif /* VMS */ /* * Extract useful info from URL. */ StrAllocCopy(link_info, newdoc->address+12); /* * Reload the file we want to print into memory. */ LYpop(newdoc); WWWDoc.address = newdoc->address; WWWDoc.post_data = newdoc->post_data; WWWDoc.post_content_type = newdoc->post_content_type; WWWDoc.bookmark = newdoc->bookmark; WWWDoc.isHEAD = newdoc->isHEAD; if(!HTLoadAbsolute(&WWWDoc)) return(NOT_FOUND); /* * Load the suggested filename string. - FM */ if (HText_getSugFname() != NULL) StrAllocCopy(sug_filename, HText_getSugFname()); /* must be freed */ else StrAllocCopy(sug_filename, newdoc->address); /* must be freed */ /* * Get the number of lines in the file. */ if ((cp = (char *)strstr(link_info, "lines=")) != NULL) { /* * Terminate prev string here. */ *cp = '\0'; /* * Number of characters in "lines=". */ cp += 6; lines_in_file = atoi(cp); pages = lines_in_file/66; } /* * Determine the type. */ if (strstr(link_info, "LOCAL_FILE")) { type = TO_FILE; } else if (strstr(link_info, "TO_SCREEN")) { type = TO_SCREEN; } else if (strstr(link_info, "MAIL_FILE")) { type = MAIL; } else if (strstr(link_info, "PRINTER")) { type = PRINTER; if ((cp = (char *)strstr(link_info, "number=")) != NULL) { /* number of characters in "number=" */ cp += 7; printer_number = atoi(cp); } if ((cp = (char *)strstr(link_info, "pagelen=")) != NULL) { /* number of characters in "pagelen=" */ cp += 8; pagelen = atoi(cp); } else { /* default to 66 lines */ pagelen = 66; } } /* * Set up the sug_filenames recall buffer. */ FnameTotal = (sug_filenames ? HTList_count(sug_filenames) : 0); recall = ((FnameTotal >= 1) ? RECALL : NORECALL); FnameNum = FnameTotal; switch (type) { case TO_FILE: _statusline(FILENAME_PROMPT); retry: strcpy(filename, sug_filename); /* add suggestion info */ /* make the sug_filename conform to system specs */ change_sug_filename(filename); if (!(HTisDocumentSource()) && (len = strlen(filename)) > 4) { len -= 5; if (!strcasecomp((filename + len), ".html")) { filename[len] = '\0'; strcat(filename, ".txt"); } } if (lynx_save_space && *lynx_save_space) {
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: jubalh
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with a single custom sponsorship URL