summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@iohq.net>2015-06-27 01:07:41 -0600
committerAaron Ball <nullspoon@iohq.net>2015-06-27 01:07:41 -0600
commit6b66372a301366629eaac2f6ab606e4c2def497b (patch)
treee4c75f3e1567374dacb1c9648b6fa0c2631dd12f
parent28d87ea0257509282717acaf19731255607cb6d4 (diff)
downloadterminus-6b66372a301366629eaac2f6ab606e4c2def497b.tar.gz
terminus-6b66372a301366629eaac2f6ab606e4c2def497b.tar.xz
Fixed function comment syntax
-rw-r--r--src/main.c101
1 files changed, 51 insertions, 50 deletions
diff --git a/src/main.c b/src/main.c
index 0a05a59..016a2e9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -20,28 +20,29 @@
#include <time.h>
#include <math.h>
-//
-// Converts the given day count to seconds (multiplies by the number of seconds
-// in a day, 86400).
-//
-// @param days Day count to convert to seconds
-//
-// @return long Number of total seconds in the given day duration
-//
+
+/**
+ * Converts the given day count to seconds (multiplies by the number of seconds
+ * in a day, 86400).
+ *
+ * @param days Day count to convert to seconds
+ *
+ * @return long Number of total seconds in the given day duration
+ */
long days_to_seconds(int days) {
return days * 86400;
}
-//
-// Converts the given "string integer" to a long datatype. This is useful for
-// programs that take command line arguments from the user and they need to
-// treats those arguments like actual numbers.
-//
-// @param intstr Integer string
-//
-// @return long The integer represented by the given string
-//
+/**
+ * Converts the given "string integer" to a long datatype. This is useful for
+ * programs that take command line arguments from the user and they need to
+ * treats those arguments like actual numbers.
+ *
+ * @param intstr Integer string
+ *
+ * @return long The integer represented by the given string
+ */
long ctoi(char* intstr) {
// TODO: This doesn't work yet
int i = 0;
@@ -60,9 +61,9 @@ long ctoi(char* intstr) {
}
-//
-//
-//
+/**
+ * TODO
+ */
int get_user_home(char* out) {
if(getenv("HOME") != NULL) {
strcpy(out, getenv("HOME"));
@@ -73,13 +74,13 @@ int get_user_home(char* out) {
}
-//
-// Writes the current timestamp to the specified lastlogin file
-//
-// @param path Path to the lastlogin file
-//
-// @return int Status of the write operation
-//
+/**
+ * Writes the current timestamp to the specified lastlogin file
+ *
+ * @param path Path to the lastlogin file
+ *
+ * @return int Status of the write operation
+ */
int write_lastlogin(char* path) {
FILE* f = fopen(path, "w+");
@@ -94,14 +95,14 @@ int write_lastlogin(char* path) {
}
-//
-// Gets the time_t value contained in the specified lastlogin file.
-//
-// @param lastlogin_path Path to the lastlogin file to be read
-// @param lastlogin Output time_t variable
-//
-// @return int Status of reading the lastlogin file
-//
+/**
+ * Gets the time_t value contained in the specified lastlogin file.
+ *
+ * @param lastlogin_path Path to the lastlogin file to be read
+ * @param lastlogin Output time_t variable
+ *
+ * @return int Status of reading the lastlogin file
+ */
int get_lastlogin(char* lastlogin_path, time_t* lastlogin) {
// File pointer to lastlogin file (used for reading and writing)
FILE* lastlogin_file;
@@ -123,18 +124,18 @@ int get_lastlogin(char* lastlogin_path, time_t* lastlogin) {
}
-//
-// Executes the specified command, printing the output.
-// Note that this does read the calling shell's environmental variables, and so
-// absolute paths are not necessary if the command targets an executable in
-// PATH.
-//
-// @param cmd Command to be executed and output to be printed
-//
-// @return int Execution status of the command
-// Note that if the command fails execution at start, -1 is
-// returned.
-//
+/**
+ * Executes the specified command, printing the output.
+ * Note that this does read the calling shell's environmental variables, and so
+ * absolute paths are not necessary if the command targets an executable in
+ * PATH.
+ *
+ * @param cmd Command to be executed and output to be printed
+ *
+ * @return int Execution status of the command
+ * Note that if the command fails execution at start, -1 is
+ * returned.
+ */
int exec_cmd(char* cmd) {
FILE* p = popen(cmd, "r");
if(p == NULL) { return -1; }
@@ -150,9 +151,9 @@ int exec_cmd(char* cmd) {
}
-//
-// Ye olde main function
-//
+/**
+ * Ye olde main function
+ */
int main(int argc, char* argv[]) {
char home[128];
int days;

Generated by cgit