summaryrefslogtreecommitdiff
path: root/crypto/heimdal/lib/sl/sl.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/heimdal/lib/sl/sl.c')
-rw-r--r--crypto/heimdal/lib/sl/sl.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/crypto/heimdal/lib/sl/sl.c b/crypto/heimdal/lib/sl/sl.c
index 8f604e89b84b..30f69436dd2e 100644
--- a/crypto/heimdal/lib/sl/sl.c
+++ b/crypto/heimdal/lib/sl/sl.c
@@ -1,23 +1,23 @@
/*
- * Copyright (c) 1995 - 2006 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 2006 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -31,10 +31,7 @@
* SUCH DAMAGE.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: sl.c 21160 2007-06-18 22:58:21Z lha $");
-#endif
#include "sl_locl.h"
#include <setjmp.h>
@@ -61,7 +58,7 @@ mandoc_template(SL_cmd *cmds,
strncpy(cmd, p, sizeof(cmd));
cmd[sizeof(cmd)-1] = '\0';
strupr(cmd);
-
+
printf(".Dt %s SECTION\n", cmd);
printf(".Os OPERATING_SYSTEM\n");
printf(".Sh NAME\n");
@@ -75,7 +72,7 @@ mandoc_template(SL_cmd *cmds,
continue; */
printf(".Op Fl %s", c->name);
printf("\n");
-
+
}
if (extra_string && *extra_string)
printf (".Ar %s\n", extra_string);
@@ -156,7 +153,7 @@ sl_help (SL_cmd *cmds, int argc, char **argv)
if(prev_c)
printf ("\n\t%s%s", prev_c->usage ? prev_c->usage : "",
prev_c->usage ? "\n" : "");
- } else {
+ } else {
c = sl_match (cmds, argv[1], 0);
if (c == NULL)
printf ("No such command: %s. "
@@ -224,7 +221,7 @@ sl_make_argv(char *line, int *ret_argc, char ***ret_argv)
int argc, nargv;
char **argv;
int quote = 0;
-
+
nargv = 10;
argv = malloc(nargv * sizeof(*argv));
if(argv == NULL)
@@ -302,7 +299,7 @@ static char *sl_readline(const char *prompt)
return s;
}
-/* return values:
+/* return values:
* 0 on success,
* -1 on fatal error,
* -2 if EOF, or
@@ -314,8 +311,7 @@ sl_command_loop(SL_cmd *cmds, const char *prompt, void **data)
char *buf;
int argc;
char **argv;
-
- ret = 0;
+
buf = sl_readline(prompt);
if(buf == NULL)
return -2;
@@ -340,7 +336,7 @@ sl_command_loop(SL_cmd *cmds, const char *prompt, void **data)
return ret;
}
-int
+int
sl_loop(SL_cmd *cmds, const char *prompt)
{
void *data = NULL;
@@ -375,8 +371,11 @@ sl_slc_help (SL_cmd *cmds, int argc, char **argv)
argv[0]);
} else {
if(c->func) {
- char *fake[] = { NULL, "--help", NULL };
+ static char help[] = "--help";
+ char *fake[3];
fake[0] = argv[0];
+ fake[1] = help;
+ fake[2] = NULL;
(*c->func)(2, fake);
fprintf(stderr, "\n");
}