used to die (but now it lives))
int len = 10;
/* 1st option is potentially special */
- if ((argv[1][0] == '-') && isDecimal(argv[1][1])) {
+ if ((argc > 1) && (argv[1][0] == '-') && isDecimal(argv[1][1])) {
int tmplen = atoi(&argv[1][1]);
if (tmplen) { len = tmplen; }
i = 2;
opt = argv[i][1];
switch (opt) {
case '-':
+ break;
case 'h':
usage(head_usage);
default:
exit(0);
}
-/* $Id: head.c,v 1.2 1999/12/10 08:29:20 andersen Exp $ */
+/* $Id: head.c,v 1.3 1999/12/15 19:29:09 beppu Exp $ */
int len = 10;
/* 1st option is potentially special */
- if ((argv[1][0] == '-') && isDecimal(argv[1][1])) {
+ if ((argc > 1) && (argv[1][0] == '-') && isDecimal(argv[1][1])) {
int tmplen = atoi(&argv[1][1]);
if (tmplen) { len = tmplen; }
i = 2;
opt = argv[i][1];
switch (opt) {
case '-':
+ break;
case 'h':
usage(head_usage);
default:
exit(0);
}
-/* $Id: head.c,v 1.2 1999/12/10 08:29:20 andersen Exp $ */
+/* $Id: head.c,v 1.3 1999/12/15 19:29:09 beppu Exp $ */