Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
cmdline.c
Package: linux-2.4.20.tar.gz [view]
Upload User: jlfgdled
Upload Date: 2013-04-10
Package Size: 33168k
Code Size: 2k
Category:
Linux-Unix program
Development Platform:
Unix_Linux
- /*
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * cmdline.c: Kernel command line creation using ARCS argc/argv.
- *
- * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
- */
- #include <linux/init.h>
- #include <linux/kernel.h>
- #include <linux/string.h>
- #include <asm/sgialib.h>
- #include <asm/bootinfo.h>
- #undef DEBUG_CMDLINE
- char arcs_cmdline[CL_SIZE];
- char * __init prom_getcmdline(void)
- {
- return &(arcs_cmdline[0]);
- }
- static char *ignored[] = {
- "ConsoleIn=",
- "ConsoleOut=",
- "SystemPartition=",
- "OSLoader=",
- "OSLoadPartition=",
- "OSLoadFilename=",
- "OSLoadOptions="
- };
- #define NENTS(foo) ((sizeof((foo)) / (sizeof((foo[0])))))
- static char *used_arc[][2] = {
- { "OSLoadPartition=", "root=" },
- { "OSLoadOptions=", "" }
- };
- static char * __init move_firmware_args(char* cp)
- {
- char *s;
- int actr, i;
- actr = 1; /* Always ignore argv[0] */
- while (actr < prom_argc) {
- for(i = 0; i < NENTS(used_arc); i++) {
- int len = strlen(used_arc[i][0]);
- if (!strncmp(prom_argv(actr), used_arc[i][0], len)) {
- /* Ok, we want it. First append the replacement... */
- strcat(cp, used_arc[i][1]);
- cp += strlen(used_arc[i][1]);
- /* ... and now the argument */
- s = strstr(prom_argv(actr), "=");
- if (s) {
- s++;
- strcpy(cp, s);
- cp += strlen(s);
- }
- *cp++ = ' ';
- break;
- }
- }
- actr++;
- }
- return cp;
- }
- void __init prom_init_cmdline(void)
- {
- char *cp;
- int actr, i;
- actr = 1; /* Always ignore argv[0] */
- cp = &(arcs_cmdline[0]);
- /*
- * Move ARC variables to the beginning to make sure they can be
- * overridden by later arguments.
- */
- cp = move_firmware_args(cp);
- while (actr < prom_argc) {
- for (i = 0; i < NENTS(ignored); i++) {
- int len = strlen(ignored[i]);
- if (!strncmp(prom_argv(actr), ignored[i], len))
- goto pic_cont;
- }
- /* Ok, we want it. */
- strcpy(cp, prom_argv(actr));
- cp += strlen(prom_argv(actr));
- *cp++ = ' ';
- pic_cont:
- actr++;
- }
- if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
- --cp;
- *cp = '';
- #ifdef DEBUG_CMDLINE
- prom_printf("prom_init_cmdline: %sn", &(arcs_cmdline[0]));
- #endif
- }