projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* uip/post.c, uip/spost.c: Move the uptolow macro from spost.c to post.c
[mmh]
/
uip
/
folder.c
diff --git
a/uip/folder.c
b/uip/folder.c
index
c023e11
..
d6cb5b5
100644
(file)
--- a/
uip/folder.c
+++ b/
uip/folder.c
@@
-5,9
+5,14
@@
* -- list the folder stack
*
* $Id$
* -- list the folder stack
*
* $Id$
+ *
+ * This code is Copyright (c) 2002, by the authors of nmh. See the
+ * COPYRIGHT file in the root directory of the nmh distribution for
+ * complete copyright information.
*/
#include <h/mh.h>
*/
#include <h/mh.h>
+#include <h/utils.h>
#include <errno.h>
static struct swit switches[] = {
#include <errno.h>
static struct swit switches[] = {
@@
-58,12
+63,10
@@
static struct swit switches[] = {
#define VERSIONSW 22
{ "version", 0 },
#define HELPSW 23
#define VERSIONSW 22
{ "version", 0 },
#define HELPSW 23
- { "help", 4 },
+ { "help", 0 },
{ NULL, 0 }
};
{ NULL, 0 }
};
-extern int errno;
-
static int fshort = 0; /* output only folder names */
static int fcreat = 0; /* should we ask to create new folders? */
static int fpack = 0; /* are we packing the folder? */
static int fshort = 0; /* output only folder names */
static int fcreat = 0; /* should we ask to create new folders? */
static int fpack = 0; /* are we packing the folder? */
@@
-351,13
+354,11
@@
main (int argc, char **argv)
/* Allocate initial space to record folder names */
maxfolders = NUMFOLDERS;
/* Allocate initial space to record folder names */
maxfolders = NUMFOLDERS;
- if ((folds = malloc (maxfolders * sizeof(char *))) == NULL)
- adios (NULL, "unable to allocate storage for folder names");
+ folds = mh_xmalloc (maxfolders * sizeof(char *));
/* Allocate initial space to record folder information */
maxFolderInfo = NUMFOLDERS;
/* Allocate initial space to record folder information */
maxFolderInfo = NUMFOLDERS;
- if ((fi = malloc (maxFolderInfo * sizeof(*fi))) == NULL)
- adios (NULL, "unable to allocate storage for folder info");
+ fi = mh_xmalloc (maxFolderInfo * sizeof(*fi));
/*
* Scan the folders
/*
* Scan the folders
@@
-421,7
+422,7
@@
main (int argc, char **argv)
print_folders();
context_save (); /* save the context file */
print_folders();
context_save (); /* save the context file */
- done (0);
+ return done (0);
}
/*
}
/*
@@
-468,8
+469,7
@@
get_folder_info (char *fold, char *msg)
*/
if (total_folders >= maxFolderInfo) {
maxFolderInfo += NUMFOLDERS;
*/
if (total_folders >= maxFolderInfo) {
maxFolderInfo += NUMFOLDERS;
- if ((fi = realloc (fi, maxFolderInfo * sizeof(*fi))) == NULL)
- adios (NULL, "unable to re-allocate storage for folder info");
+ fi = mh_xrealloc (fi, maxFolderInfo * sizeof(*fi));
}
fi[i].name = fold;
}
fi[i].name = fold;
@@
-773,8
+773,7
@@
addfold (char *fold)
/* if necessary, reallocate the space for folder names */
if (foldp >= maxfolders) {
maxfolders += NUMFOLDERS;
/* if necessary, reallocate the space for folder names */
if (foldp >= maxfolders) {
maxfolders += NUMFOLDERS;
- if ((folds = realloc (folds, maxfolders * sizeof(char *))) == NULL)
- adios (NULL, "unable to re-allocate storage for folder names");
+ folds = mh_xrealloc (folds, maxfolders * sizeof(char *));
}
cp = getcpy (fold);
}
cp = getcpy (fold);
@@
-814,10
+813,6
@@
readonly_folders (void)
char atrcur[BUFSIZ];
register struct node *np;
char atrcur[BUFSIZ];
register struct node *np;
- /* sanity check - check that context has been read */
- if (defpath == NULL)
- adios (NULL, "oops, context hasn't been read yet");
-
snprintf (atrcur, sizeof(atrcur), "atr-%s-", current);
atrlen = strlen (atrcur);
snprintf (atrcur, sizeof(atrcur), "atr-%s-", current);
atrlen = strlen (atrcur);