|
@@ -13,6 +13,59 @@
|
|
|
* fopen old group files anywhere
|
|
|
*******************************************************/
|
|
|
|
|
|
+FILE *fopen_group_file_old(const char *group, const char *mapset, const char *file)
|
|
|
+{
|
|
|
+ FILE *fd;
|
|
|
+
|
|
|
+ if (mapset == NULL || *mapset == 0)
|
|
|
+ mapset = G_mapset();
|
|
|
+
|
|
|
+ /* find file first */
|
|
|
+ if (!I_find_group_file2(group, mapset, file)) {
|
|
|
+ G_warning(_("Unable to find file [%s] of group [%s in %s]"),
|
|
|
+ file, group, mapset);
|
|
|
+
|
|
|
+ return ((FILE *) NULL);
|
|
|
+ }
|
|
|
+
|
|
|
+ fd = G_fopen_old_misc("group", file, group, mapset);
|
|
|
+ if (!fd)
|
|
|
+ G_warning(_("Unable to open file [%s] of group [%s in %s]"),
|
|
|
+ file, group, mapset);
|
|
|
+
|
|
|
+ return fd;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+FILE *fopen_subgroup_file_old(const char *group,
|
|
|
+ const char *subgroup, const char *mapset,
|
|
|
+ const char *file)
|
|
|
+{
|
|
|
+ FILE *fd;
|
|
|
+ char element[GNAME_MAX * 2];
|
|
|
+
|
|
|
+ if (mapset == NULL || *mapset == 0)
|
|
|
+ mapset = G_mapset();
|
|
|
+
|
|
|
+ /* find file first */
|
|
|
+ if (!I_find_subgroup_file2(group, subgroup, mapset, file)) {
|
|
|
+ G_warning(_("Unable to find file [%s] for subgroup [%s] of group [%s in %s]"),
|
|
|
+ file, subgroup, group, mapset);
|
|
|
+
|
|
|
+ return ((FILE *) NULL);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* get subgroup element name */
|
|
|
+ sprintf(element, "subgroup/%s/%s", subgroup, file);
|
|
|
+
|
|
|
+ fd = G_fopen_old_misc("group", element, group, mapset);
|
|
|
+ if (!fd)
|
|
|
+ G_warning(_("Unable to open file [%s] for subgroup [%s] of group [%s in %s]"),
|
|
|
+ file, subgroup, group, mapset);
|
|
|
+
|
|
|
+ return fd;
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
FILE *I_fopen_group_file_new(const char *group, const char *file)
|
|
|
{
|
|
@@ -40,24 +93,34 @@ FILE *I_fopen_group_file_append(const char *group, const char *file)
|
|
|
}
|
|
|
|
|
|
|
|
|
+/*!
|
|
|
+ * \brief Open group file for reading
|
|
|
+ *
|
|
|
+ * Internally uses G_fopen_old_misc
|
|
|
+ *
|
|
|
+ * \param group
|
|
|
+ * \param file
|
|
|
+ * \return FILE *
|
|
|
+ */
|
|
|
FILE *I_fopen_group_file_old(const char *group, const char *file)
|
|
|
{
|
|
|
- FILE *fd;
|
|
|
-
|
|
|
- /* find file first */
|
|
|
- if (!I_find_group_file(group, file)) {
|
|
|
- G_warning(_("Unable to find file [%s] of group [%s in %s]"),
|
|
|
- file, group, G_mapset());
|
|
|
-
|
|
|
- return ((FILE *) NULL);
|
|
|
- }
|
|
|
+ return fopen_group_file_old(group, NULL, file);
|
|
|
+}
|
|
|
|
|
|
- fd = G_fopen_old_misc("group", file, group, G_mapset());
|
|
|
- if (!fd)
|
|
|
- G_warning(_("Unable to open file [%s] of group [%s in %s]"),
|
|
|
- file, group, G_mapset());
|
|
|
|
|
|
- return fd;
|
|
|
+/*!
|
|
|
+ * \brief Open group file for reading
|
|
|
+ *
|
|
|
+ * Internally uses G_fopen_old_misc
|
|
|
+ *
|
|
|
+ * \param group
|
|
|
+ * \param mapset
|
|
|
+ * \param file
|
|
|
+ * \return FILE *
|
|
|
+ */
|
|
|
+FILE *I_fopen_group_file_old2(const char *group, const char *mapset, const char *file)
|
|
|
+{
|
|
|
+ return fopen_group_file_old(group, mapset, file);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -108,24 +171,12 @@ FILE *I_fopen_subgroup_file_append(const char *group,
|
|
|
FILE *I_fopen_subgroup_file_old(const char *group,
|
|
|
const char *subgroup, const char *file)
|
|
|
{
|
|
|
- FILE *fd;
|
|
|
- char element[GNAME_MAX * 2];
|
|
|
-
|
|
|
- /* find file first */
|
|
|
- if (!I_find_subgroup_file(group, subgroup, file)) {
|
|
|
- G_warning(_("Unable to find file [%s] for subgroup [%s] of group [%s in %s]"),
|
|
|
- file, subgroup, group, G_mapset());
|
|
|
-
|
|
|
- return ((FILE *) NULL);
|
|
|
- }
|
|
|
-
|
|
|
- /* get subgroup element name */
|
|
|
- sprintf(element, "subgroup/%s/%s", subgroup, file);
|
|
|
-
|
|
|
- fd = G_fopen_old_misc("group", element, group, G_mapset());
|
|
|
- if (!fd)
|
|
|
- G_warning(_("Unable to open file [%s] for subgroup [%s] of group [%s in %s]"),
|
|
|
- file, subgroup, group, G_mapset());
|
|
|
+ return fopen_subgroup_file_old(group, subgroup, NULL, file);
|
|
|
+}
|
|
|
|
|
|
- return fd;
|
|
|
+FILE *I_fopen_subgroup_file_old2(const char *group,
|
|
|
+ const char *subgroup, const char *mapset,
|
|
|
+ const char *file)
|
|
|
+{
|
|
|
+ return fopen_subgroup_file_old(group, subgroup, mapset, file);
|
|
|
}
|