summaryrefslogtreecommitdiff
path: root/tests/test-file_name.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-11-09 14:38:28 -0800
committerBen Pfaff <blp@nicira.com>2010-11-10 10:56:01 -0800
commite1aff6f9f7103ee59e2501d3e6c705a685b20aeb (patch)
treee081b78ff112641da3581a5d433fe26b9920aac8 /tests/test-file_name.c
parentc214278b0d0e9b574a1f505f14a47d3d8d81aea1 (diff)
downloadopenvswitch-e1aff6f9f7103ee59e2501d3e6c705a685b20aeb.tar.gz
util: New function base_name().
Diffstat (limited to 'tests/test-file_name.c')
-rw-r--r--tests/test-file_name.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/test-file_name.c b/tests/test-file_name.c
new file mode 100644
index 000000000..a9d1ab94d
--- /dev/null
+++ b/tests/test-file_name.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2009, 2010 Nicira Networks.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <config.h>
+#include "util.h"
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+ int i;
+
+ for (i = 1; i < argc; i++) {
+ char *dir, *base;
+
+ dir = dir_name(argv[i]);
+ puts(dir);
+ free(dir);
+
+ base = base_name(argv[i]);
+ puts(base);
+ free(base);
+ }
+
+ return 0;
+}