亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? in_utils.c

?? internich公司實現的一個非常非常小的OS
?? C
字號:
/* * FILENAME: in_utils.c * * Copyright 1997- 2004 By InterNiche Technologies Inc. All rights reserved * Portions Copyright 1993 by NetPort Software  * * Misc commands for InterNiche menu system & diagnostic suite.  * * MODULE: NTF * * ROUTINES: con_page(), do_trap(), hexdump(), nextarg(), * ROUTINES: ns_printf(), panic(), print_eth(), print_uptime(), * ROUTINES: std_in(), std_out(), uslash(), * * PORTABLE: yes */#include "license.h"#include "ipport.h"#if defined(NATIVE_PRINTF) || defined(PRINTF_STDARG)#include <stdarg.h>#endif#ifdef NATIVE_PRINTF#include <stdio.h>#endif#include "in_utils.h"/* FUNCTION: do_trap() * * try to hook system debugger *  * PARAM1:  * * RETURNS: 0 */intdo_trap(void){   dtrap();   return 0;}/* FUNCTION: nextarg() * * nextarg() - returns a pointer to next arg in string passed. args  * are printable ascii sequences of chars delimited by spaces. If  * string ends without more args, then a pointer to the NULL  * terminating the string is returned.  * *  * PARAM1: char * argp * * RETURNS:  pointer to next arg in string  */char *   nextarg(char * argp){   while (*argp > ' ')argp++; /* scan past current arg */      while (*argp == ' ')argp++;   /* scan past spaces */      return(argp);}/* FUNCTION: hexdump() * * hexdump() - does a hex dump to console of a passed buffer. The  * buffer is declared as void so structs can be passed with the  * Compiler fussing.  * *  * PARAM1: void * pio * PARAM2: void * buffer * PARAM3: unsigned len * * RETURNS: void */#define  HEX_BYTES_PER_LINE   16voidhexdump(void * pio, void * buffer, unsigned len){   u_char * data  =  (u_char *)buffer;   unsigned int count;   char  c;   while (len)   {      /* display data in hex */      for (count = 0; (count < HEX_BYTES_PER_LINE) && (count < len); ++count)         ns_printf(pio, "%02x ", *(data + count));      /* display data in ascii */      for (count = 0; (count < HEX_BYTES_PER_LINE) && (count < len); ++count)      {         c = *(data + count);         ns_printf(pio, "%c", ((c >= 0x20) && (c < 0x7f)) ? c : '.');      }      ns_printf(pio,"\n");      len -= count;      data += count;   }}/* FUNCTION: print_uptime() * * format a neat time string from a SNMP TIMETICKS * uptime format variable. * * Note: NOT REENTRANT *  * PARAM1: unsigned long timetick * * RETURNS:  pointer to formatted text */static char tistring[24];     /* buffer for return */char *   print_uptime(unsigned long timetick){   unsigned seconds, minutes, hours;   timetick = timetick/100;   /* turn timetick into seconds */   seconds = (unsigned)(timetick%60);   timetick = timetick/60;    /* turn timetick into minutes */   minutes = (unsigned)(timetick%60);   timetick = timetick/60;    /* turn timetick into hours */   hours = (unsigned)(timetick%24);   timetick = timetick/24;    /* turn timetick into days */   if (timetick)  /* Is there a whole number of days? */      sprintf(tistring, "%ld days, %dh:%dm:%ds",     timetick, hours, minutes, seconds);   else if (hours)      sprintf(tistring, "%d hours, %dm:%ds", hours, minutes, seconds);   else      sprintf(tistring, "%d minutes, %d sec.", minutes, seconds);   return tistring;}/* FUNCTION: panic() * * Called if Software detects fatal system error. msg is * a string describing problem. There is no return from this  * routine. What this should do varies with the implementation. In a  * testing or development environment it should print messages, hook  * debuggers, etc. In an imbedded controller, it should probably try * to restart (ie warmboot) the system.  * *  * PARAM1: char * msg * * RETURNS: void *//* allow to be ifdeffed out on systems which already have a panic */#ifndef PANIC_ALREADYvoidpanic(char * msg){   dtrap();    /* try to hook debugger */   dprintf("panic: %s\n", msg);#ifndef NTF   netexit(1); /* try to clean up */#else /* NTF */   exit(1);#endif /* !NTF */}#endif   /* PANIC_ALREADY *//* FUNCTION: print_eth() * * print_eth() - pretty-print an ethernet address. Hex chars can be  * separated by "spacer" character passed. Returns a pointer to a tmp  * buffer with the formatted address  * *  * PARAM1: char * addr * PARAM2: char spacer * * RETURNS:  pointer to formatted text */char     eth_prt_buf[18];  /* buffer for return */char *   print_eth(char * addr, char spacer){   int   i;   char *   out   =  eth_prt_buf;   /* loop through 6 bytes of ethernet address */   for (i = 0; i < 6; i++)   {      /* high nibble */      *out = (char)(((*addr >> 4) & 0x0f) + 0x30);      if (*out > '9')   /* need to make it A-F? */         (*out) += 7;      out++;      /* low nibble */      *out = (char)((*addr & 0x0f) + 0x30);  /* low nibble to digit */      if (*out > '9')   /* need to make it A-F? */         (*out) += 7;   /* eg 0x3a -> 0x41 ('A') */      out++;      /* optional spacer character */      if (spacer && i < 5)         *out++ = spacer;      addr++;   }   *out = 0;   return eth_prt_buf;}/* FUNCTION: uslash() * * uslash() - turn DOS slashes("\") into UNIX slashs ("/"). That's  * not to imple that UNIX slashes are right or better, just to be  * consistent.  * *  * PARAM1: char * path * * RETURNS:  pointer to formatted text */char *   uslash(char * path){   char *   cp;   for (cp = path; *cp; cp++)      if (*cp == '\\')      *cp = '/';   return path;}/* FUNCTION: ns_printf() * * A generic printf() routine. It uses information from the * GenericIO structure to send the output to appropriate device. * Uses vsprintf() to make the output string. * The GenericIO structure contains a pointer to the function to * be used for device type ( eg file, or telnet connection ) * and an id identifing the specific device. For example, * for printing to a file, the function would point to fprintf  * and the id would be handle to file. * * PARAM1: void * vio      - Pointer to GenericIO structure (IN) * PARAM2: char * format   - Format string * followed by parameters as in printf. * PARAM3: ...             - variables to format * * RETURNS: Number of bytes that were output, or a negative error * code if an error occured. *//* First use #defines to set memory & output for this system: */#ifndef npallocextern   char * npalloc(unsigned);#endif   /* npalloc */#ifndef npfreevoid           npfree (void *);#endif   /* npfree */#ifndef NATIVE_PRINTF#ifdef PRINTF_STDARGint doprint(char * target, unsigned tlen, char * sp, va_list va);#elseint doprint(char * target, unsigned tlen, char * sp, int FAR * vp);#endif   /* PRINTF_STDARG */#endif   /* NATIVE_PRINTF *//* ns_printf's output can be directed to goto /dev/null. In such * cases, we don't want the following implementation and can omit * it with this ifdef: */#ifndef ns_printfint ns_printf(void * vio, char * format, ...){   char *   outbuf=NULL;   int   ret_value   ;   int   buf_size =  MAXIOSIZE   ;   GEN_IO pio = (GEN_IO)vio;  /* convert void* to our IO device type */#if defined(NATIVE_PRINTF) || defined(PRINTF_STDARG)   va_list argList;#else /* NATIVE_PRINTF || PRINTF_STRING */   int * next_arg=(int *)  &format;   next_arg +=  sizeof(char *)/sizeof(int) ;#endif   /* NATIVE_PRINTF || PRINTF_STRING */   /* a NULL pio means just dump the output to stdout */   if ( pio == NULL )   {#ifdef NATIVE_PRINTF      /* use the target system's ANSI routines */      va_start(argList,format);      ret_value = vprintf(format,argList);      va_end(argList);      return ret_value;#else /* not NATIVE_PRINTF */      /* use our homegrown versions */#ifdef PRINTF_STDARG      va_start(argList,format);      doprint(NULL,0,format,argList);      va_end(argList);#else    /* not PRINTF_STDARG */      doprint(NULL,0,format,next_arg);#endif   /* PRINTF_STDARG */      /* The return value here is not accurate-later */      return strlen(format);#endif   /* NATIVE_PRINTF */   }   /* Check if the output function is set */   if ( pio->out == NULL )   {      /* Programming mistake. Output function not set. */      return -1;   }   /* Allocate memory for the output string     * If the format string is greater than MAXIOSIZE, then    * we surely need to allocate a bigger block    */   ret_value = strlen(format);    if ( ret_value >= MAXIOSIZE )   {      buf_size += ret_value ;   }   outbuf=(char *)npalloc(buf_size);    if ( outbuf == NULL )   {      return -2;   }   /* Now populate the output string */#ifdef NATIVE_PRINTF   /* use the target system's ANSI routines */   va_start(argList,format);   ret_value = vsprintf(outbuf,format,argList);   va_end(argList);#else /* NATIVE_PRINTF */   /* use the homegrown routines */#ifdef PRINTF_STDARG   va_start(argList,format);   doprint(outbuf,buf_size,format,argList);   va_end(argList);#else    /* not PRINTF_STDARG */   doprint(outbuf,buf_size,format,next_arg);#endif   /* PRINTF_STDARG */#endif   /* NATIVE_PRINTF */#ifdef NATIVE_PRINTF   /* Check if we have overwritten the output buffer */   if ( (int)strlen(outbuf) > buf_size )   {      /* Might want a more robust determination of whether outbuf        * got overflowed, like putting a magic number at the end of it        * before vsprintf call and verifying its still there afterwards       */      /* Yes , we have overwritten. Truncate the output string.       * Some memory in the heap has been corrupted, but it is too       * late to rectify.       */      panic("ns_printf:Buffer overflow");      outbuf[buf_size-1]=0;   /* Null terminate the string */   }#endif   ret_value =(pio->out)(pio->id,outbuf,strlen(outbuf)) ;   /* Free memory for the output string */   npfree(outbuf);    /* since ns_printf() can get called repeatedly down in the bowels     * of a single command interpretting function, spin tk_yield() so     * that     */   tk_yield();   return ret_value ;}#endif      /* ns_printf *//* FUNCTION: std_out() * * Function which outputs the contents to standard output. * This function can be used with the GenericIO structure. * * PARAM1: long s    - Index to the output device. As there is only one *         output device for standard output, this value *         will not be meaningful to this function. (IN) * PARAM2: char *buf - Buffer of data (IN) * PARAM3: int len   - Length of data in buffer (IN) *         Length is needed so that we can output hex data also. * * RETURNS: Number of bytes send to standard output.  */int std_out(long s, char * buf, int len){   /* puts(buf); - This does newline expansion return     * write(0,buf,len); - This doesn't printf(buf); - This has     * problems when printf format strings (eg %s) is part of data.     */   printf("%s",buf);   USE_ARG(s);   return len;}#ifdef IN_MENUS/* FUNCTION: std_in() * * Returns the value of input char. Returns 0 if no char ready. * * PARAM1: long s - may someday be a device descriptor. * * RETURNS: Returns the input char, or 0 if no char ready. */extern   int kbhit(void);extern   int getch(void);int std_in(long s){   USE_ARG(s);   if ( !kbhit() )   {      return 0;   }   else   {      return ( getch() );   }}#endif   /* IN_MENUS *//* FUNCTION: con_page() * *  implement simple 'page' mechanism.  Blocks respectfully (other * tasks not blocked) until some input arrives. * * PARAM1: void * vio   - Pointer to GEN_IO structure (IN) * PARAM2: int lines    - Current line count (IN) * * RETURNS: 1 if we got a break, 0 to keep printing */intcon_page(void * vio, int lines){   int   ch;   GEN_IO pio = (GEN_IO)vio;  /* convert void* to our IO device type */   if (lines % 20 == 0 )   /* Time to get user input */   {      if ( pio && pio->getch )   /*if i/p func is supplied*/      {         ns_printf(pio,"....press any key for more (ESC to break)....");         do          {            ch = (pio->getch)(pio->id);            if ( ch == 0 )               tk_yield();    /* Give timeslice to other processes */         } while ( ch == 0 ) ;            /* if there is fatal error, we don't want to do any I/O */         if ( ch == -1 )   /* fatal error */            return 1 ;         ns_printf(pio,"\n");         if ( ch == 27 )   /* ESC key pressed */            return 1 ;      }   }   return  0;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧洲一区二区三区在线| 成人激情动漫在线观看| 亚洲天堂av一区| 久久九九久精品国产免费直播| 欧美美女直播网站| 在线视频中文字幕一区二区| 色偷偷成人一区二区三区91| 色网综合在线观看| 欧美在线观看一二区| 欧美亚洲综合在线| 欧美精选一区二区| 欧美第一区第二区| 国产亚洲1区2区3区| 国产欧美视频一区二区| 亚洲欧洲国产日本综合| 亚洲美女在线国产| 亚洲国产日产av| 偷窥国产亚洲免费视频| 免费黄网站欧美| 国产高清精品网站| 色综合久久中文综合久久97 | 欧美群妇大交群的观看方式| 欧美调教femdomvk| 91精品在线观看入口| 欧美mv日韩mv国产网站app| 久久久国产午夜精品| 亚洲男女一区二区三区| 欧美aaaaa成人免费观看视频| 精品一区二区三区av| 成人黄色电影在线| 欧美国产精品一区二区| 亚洲精品国产无天堂网2021| 婷婷六月综合亚洲| 成人免费看视频| 精品污污网站免费看| 久久伊人蜜桃av一区二区| 18欧美亚洲精品| 久久69国产一区二区蜜臀| 成人h版在线观看| 91精品国产欧美一区二区| 国产精品每日更新在线播放网址| 亚洲一区二区不卡免费| 国产精品99久久久久久似苏梦涵 | 777a∨成人精品桃花网| 久久久久久久久久久电影| 一区二区三区日韩欧美精品| 麻豆成人av在线| 国产欧美一区二区精品秋霞影院| 亚洲午夜电影网| 粉嫩av亚洲一区二区图片| 欧美高清hd18日本| 成人欧美一区二区三区小说 | 国产成人av电影在线观看| 欧美日韩国产另类不卡| 国产精品福利一区二区三区| 国产在线麻豆精品观看| 欧美另类高清zo欧美| 亚洲蜜臀av乱码久久精品蜜桃| 麻豆精品蜜桃视频网站| 制服丝袜中文字幕一区| 亚洲一区二区视频| 99国产精品久久| 亚洲国产成人私人影院tom| 日韩av电影免费观看高清完整版| 97精品国产97久久久久久久久久久久| 26uuu亚洲综合色欧美 | 26uuu国产日韩综合| 日韩精品电影在线观看| 欧美日韩国产综合久久| 亚洲午夜精品网| 色综合久久66| 一二三四社区欧美黄| 91蝌蚪porny九色| 日韩美女视频一区二区| 99精品国产一区二区三区不卡| 欧美激情自拍偷拍| 岛国精品在线观看| 中文字幕一区二区三区视频| 成人免费av在线| 中文字幕亚洲区| av电影天堂一区二区在线观看| 中文字幕高清不卡| 风间由美中文字幕在线看视频国产欧美| 精品久久久久久久一区二区蜜臀| 蜜桃91丨九色丨蝌蚪91桃色| 精品精品国产高清a毛片牛牛| 久久国产福利国产秒拍| 国产亚洲欧洲一区高清在线观看| 国产精品一区二区在线播放 | 精品少妇一区二区三区视频免付费| 午夜欧美电影在线观看| 日韩亚洲欧美一区二区三区| 久久99精品久久久| 亚洲一区在线观看网站| 欧美日韩成人激情| 麻豆成人久久精品二区三区小说| 久久久久久**毛片大全| 91丨九色porny丨蝌蚪| 亚洲国产精品久久艾草纯爱| 日韩免费高清视频| 国产91高潮流白浆在线麻豆| 亚洲裸体在线观看| 欧美美女直播网站| 国产精品一区不卡| 夜夜精品浪潮av一区二区三区| 日韩一区二区三区视频在线观看| 国产美女一区二区| 一区二区三区四区av| 欧美日韩1234| 国产激情视频一区二区在线观看 | 久久精品在线观看| 色婷婷综合久久久中文一区二区| 日本不卡视频在线| 国产精品久久午夜夜伦鲁鲁| 欧美日韩在线三级| 成人免费看的视频| 婷婷久久综合九色国产成人 | 国产在线精品一区二区夜色 | 欧美日韩成人在线一区| 国产成人综合在线| 天天综合色天天| 日本中文字幕一区| 最新国产の精品合集bt伙计| 91精品国产麻豆| 欧美视频日韩视频在线观看| 粉嫩aⅴ一区二区三区四区| 视频在线观看一区| 亚洲男人电影天堂| 国产日韩v精品一区二区| 欧美精品久久天天躁| 99久久免费国产| 国产精品一级片在线观看| 日韩综合一区二区| 亚洲午夜激情网页| 一区二区三区在线视频播放| 国产三级一区二区三区| 日韩欧美国产综合在线一区二区三区 | 日本中文字幕一区| 亚洲国产欧美在线| 一区二区三区在线观看动漫| 国产精品电影院| 国产欧美日韩三级| 久久九九99视频| 国产亚洲欧美色| 精品免费日韩av| 欧美一级欧美三级| 这里只有精品视频在线观看| 欧美军同video69gay| 欧美在线视频你懂得| 欧美性一区二区| 欧美性猛交xxxx乱大交退制版| av在线综合网| 99久久夜色精品国产网站| 成人午夜在线免费| 成人福利视频在线看| 99在线视频精品| 99久久免费国产| 色婷婷综合激情| 欧美日韩二区三区| 欧美精三区欧美精三区| 777欧美精品| 日韩精品综合一本久道在线视频| 51精品视频一区二区三区| 欧美久久久久久久久| 日韩你懂的在线播放| 精品日产卡一卡二卡麻豆| 欧美精品一区二区在线播放| 久久这里只有精品6| 中文在线资源观看网站视频免费不卡 | 偷窥国产亚洲免费视频| 日韩av中文字幕一区二区三区| 麻豆成人在线观看| 国产成人午夜高潮毛片| 91久久免费观看| 欧美另类z0zxhd电影| 久久九九99视频| 亚洲一区二区综合| 久久99久久99精品免视看婷婷 | 亚洲激情在线激情| 午夜电影网一区| 国产精品影音先锋| 色婷婷综合久久久中文字幕| 666欧美在线视频| 中文字幕一区三区| 青青青伊人色综合久久| 粉嫩嫩av羞羞动漫久久久| 欧美亚洲自拍偷拍| 久久婷婷久久一区二区三区| 亚洲欧洲成人av每日更新| 婷婷成人综合网| 成人福利视频网站| 在线91免费看| 国产精品午夜春色av| 性欧美疯狂xxxxbbbb| 成人深夜福利app| 欧美一区二区观看视频| 最新久久zyz资源站| 欧美在线短视频| 久久青草欧美一区二区三区| 亚洲综合无码一区二区|