Deleted Added
full compact
alias.c (242766) alias.c (254849)
1/*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 22 unchanged lines hidden (view full) ---

31 */
32
33#ifndef lint
34#if 0
35static char sccsid[] = "@(#)alias.c 8.3 (Berkeley) 5/4/95";
36#endif
37#endif /* not lint */
38#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 22 unchanged lines hidden (view full) ---

31 */
32
33#ifndef lint
34#if 0
35static char sccsid[] = "@(#)alias.c 8.3 (Berkeley) 5/4/95";
36#endif
37#endif /* not lint */
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/bin/sh/alias.c 242766 2012-11-08 13:33:48Z jilles $");
39__FBSDID("$FreeBSD: head/bin/sh/alias.c 254849 2013-08-25 11:42:53Z jilles $");
40
41#include <stdlib.h>
42#include "shell.h"
43#include "output.h"
44#include "error.h"
45#include "memalloc.h"
46#include "mystring.h"
47#include "alias.h"

--- 184 unchanged lines hidden (view full) ---

232 sorted[j++] = ap;
233 qsort(sorted, aliases, sizeof(*sorted), comparealiases);
234 for (i = 0; i < aliases; i++)
235 printalias(sorted[i]);
236 ckfree(sorted);
237}
238
239int
40
41#include <stdlib.h>
42#include "shell.h"
43#include "output.h"
44#include "error.h"
45#include "memalloc.h"
46#include "mystring.h"
47#include "alias.h"

--- 184 unchanged lines hidden (view full) ---

232 sorted[j++] = ap;
233 qsort(sorted, aliases, sizeof(*sorted), comparealiases);
234 for (i = 0; i < aliases; i++)
235 printalias(sorted[i]);
236 ckfree(sorted);
237}
238
239int
240aliascmd(int argc, char **argv)
240aliascmd(int argc __unused, char **argv __unused)
241{
242 char *n, *v;
243 int ret = 0;
244 struct alias *ap;
245
241{
242 char *n, *v;
243 int ret = 0;
244 struct alias *ap;
245
246 if (argc == 1) {
246 nextopt("");
247
248 if (*argptr == NULL) {
247 printaliases();
248 return (0);
249 }
249 printaliases();
250 return (0);
251 }
250 while ((n = *++argv) != NULL) {
252 while ((n = *argptr++) != NULL) {
251 if ((v = strchr(n+1, '=')) == NULL) /* n+1: funny ksh stuff */
252 if ((ap = lookupalias(n, 0)) == NULL) {
253 warning("%s: not found", n);
254 ret = 1;
255 } else
256 printalias(ap);
257 else {
258 *v++ = '\0';

--- 34 unchanged lines hidden ---
253 if ((v = strchr(n+1, '=')) == NULL) /* n+1: funny ksh stuff */
254 if ((ap = lookupalias(n, 0)) == NULL) {
255 warning("%s: not found", n);
256 ret = 1;
257 } else
258 printalias(ap);
259 else {
260 *v++ = '\0';

--- 34 unchanged lines hidden ---