summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2022-06-06 08:09:39 -0400
committerAllen Winter <allen.winter@kdab.com>2022-06-06 08:09:39 -0400
commit5de3e1500d33e3f14b289ee29ceb79cd9cc64fed (patch)
tree071fd080dfcbb6e9e78aee3abded1236a9060470 /examples
parent8a02c81153db797703adf2e18be94efe0f0c7b8c (diff)
downloadlibical-git-5de3e1500d33e3f14b289ee29ceb79cd9cc64fed.tar.gz
REUSE compliance
fixes: #489
Diffstat (limited to 'examples')
-rw-r--r--examples/CMakeLists.txt3
-rw-r--r--examples/access_components.c18
-rw-r--r--examples/access_properties_and_parameters.c9
-rw-r--r--examples/errors.c14
-rw-r--r--examples/main.c8
-rw-r--r--examples/parse_text.c7
6 files changed, 28 insertions, 31 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 46bde676..c5a8441c 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,3 +1,6 @@
+# SPDX-FileCopyrightText: Allen Winter <winter@kde.org>
+# SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src
diff --git a/examples/access_components.c b/examples/access_components.c
index c0e3985f..88731fd6 100644
--- a/examples/access_components.c
+++ b/examples/access_components.c
@@ -1,4 +1,8 @@
-/* Access_component.c */
+/* Access_component.c
+
+ SPDX-FileCopyrightText: <eric@civicknowledge.com>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
#include <libical/ical.h>
@@ -20,13 +24,10 @@ void do_something(icalcomponent *c);
constructors, resulting in a compact, neatly formatted way to create
components. This style is shown in create_new_component_with_va_args()
-
-
*/
icalcomponent* create_new_component()
{
-
/* variable definitions */
icalcomponent* calendar;
icalcomponent* event;
@@ -57,7 +58,6 @@ icalcomponent* create_new_component()
icalproperty_new_version("2.0")
);
-
/* Here is the short version of the memory rules:
If the routine name has "new" in it:
@@ -132,7 +132,6 @@ icalcomponent* create_new_component()
icalcomponent_add_property(event,property);
-
/* more properties */
icalcomponent_add_property(
@@ -169,7 +168,6 @@ icalcomponent* create_new_component()
icalcomponent_add_property(event,property);
-
property = icalproperty_new_dtend(atime);
icalproperty_add_parameter(
@@ -189,13 +187,11 @@ icalcomponent* create_new_component()
return calendar;
}
-
/* Now, create the same component as in the previous routine, but use
the constructor style. */
icalcomponent* create_new_component_with_va_args()
{
-
/* This is a similar set up to the last routine */
icalcomponent* calendar;
struct icaltimetype atime = icaltime_from_timet_with_zone(time(0), 0, icaltimezone_get_utc_timezone());
@@ -254,7 +250,6 @@ icalcomponent* create_new_component_with_va_args()
0
);
-
/* Note that properties with no parameters can use the regular
'new' constructor, while those with parameters use the 'vanew'
constructor. And, be sure that the last argument in the 'vanew'
@@ -263,7 +258,6 @@ icalcomponent* create_new_component_with_va_args()
return calendar;
}
-
void find_sub_components(icalcomponent* comp)
{
icalcomponent *c;
@@ -286,7 +280,6 @@ void find_sub_components(icalcomponent* comp)
do_something(c);
}
-
}
/* Ical components only have one internal iterator, so removing the
@@ -307,5 +300,4 @@ void remove_vevent_sub_components(icalcomponent* comp){
do_something(c);
}
-
}
diff --git a/examples/access_properties_and_parameters.c b/examples/access_properties_and_parameters.c
index e4c13f40..cbaf3cd8 100644
--- a/examples/access_properties_and_parameters.c
+++ b/examples/access_properties_and_parameters.c
@@ -1,4 +1,8 @@
-/* access_properties_and_parameters.c */
+/* access_properties_and_parameters.c
+
+ SPDX-FileCopyrightText: <eric@civicknowledge.com>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
#include <libical/ical.h>
#include <stdlib.h>
@@ -47,7 +51,6 @@ void get_required_attendees(icalcomponent* event)
printf("%s",attendee);
}
}
-
}
/* Here is a similar example. If an attendee has a PARTSTAT of
@@ -93,7 +96,6 @@ void update_attendees(icalcomponent* event)
icalparameter_new_partstat(ICAL_PARTSTAT_TENTATIVE)
);
}
-
}
}
@@ -146,5 +148,4 @@ void test_properties()
/* Frees the original and the clone */
icalproperty_free(clone);
icalproperty_free(prop);
-
}
diff --git a/examples/errors.c b/examples/errors.c
index f50c4c9d..315d3702 100644
--- a/examples/errors.c
+++ b/examples/errors.c
@@ -1,4 +1,8 @@
-/* errors.c */
+/* errors.c
+
+ SPDX-FileCopyrightText: <eric@civicknowledge.com>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
#include <libical/ical.h>
@@ -15,9 +19,7 @@ void program_errors()
fprintf(stderr,"Horrible libical error: %s\n",
icalerror_strerror(icalerrno));
-
}
-
}
void component_errors(icalcomponent *comp)
@@ -39,17 +41,13 @@ void component_errors(icalcomponent *comp)
p != 0;
p = icalcomponent_get_next_property(comp,ICAL_XLICERROR_PROPERTY))
{
-
printf("-- The error is %s:\n",icalproperty_get_xlicerror(p));
}
-
-
/* Check the component for iTIP compilance, and add more
X-LIC-ERROR properties if it is non-compilant. */
icalrestriction_check(comp);
-
/* Count the new errors. */
if(errors != icalcomponent_count_errors(comp)){
printf(" -- The component also has iTIP restriction errors \n");
@@ -61,7 +59,5 @@ void component_errors(icalcomponent *comp)
properties in the reply. This following routine makes this
conversion */
-
icalcomponent_convert_errors(comp);
-
}
diff --git a/examples/main.c b/examples/main.c
index 587dbd21..f2165dcf 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -1,4 +1,9 @@
-/* This is just to make the code in the example directory link properly. */
+/* This is just to make the code in the example directory link properly.
+
+ SPDX-FileCopyrightText: <eric@civicknowledge.com>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
+
#include <libical/ical.h>
int main()
@@ -6,7 +11,6 @@ int main()
return 1;
}
-
void do_something(icalcomponent* comp)
{
(void)comp;/*unused*/
diff --git a/examples/parse_text.c b/examples/parse_text.c
index 67a2345f..d97ef4c6 100644
--- a/examples/parse_text.c
+++ b/examples/parse_text.c
@@ -1,6 +1,9 @@
/* parse_text.c
- */
+ SPDX-FileCopyrightText: <eric@civicknowledge.com>
+ SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
+*/
+
#include <libical/ical.h>
#include <stdlib.h>
@@ -43,7 +46,6 @@ void parse_text(char* argv[])
completes a component, c will be non-zero */
c = icalparser_add_line(parser,line);
-
if (c != 0){
char *temp = icalcomponent_as_ical_string_r(c);
printf("%s", temp);
@@ -56,6 +58,5 @@ void parse_text(char* argv[])
} while ( line != 0);
-
icalparser_free(parser);
}