summary refs log tree commit diff
path: root/src/settings/plugins/ifcfg-rh/shvar.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings/plugins/ifcfg-rh/shvar.h')
-rw-r--r--src/settings/plugins/ifcfg-rh/shvar.h63
1 files changed, 23 insertions, 40 deletions
diff --git a/src/settings/plugins/ifcfg-rh/shvar.h b/src/settings/plugins/ifcfg-rh/shvar.h
index 4b650d2a..4cbf1a31 100644
--- a/src/settings/plugins/ifcfg-rh/shvar.h
+++ b/src/settings/plugins/ifcfg-rh/shvar.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * shvar.h
  *
@@ -32,79 +33,61 @@
 
 #include <glib.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
 
 typedef struct _shvarFile shvarFile;
 struct _shvarFile {
-	char		*fileName;	/* read-only */
-	int		fd;		/* read-only */
-	char		*arena;		/* ignore */
-	GList		*lineList;	/* read-only */
-	GList		*current;	/* set implicitly or explicitly,
-					   points to element of lineList */
-	shvarFile	*parent;	/* set explicitly */
-	int		modified;	/* ignore */
+	char      *fileName;    /* read-only */
+	int        fd;          /* read-only */
+	GList     *lineList;    /* read-only */
+	GList     *current;     /* set implicitly or explicitly, points to element of lineList */
+	gboolean   modified;    /* ignore */
 };
 
 
-/* Create the file <name>, return shvarFile on success, NULL on failure */
-shvarFile *
-svCreateFile(const char *name);
+/* Create the file <name>, return a shvarFile (never fails) */
+shvarFile *svCreateFile (const char *name);
 
 /* Open the file <name>, return shvarFile on success, NULL on failure */
-shvarFile *
-svNewFile(const char *name);
+shvarFile *svOpenFile (const char *name, GError **error);
 
 /* Get the value associated with the key, and leave the current pointer
  * pointing at the line containing the value.  The char* returned MUST
  * be freed by the caller.
  */
-char *
-svGetValue(shvarFile *s, const char *key, gboolean verbatim);
+char *svGetValue (shvarFile *s, const char *key, gboolean verbatim);
 
-/* return 1 if <key> resolves to any truth value (e.g. "yes", "y", "true")
- * return 0 if <key> resolves to any non-truth value (e.g. "no", "n", "false")
+/* return TRUE if <key> resolves to any truth value (e.g. "yes", "y", "true")
+ * return FALSE if <key> resolves to any non-truth value (e.g. "no", "n", "false")
  * return <def> otherwise
  */
-int
-svTrueValue(shvarFile *s, const char *key, int def);
+gboolean svTrueValue (shvarFile *s, const char *key, gboolean def);
 
 /* Set the variable <key> equal to the value <value>.
  * If <key> does not exist, and the <current> pointer is set, append
  * the key=value pair after that line.  Otherwise, prepend the pair
  * to the top of the file.
  */
-void
-svSetValue(shvarFile *s, const char *key, const char *value, gboolean verbatim);
+void svSetValue (shvarFile *s, const char *key, const char *value, gboolean verbatim);
 
 
-/* Write the current contents iff modified.  Returns -1 on error
- * and 0 on success.  Do not write if no values have been modified.
+/* Write the current contents iff modified.  Returns FALSE on error
+ * and TRUE on success.  Do not write if no values have been modified.
  * The mode argument is only used if creating the file, not if
  * re-writing an existing file, and is passed unchanged to the
  * open() syscall.
  */
-int
-svWriteFile(shvarFile *s, int mode);
+gboolean svWriteFile (shvarFile *s, int mode, GError **error);
 
-/* Close the file descriptor (if open) and delete the shvarFile.
- * Returns -1 on error and 0 on success.
- */
-int
-svCloseFile(shvarFile *s);
+/* Close the file descriptor (if open) and free the shvarFile. */
+void svCloseFile (shvarFile *s);
 
 /* Return a new escaped string */
-char *
-svEscape(const char *s);
+char *svEscape (const char *s);
 
 /* Unescape a string in-place */
-void
-svUnescape(char *s);
+void svUnescape (char *s);
 
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif /* ! _SHVAR_H */