aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-12-24 11:32:00 -0500
committerThomas E. Dickey <dickey@invisible-island.net>1998-12-24 11:32:00 -0500
commit152e034b54f203f5b53ef44a70c57834b7b66137 (patch)
tree8f16b876c14eb3c3a1400fd4f91948baa752efd7 /src
parent10f6c5df5fbd3e8a2be8a0640035680235b3f8a3 (diff)
downloadlynx-snapshots-152e034b54f203f5b53ef44a70c57834b7b66137.tar.gz
snapshot of project "lynx", label v2-8-2dev_11
Diffstat (limited to 'src')
-rw-r--r--src/HTAlert.c14
-rw-r--r--src/HTFWriter.c4
-rw-r--r--src/HTInit.c2
-rw-r--r--src/LYCookie.c27
-rw-r--r--src/LYGetFile.c4
-rw-r--r--src/LYHistory.c10
-rw-r--r--src/LYJump.c8
-rw-r--r--src/LYKeymap.h15
-rw-r--r--src/LYLocal.c253
-rw-r--r--src/LYMainLoop.c66
-rw-r--r--src/LYShowInfo.c2
-rw-r--r--src/LYStrings.c2
-rw-r--r--src/LYUpload.c2
-rw-r--r--src/LYUtils.c29
14 files changed, 159 insertions, 279 deletions
diff --git a/src/HTAlert.c b/src/HTAlert.c
index 86b24721..7b44d086 100644
--- a/src/HTAlert.c
+++ b/src/HTAlert.c
@@ -96,18 +96,20 @@ PUBLIC void HTReadProgress ARGS2(
static long kb_units = 1024;
static time_t first, last;
static long bytes_last;
- long transfer_rate, divisor;
+ static long transfer_rate = 0;
+ long divisor;
char line[80];
time_t now = time((time_t *)0); /* once per second */
- char *units = "bytes";
+ static char *units = "bytes";
if (bytes == 0) {
first = last = now;
bytes_last = bytes;
} else if ((bytes > 0) &&
(now != first))
- /* 1 sec delay for transfer_rate calculation :-( */ {
- transfer_rate = (bytes) / (now - first); /* bytes/sec */
+ /* 1 sec delay for transfer_rate calculation :-( */ {
+ if (transfer_rate <= 0) /* the very first time */
+ transfer_rate = (bytes) / (now - first); /* bytes/sec */
/* optimal refresh time: every 0.2 sec */
if ((bytes - bytes_last) > (transfer_rate / 5)) {
@@ -117,7 +119,9 @@ PUBLIC void HTReadProgress ARGS2(
if (now != last) {
last = now;
bytes_last = bytes;
+ transfer_rate = (bytes_last) / (last - first); /* more accurate here */
}
+
units = gettext("bytes");
divisor = 1;
if (LYshow_kb_rate
@@ -449,7 +453,7 @@ PUBLIC BOOL HTConfirmCookie ARGS4(
return FALSE;
}
space_free = (((LYcols - 1)
- - strlen(ADVANCED_COOKIE_CONFIRMATION))
+ - strlen(ADVANCED_COOKIE_CONFIRMATION))
- strlen(server));
if (space_free < 0)
space_free = 0;
diff --git a/src/HTFWriter.c b/src/HTFWriter.c
index 73980117..c1f82ef1 100644
--- a/src/HTFWriter.c
+++ b/src/HTFWriter.c
@@ -617,9 +617,9 @@ PUBLIC HTStream* HTSaveToFile ARGS3(
if (((cp=strchr(pres->rep->name, ';')) != NULL) &&
strstr((cp+1), "charset") != NULL) {
- _user_message(WRONG_CHARSET_D_OR_C, pres->rep->name);
+ _user_message(MSG_DOWNLOAD_OR_CANCEL, pres->rep->name);
} else if (*(pres->rep->name) != '\0') {
- _user_message(UNMAPPED_TYPE_D_OR_C, pres->rep->name);
+ _user_message(MSG_DOWNLOAD_OR_CANCEL, pres->rep->name);
} else {
_statusline(CANNOT_DISPLAY_FILE_D_OR_C);
}
diff --git a/src/HTInit.c b/src/HTInit.c
index 222a581f..ef0d284c 100644
--- a/src/HTInit.c
+++ b/src/HTInit.c
@@ -992,7 +992,7 @@ PRIVATE int HTLoadExtensionsConfigFile ARGS1(
HTGetWord(w, l, ' ', '\t');
if (w[0] && (w[0] != ' ')) {
char *ext = (char *)malloc(sizeof(char) * (strlen(w)+1+1));
- if (!ct)
+ if (!ext)
outofmem(__FILE__, "HTLoadExtensionsConfigFile");
sprintf(ext, ".%s", w);
diff --git a/src/LYCookie.c b/src/LYCookie.c
index 869f3d8d..04a9a6fc 100644
--- a/src/LYCookie.c
+++ b/src/LYCookie.c
@@ -524,7 +524,7 @@ PRIVATE void store_cookie ARGS3(
* LYCookieAcceptDomains and/or LYCookieRejectDomains and/or
* LYAcceptAllCookies and/or some other settings. -kw
*/
- } else if ((persistent_cookies && (co->flags & COOKIE_FLAG_FROM_FILE))
+ } else if ((co->flags & COOKIE_FLAG_FROM_FILE)
|| HTConfirmCookie(de, hostname, co->name, co->value)) {
/*
* Insert the new cookie so that more specific paths (longer
@@ -562,18 +562,21 @@ PRIVATE char * scan_cookie_sublist ARGS6(
next = hl->next;
if (co) {
- CTRACE(tfp, "Checking cookie %lx %s=%s\n",
- (long)hl,
- (co->name ? co->name : "(no name)"),
- (co->value ? co->value : "(no value)"));
+ CTRACE(tfp, "Checking cookie %p %s=%s\n",
+ hl,
+ (co->name ? co->name : "(no name)"),
+ (co->value ? co->value : "(no value)"));
CTRACE(tfp, "\t%s %s %d %s %s %d%s\n",
- hostname,
- (co->domain ? co->domain : "(no domain)"),
- host_matches(hostname, co->domain),
- path, co->path, ((co->pathlen > 0) ?
- strncmp(path, co->path, co->pathlen) : 0),
- ((co->flags & COOKIE_FLAG_SECURE) ?
- " secure" : ""));
+ hostname,
+ (co->domain ? co->domain : "(no domain)"),
+ host_matches(hostname, co->domain),
+ path, co->path,
+ (co->pathlen > 0)
+ ? strncmp(path, co->path, co->pathlen)
+ : 0,
+ (co->flags & COOKIE_FLAG_SECURE)
+ ? " secure"
+ : "");
}
/*
* Check if this cookie has expired, and if so, delete it.
diff --git a/src/LYGetFile.c b/src/LYGetFile.c
index 64109c8a..b0c6968d 100644
--- a/src/LYGetFile.c
+++ b/src/LYGetFile.c
@@ -215,7 +215,7 @@ Try_Redirected_URL:
!strncmp(WWWDoc.address, LYlist_temp_url(),
strlen(LYlist_temp_url())))) {
CTRACE(tfp, "getfile: dropping post_data!\n");
- HTAlert(gettext("POST not supported for this URL - ignoring POST data!"));
+ HTAlert(IGNORED_POST);
FREE(doc->post_data);
FREE(doc->post_content_type);
WWWDoc.post_data = NULL;
@@ -737,7 +737,7 @@ Try_Redirected_URL:
sleep(AlertSecs);
} else {
fprintf(stderr,
- gettext("Illegal Redirection URL: %s"),
+ WWW_ILLEGAL_URL_MESSAGE,
use_this_url_instead);
}
FREE(use_this_url_instead);
diff --git a/src/LYHistory.c b/src/LYHistory.c
index 494d6152..630c0421 100644
--- a/src/LYHistory.c
+++ b/src/LYHistory.c
@@ -86,7 +86,7 @@ PUBLIC void LYAddVisitedLink ARGS1(
if ((new = (VisitedLink *)calloc(1, sizeof(*new))) == NULL)
outofmem(__FILE__, "LYAddVisitedLink");
StrAllocCopy(new->address, doc->address);
- StrAllocCopy(new->title, (doc->title ? doc->title : gettext("(no title)")));
+ StrAllocCopy(new->title, (doc->title ? doc->title : NO_TITLE));
if (!Visited_Links) {
Visited_Links = HTList_new();
@@ -397,9 +397,9 @@ PUBLIC int showhistory ARGS1(
LYTrimLeading(Title);
LYTrimTrailing(Title);
if (*Title == '\0')
- StrAllocCopy(Title , gettext("(no title)"));
+ StrAllocCopy(Title , NO_TITLE);
} else {
- StrAllocCopy(Title, gettext("(no title)"));
+ StrAllocCopy(Title, NO_TITLE);
}
fprintf(fp0,
"%s<em>%d</em>. <tab id=t%d><a href=\"LYNXHIST:%d\">%s</a>\n",
@@ -549,9 +549,9 @@ PUBLIC int LYShowVisitedLinks ARGS1(
LYTrimLeading(Title);
LYTrimTrailing(Title);
if (*Title == '\0')
- StrAllocCopy(Title , gettext("(no title)"));
+ StrAllocCopy(Title , NO_TITLE);
} else {
- StrAllocCopy(Title , gettext("(no title)"));
+ StrAllocCopy(Title , NO_TITLE);
}
if (vl->address != NULL && *vl->address != '\0') {
StrAllocCopy(Address, vl->address);
diff --git a/src/LYJump.c b/src/LYJump.c
index f7c85aba..cce5611e 100644
--- a/src/LYJump.c
+++ b/src/LYJump.c
@@ -62,7 +62,7 @@ PUBLIC void LYAddJumpShortcut ARGS2(HTList *, historyp, char *,shortcut)
return;
if ((new = (char *)calloc(1, (strlen(shortcut) + 1))) == NULL)
- outofmem(__FILE__, "HTAddJumpShortcut");
+ outofmem(__FILE__, "LYAddJumpShortcut");
strcpy(new, shortcut);
while (NULL != (old = (char *)HTList_nextObject(cur))) {
@@ -87,8 +87,7 @@ PUBLIC BOOL LYJumpInit ARGS1 (char *, config)
*/
jtp = (struct JumpTable *) calloc(1, sizeof(*jtp));
if (jtp == NULL) {
- perror(gettext("Out of memory in LYJumpInit"));
- return FALSE;
+ outofmem(__FILE__, "LYJumpInit");
}
/*
@@ -146,8 +145,7 @@ PUBLIC BOOL LYJumpInit ARGS1 (char *, config)
StrAllocCopy(jumpfile, JThead->file);
jtp = (struct JumpTable *) calloc(1, sizeof(*jtp));
if (jtp == NULL) {
- perror(gettext("Out of memory in LYJumpInit"));
- return FALSE;
+ outofmem(__FILE__, "LYJumpInit");
}
StrAllocCopy(jtp->file, JThead->file);
}
diff --git a/src/LYKeymap.h b/src/LYKeymap.h
index 2fc192e8..492784e3 100644
--- a/src/LYKeymap.h
+++ b/src/LYKeymap.h
@@ -104,15 +104,16 @@ extern unsigned short key_override[];
#define LYK_CLEAR_AUTH 71
#define LYK_SWITCH_DTD 72
#define LYK_ELGOTO 73
+#define LYK_CHANGE_LINK 74
#ifdef USE_EXTERNALS
-#define LYK_EXTERN 74
+#define LYK_EXTERN 75
#if defined(VMS) || defined(DIRED_SUPPORT)
-#define LYK_DIRED_MENU 75
+#define LYK_DIRED_MENU 76
#endif /* VMS || DIRED_SUPPORT */
#else /* USE_EXTERNALS */
#if defined(VMS) || defined(DIRED_SUPPORT)
-#define LYK_DIRED_MENU 74
+#define LYK_DIRED_MENU 75
#endif /* VMS || DIRED_SUPPORT */
#endif /* !defined(USE_EXTERNALS) */
@@ -133,12 +134,4 @@ extern unsigned short key_override[];
#define LYK_TAG_LINK 0
#endif
-#ifdef NOT_USED
-#define LYK_VERSION 81
-#define LYK_FORM_UP 82
-#define LYK_FORM_DOWN 83
-#endif /* NOT_USED */
-
-#define LYK_CHANGE_LINK 90 /* FIXME: make these an enum */
-
#endif /* LYKEYMAP_H */
diff --git a/src/LYLocal.c b/src/LYLocal.c
index 21bb24a7..e873f186 100644
--- a/src/LYLocal.c
+++ b/src/LYLocal.c
@@ -237,15 +237,20 @@ struct dired_menu {
NULL, NULL, NULL }
};
+PRIVATE BOOLEAN cannot_stat ARGS1(char *, name)
+{
+ char *tmpbuf = 0;
+ HTSprintf(&tmpbuf, gettext("Unable to get status of '%s'."), name);
+ HTAlert(tmpbuf);
+ FREE(tmpbuf);
+ return FALSE;
+}
+
PRIVATE BOOLEAN ok_stat ARGS2(char *, name, struct stat*, sb)
{
CTRACE(tfp, "testing ok_stat(%s)\n", name);
if (stat(name, sb) < 0) {
- char *tmpbuf = 0;
- HTSprintf(&tmpbuf, gettext("Unable to get status of '%s'."), name);
- HTAlert(tmpbuf);
- FREE(tmpbuf);
- return FALSE;
+ return cannot_stat(name);
}
return TRUE;
}
@@ -255,11 +260,7 @@ PRIVATE BOOLEAN ok_lstat ARGS2(char *, name, struct stat*, sb)
{
CTRACE(tfp, "testing ok_lstat(%s)\n", name);
if (lstat(name, sb) < 0) {
- char *tmpbuf = 0;
- HTSprintf(&tmpbuf, gettext("Unable to get status of '%s'."), name);
- HTAlert(tmpbuf);
- FREE(tmpbuf);
- return FALSE;
+ return cannot_stat(name);
}
return TRUE;
}
@@ -292,6 +293,56 @@ PRIVATE BOOLEAN ok_localname ARGS2(char*, dst, char*, src)
return TRUE;
}
+PRIVATE int move_file ARGS2(char *, source, char *, target)
+{
+ int code;
+ char *msg = 0;
+ char *args[5];
+
+ HTSprintf(&msg, gettext("move %s to %s"), source, target);
+ args[0] = "mv";
+ args[1] = source;
+ args[2] = target;
+ args[3] = (char *) 0;
+ code = (LYExecv(MV_PATH, args, msg) <= 0) ? -1 : 1;
+ FREE(msg);
+ return code;
+}
+
+PRIVATE BOOLEAN already_exists ARGS1(char *, name)
+{
+ struct stat dir_info;
+
+ if (stat(name, &dir_info) == -1) {
+ if (errno != ENOENT) {
+ cannot_stat(name);
+ } else {
+ return TRUE;
+ }
+ } else if (S_ISDIR(dir_info.st_mode)) {
+ HTAlert(gettext("There is already a directory with that name! Request ignored."));
+ } else if (S_ISREG(dir_info.st_mode)) {
+ HTAlert(gettext("There is already a file with that name! Request ignored."));
+ } else {
+ HTAlert(gettext("The specified name is already in use! Request ignored."));
+ }
+ return FALSE;
+}
+
+PRIVATE BOOLEAN dir_has_same_owner ARGS2(struct stat, *info, int, owner)
+{
+ if (S_ISDIR(info->st_mode)) {
+ if (info->st_uid == owner) {
+ return TRUE;
+ } else {
+ HTAlert(gettext("Destination has different owner! Request denied."));
+ }
+ } else {
+ HTAlert(gettext("Destination is not a valid directory! Request denied."));
+ }
+ return FALSE;
+}
+
/*
* Remove all tagged files and directories.
*/
@@ -369,7 +420,6 @@ PRIVATE BOOLEAN modify_tagged ARGS1(
char *savepath = NULL;
char *srcpath = NULL;
struct stat dir_info;
- char *args[5];
int count = 0;
HTList *tag;
@@ -478,47 +528,31 @@ PRIVATE BOOLEAN modify_tagged ARGS1(
* Make sure the target location is a directory which is owned
* by the same uid as the owner of the current location.
*/
- if (S_ISDIR(dir_info.st_mode)) {
- if (dir_info.st_uid == owner) {
- count = 0;
- tag = tagged;
-
- /*
- * Move all tagged items to the target location.
- */
- while ((cp = (char *)HTList_nextObject(tag)) != NULL) {
- cp = HTfullURL_toFile(cp);
- StrAllocCopy(srcpath, cp);
-
- HTSprintf0(&cp, gettext("move %s to %s"), srcpath, savepath);
- args[0] = "mv";
- args[1] = srcpath;
- args[2] = savepath;
- args[3] = (char *) 0;
- if (LYExecv(MV_PATH, args, cp) <= 0) {
- FREE(cp);
- if (count == 0)
- count = -1;
- break;
- }
+ if (dir_has_same_owner(&dir_info, owner)) {
+ count = 0;
+ tag = tagged;
+
+ /*
+ * Move all tagged items to the target location.
+ */
+ while ((cp = (char *)HTList_nextObject(tag)) != NULL) {
+ cp = HTfullURL_toFile(cp);
+ StrAllocCopy(srcpath, cp);
+
+ if (move_file(srcpath, savepath) < 0) {
FREE(cp);
- ++count;
+ if (count == 0)
+ count = -1;
+ break;
}
- FREE(srcpath);
- FREE(savepath);
- clear_tags();
- return count;
- } else {
- HTAlert(gettext("Destination has different owner! Request denied."));
- FREE(srcpath);
- FREE(savepath);
- return 0;
+ FREE(cp);
+ ++count;
}
- } else {
- HTAlert(gettext("Destination is not a valid directory! Request denied."));
- FREE(savepath);
- return 0;
+ clear_tags();
+ FREE(srcpath);
}
+ FREE(savepath);
+ return count;
}
return 0;
}
@@ -534,7 +568,6 @@ PRIVATE BOOLEAN modify_name ARGS1(
char newpath[512];
char savepath[512];
struct stat dir_info;
- char *args[5];
/*
* Determine the status of the selected item.
@@ -550,8 +583,7 @@ PRIVATE BOOLEAN modify_name ARGS1(
} else if (S_ISREG(dir_info.st_mode)) {
cp = gettext("Enter new name for file: ");
} else {
- HTAlert(gettext("The selected item is not a file or a directory! Request ignored."));
- return 0;
+ return ok_file_or_dir(&dir_info);
}
if (filename(cp, tmpbuf, sizeof(tmpbuf)) == NULL)
return 0;
@@ -571,30 +603,8 @@ PRIVATE BOOLEAN modify_name ARGS1(
/*
* Make sure the destination does not already exist.
*/
- if (stat(newpath, &dir_info) == -1) {
- char *msg = 0;
- if (errno != ENOENT) {
- HTSprintf(&msg,
- gettext("Unable to determine status of '%s'."), newpath);
- HTAlert(msg);
- FREE(msg);
- } else {
- int code;
- HTSprintf(&msg, gettext("move %s to %s"), savepath, newpath);
- args[0] = "mv";
- args[1] = savepath;
- args[2] = newpath;
- args[3] = (char *) 0;
- code = (LYExecv(MV_PATH, args, msg) <= 0) ? -1 : 1;
- FREE(msg);
- return code;
- }
- } else if (S_ISDIR(dir_info.st_mode)) {
- HTAlert(gettext("There is already a directory with that name! Request ignored."));
- } else if (S_ISREG(dir_info.st_mode)) {
- HTAlert(gettext("There is already a file with that name! Request ignored."));
- } else {
- HTAlert(gettext("The specified name is already in use! Request ignored."));
+ if (!already_exists(newpath)) {
+ return move_file(savepath, newpath);
}
}
}
@@ -616,7 +626,6 @@ PRIVATE BOOLEAN modify_location ARGS1(
char newpath[512];
char savepath[512];
struct stat dir_info;
- char *args[5];
/*
* Determine the status of the selected item.
@@ -635,8 +644,7 @@ PRIVATE BOOLEAN modify_location ARGS1(
} else if (S_ISREG(dir_info.st_mode)) {
cp = gettext("Enter new location for file: ");
} else {
- HTAlert(gettext("The specified item is not a file or a directory - request ignored."));
- return 0;
+ return ok_file_or_dir(&dir_info);
}
if (filename(cp, tmpbuf, sizeof(tmpbuf)) == NULL)
return 0;
@@ -675,10 +683,6 @@ PRIVATE BOOLEAN modify_location ARGS1(
if (!ok_stat(newpath, &dir_info)) {
return 0;
}
- if (!S_ISDIR(dir_info.st_mode)) {
- HTAlert(gettext("Destination is not a valid directory! Request denied."));
- return 0;
- }
/*
* Make sure the source and target are not the same location.
@@ -687,20 +691,8 @@ PRIVATE BOOLEAN modify_location ARGS1(
HTAlert(gettext("Source and destination are the same location! Request ignored!"));
return 0;
}
- if (dir_info.st_uid == owner) {
- int code;
- char *msg = 0;
- HTSprintf(&msg,gettext("move %s to %s"),savepath,newpath);
- args[0] = "mv";
- args[1] = savepath;
- args[2] = newpath;
- args[3] = (char *) 0;
- code = (LYExecv(MV_PATH, args, msg) <= 0) ? -1 : 1;
- FREE(msg);
- return code;
- } else {
- HTAlert(gettext("Destination has different owner! Request denied."));
- return 0;
+ if (dir_has_same_owner(&dir_info, owner)) {
+ return move_file(savepath,newpath);
}
}
return 0;
@@ -783,15 +775,15 @@ PUBLIC BOOLEAN local_modify ARGS2(
PRIVATE BOOLEAN create_file ARGS1(
char *, current_location)
{
+ int code = FALSE;
char tmpbuf[512];
char testpath[512];
- struct stat dir_info;
char *args[5];
char *bad_chars = ".~/";
if (filename(gettext("Enter name of file to create: "),
tmpbuf, sizeof(tmpbuf)) == NULL) {
- return 0;
+ return code;
}
if (!no_dotfiles && show_dotfiles) {
@@ -812,32 +804,17 @@ PRIVATE BOOLEAN create_file ARGS1(
/*
* Make sure the target does not already exist
*/
- if (stat(testpath, &dir_info) == -1) {
- int code;
+ if (!already_exists(testpath)) {
char *msg = 0;
- if (errno != ENOENT) {
- HTSprintf(&msg,
- gettext("Unable to determine status of '%s'."), testpath);
- HTAlert(msg);
- code = 0;
- } else {
- HTSprintf(&msg,gettext("create %s"),testpath);
- args[0] = "touch";
- args[1] = testpath;
- args[2] = (char *) 0;
- code = (LYExecv(TOUCH_PATH, args, msg) <= 0) ? -1 : 1;
- }
+ HTSprintf(&msg,gettext("create %s"),testpath);
+ args[0] = "touch";
+ args[1] = testpath;
+ args[2] = (char *) 0;
+ code = (LYExecv(TOUCH_PATH, args, msg) <= 0) ? -1 : 1;
FREE(msg);
- return code;
- } else if (S_ISDIR(dir_info.st_mode)) {
- HTAlert(gettext("There is already a directory with that name! Request ignored."));
- } else if (S_ISREG(dir_info.st_mode)) {
- HTAlert(gettext("There is already a file with that name! Request ignored."));
- } else {
- HTAlert(gettext("The specified name is already in use! Request ignored."));
}
}
- return 0;
+ return code;
}
/*
@@ -846,15 +823,15 @@ PRIVATE BOOLEAN create_file ARGS1(
PRIVATE BOOLEAN create_directory ARGS1(
char *, current_location)
{
+ int code = FALSE;
char tmpbuf[512];
char testpath[512];
- struct stat dir_info;
char *args[5];
char *bad_chars = ".~/";
if (filename(gettext("Enter name for new directory: "),
tmpbuf, sizeof(tmpbuf)) == NULL) {
- return 0;
+ return code;
}
if (!no_dotfiles && show_dotfiles) {
@@ -872,32 +849,17 @@ PRIVATE BOOLEAN create_directory ARGS1(
/*
* Make sure the target does not already exist.
*/
- if (stat(testpath, &dir_info) == -1) {
- int code;
+ if (!already_exists(testpath)) {
char *msg = 0;
- if (errno != ENOENT) {
- HTSprintf(&msg,
- gettext("Unable to determine status of '%s'."), testpath);
- HTAlert(msg);
- code = 0;
- } else {
- HTSprintf(&msg,"make directory %s",testpath);
- args[0] = "mkdir";
- args[1] = testpath;
- args[2] = (char *) 0;
- code = (LYExecv(MKDIR_PATH, args, msg) <= 0) ? -1 : 1;
- }
+ HTSprintf(&msg,"make directory %s",testpath);
+ args[0] = "mkdir";
+ args[1] = testpath;
+ args[2] = (char *) 0;
+ code = (LYExecv(MKDIR_PATH, args, msg) <= 0) ? -1 : 1;
FREE(msg);
- return code;
- } else if (S_ISDIR(dir_info.st_mode)) {
- HTAlert(gettext("There is already a directory with that name! Request ignored."));
- } else if (S_ISREG(dir_info.st_mode)) {
- HTAlert(gettext("There is already a file with that name! Request ignored."));
- } else {
- HTAlert(gettext("The specified name is already in use! Request ignored."));
}
}
- return 0;
+ return code;
}
/*
@@ -977,8 +939,7 @@ PRIVATE BOOLEAN remove_single ARGS1(
}
#endif
} else {
- HTSprintf0(&tmpbuf, gettext("Unable to determine status of '%s'."), testpath);
- HTAlert(tmpbuf);
+ cannot_stat(testpath);
FREE(tmpbuf);
return 0;
}
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 1b5b2739..bbc076c2 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -1101,7 +1101,7 @@ try_again:
temp = HTParse(curdoc.address, "",
PARSE_ACCESS+PARSE_HOST+PARSE_PUNCTUATION);
if (!temp || *temp == '\0') {
- StrAllocCopy(startrealm, gettext("None"));
+ StrAllocCopy(startrealm, NO_NOTHING);
} else {
StrAllocCopy(startrealm, temp);
FREE(temp);
@@ -1155,14 +1155,14 @@ try_again:
*/
if (strncmp((curdoc.address ? curdoc.address : "NULL"),
"http", 4)) {
- StrAllocCopy(traversal_host, gettext("None"));
+ StrAllocCopy(traversal_host, NO_NOTHING);
} else if (check_realm) {
StrAllocCopy(traversal_host, startrealm);
} else {
temp = HTParse(curdoc.address, "",
PARSE_ACCESS+PARSE_HOST+PARSE_PUNCTUATION);
if (!temp || *temp == '\0') {
- StrAllocCopy(traversal_host, gettext("None"));
+ StrAllocCopy(traversal_host, NO_NOTHING);
} else {
StrAllocCopy(traversal_host, temp);
LYAddHtmlSep(&traversal_host);
@@ -3609,50 +3609,6 @@ check_goto_URL:
} /* end if */
break;
-#ifdef NOT_USED
- case LYK_FORM_UP: /* change form */
- break; /* not implemented */
- if (lynx_mode == FORMS_LYNX_MODE) {
- if (links[curdoc.link].type == WWW_FORM_LINK_TYPE) {
- c = change_form_link(&links[curdoc.link],
- &newdoc, &refresh_screen,
- links[curdoc.link].form->name,
- links[curdoc.link].form->value);
- /*
- * Code to handle multiple submit buttons?
- * Taken out due to bug it causes.
- if (links[curdoc.link].form->type == F_SUBMIT_TYPE ||
- links[curdoc.link].form->type == F_IMAGESUBMIT_TYPE) {
- curdoc.address = NULL;
- }
- */
- goto new_keyboard_input;
- } else {
- _statusline(gettext("'X' can only toggle a form link"));
- }
- } else {
- _statusline(gettext("'X' only toggles in forms mode"));
- }
- break;
-
- case LYK_FORM_DOWN: /* change form */
- break; /* not implemented */
- if (lynx_mode==FORMS_LYNX_MODE) {
- if (links[curdoc.link].type == WWW_FORM_LINK_TYPE) {
- c = change_form_link(&links[curdoc.link],
- &newdoc,&refresh_screen,
- links[curdoc.link].form->name,
- links[curdoc.link].form->value);
- goto new_keyboard_input;
- } else {
- _statusline(gettext("'Z' can only toggle a form link"));
- }
- } else {
- _statusline(gettext("'Z' only toggles in forms mode"));
- }
- break;
-#endif /* NOT_USED */
-
case LYK_MAIN_MENU: /* return to main screen */
/*
* If its already the homepage then don't reload it.
@@ -4415,6 +4371,9 @@ if (!LYUseFormsOptions) {
*cp = '\0';
toolbar = (char *)malloc(strlen(curdoc.address) +
strlen(LYToolbarName) + 2);
+ if (!toolbar)
+ outofmem(__FILE__, "mainloop");
+
sprintf(toolbar, "%s#%s", curdoc.address, LYToolbarName);
if (cp)
*cp = '#';
@@ -5390,19 +5349,6 @@ check_add_bookmark_to_self:
}
break;
-#ifdef NOT_USED
- case LYK_VERSION:
- if (old_c != real_c) {
- char version[128];
- old_c = real_c;
- sprintf(version, gettext("*** %s Version %s ***"),
- LYNX_NAME, LYNX_VERSION);
- statusline(version);
- sleep(AlertMessage);
- }
- break;
-#endif /* NOT_USED */
-
case LYK_DO_NOTHING: /* pretty self explanatory */
break;
diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c
index d718eb0e..f72d5755 100644
--- a/src/LYShowInfo.c
+++ b/src/LYShowInfo.c
@@ -338,7 +338,7 @@ PUBLIC int showinfo ARGS4(
StrAllocCopy(Address, owner_address);
LYEntify(&Address, TRUE);
} else {
- StrAllocCopy(Address, gettext("None"));
+ StrAllocCopy(Address, NO_NOTHING);
}
fprintf(fp0, "<dt><em>%s</em> %s\n", gettext("Owner(s):"), Address);
diff --git a/src/LYStrings.c b/src/LYStrings.c
index f02c22c5..194d414f 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -889,7 +889,7 @@ PRIVATE int read_keymap_file NOARGS
fclose (fp);
if (ret == -1)
- fprintf (stderr, gettext("Error processing line %d of %s\n"), linenum, file);
+ fprintf (stderr, FAILED_READING_KEYMAP, linenum, file);
return ret;
}
diff --git a/src/LYUpload.c b/src/LYUpload.c
index 0dd98b14..9f970890 100644
--- a/src/LYUpload.c
+++ b/src/LYUpload.c
@@ -172,7 +172,7 @@ failed:
return 0;
cancelled:
- HTInfoMsg(gettext("Cancelling."));
+ HTInfoMsg(CANCELLING);
return 0;
}
diff --git a/src/LYUtils.c b/src/LYUtils.c
index d836ea14..0591a895 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -1988,33 +1988,6 @@ PUBLIC void noviceline ARGS1(
else
addstr((char *)novice_lines(lineno));
-#ifdef NOTDEFINED
- if (is_www_index && more_flag) {
- addstr(gettext("This is a searchable index. Use "));
- addstr(key_for_func(LYK_INDEX_SEARCH));
- addstr(gettext(" to search:"));
- stop_reverse();
- addstr(" ");
- start_reverse();
- addstr(gettext("space for more"));
-
- } else if (is_www_index) {
- addstr(gettext("This is a searchable index. Use "));
- addstr(key_for_func(LYK_INDEX_SEARCH));
- addstr(gettext(" to search:"));
- } else {
- addstr(gettext("Type a command or ? for help:"));
-
- if (more_flag) {
- stop_reverse();
- addstr(" ");
- start_reverse();
- addstr(gettext("Press space for next page"));
- }
- }
-
-#endif /* NOTDEFINED */
-
refresh();
return;
}
@@ -6281,6 +6254,8 @@ PUBLIC void LYsetXDisplay ARGS1(
#else
static char *display_putenv_command;
display_putenv_command = malloc(strlen(new_display) + 12);
+ if (!display_putenv_command)
+ outofmem(__FILE__, "LYsetXDisplay");
sprintf(display_putenv_command, "DISPLAY=%s", new_display);
putenv(display_putenv_command);